{
  "openapi": "3.1.0",
  "info": {
    "title": "mxr HTTP Bridge",
    "description": "Local-first email daemon HTTP/WebSocket surface. This document is a route inventory plus protocol schemas. Some routes include typed parameters and request and response schemas; others list only path and method metadata. Some live bridge routes are not declared here. All routes declared in this document except /api/v1/health require a bearer token, read from the `bridge-token` file in the active profile's config directory (`~/Library/Application Support/mxr` on macOS, `$XDG_CONFIG_HOME/mxr` or `~/.config/mxr` on Linux). `[bridge].token_path` wins over `MXR_BRIDGE_TOKEN_PATH`, which wins over `MXR_CONFIG_DIR`.",
    "contact": {
      "name": "mxr",
      "url": "https://mxr.sh"
    },
    "license": {
      "name": "MIT OR Apache-2.0"
    },
    "version": "0.6.278"
  },
  "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": "Bridge is up. Returns status, service, and protocol_version"
          }
        },
        "security": []
      }
    },
    "/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-preview/commit": {
      "post": {
        "tags": [],
        "summary": "Commit previewed unsubscribe and optionally clear mail",
        "operationId": "action_commit_unsubscribe_preview",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CommitUnsubscribePreviewRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Unsubscribe result"
          },
          "401": {
            "description": "Missing or invalid bridge token"
          },
          "422": {
            "description": "Invalid or unsupported preview commit"
          }
        }
      }
    },
    "/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/archive-ask": {
      "post": {
        "tags": [],
        "summary": "Ask the archive a question with citations",
        "operationId": "mail_archive_ask",
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/mail/archive-operations/preview": {
      "post": {
        "tags": [],
        "operationId": "archive_preview",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ArchivePreviewBody"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Immutable Archive review",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ResponseData"
                }
              }
            }
          },
          "400": {
            "description": "Malformed Archive request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ArchiveErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "Bridge authorization required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ArchiveErrorResponse"
                }
              }
            }
          },
          "409": {
            "description": "Identity, workspace or selection conflict",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ArchiveErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Unsupported daemon or policy",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ArchiveErrorResponse"
                }
              }
            }
          },
          "500": {
            "description": "Review persistence failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ArchiveErrorResponse"
                }
              }
            }
          },
          "502": {
            "description": "IPC response unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ArchiveErrorResponse"
                }
              }
            }
          },
          "503": {
            "description": "Selected daemon unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ArchiveErrorResponse"
                }
              }
            }
          },
          "504": {
            "description": "IPC response timed out",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ArchiveErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/mail/archive-operations/query": {
      "post": {
        "tags": [],
        "operationId": "archive_query",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ArchiveQueryBody"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Side-effect-free retained receipt",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ResponseData"
                }
              }
            }
          },
          "400": {
            "description": "Malformed Archive request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ArchiveErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "Bridge authorization required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ArchiveErrorResponse"
                }
              }
            }
          },
          "409": {
            "description": "Identity or workspace conflict",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ArchiveErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Unsupported daemon or policy",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ArchiveErrorResponse"
                }
              }
            }
          },
          "500": {
            "description": "Receipt persistence unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ArchiveErrorResponse"
                }
              }
            }
          },
          "502": {
            "description": "IPC response unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ArchiveErrorResponse"
                }
              }
            }
          },
          "503": {
            "description": "Selected daemon unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ArchiveErrorResponse"
                }
              }
            }
          },
          "504": {
            "description": "IPC response timed out",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ArchiveErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/mail/archive-operations/submit": {
      "post": {
        "tags": [],
        "operationId": "archive_submit",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ArchiveSubmitBody"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Durable acceptance or retained per-item outcome",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ResponseData"
                }
              }
            }
          },
          "400": {
            "description": "Malformed Archive request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ArchiveErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "Bridge authorization required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ArchiveErrorResponse"
                }
              }
            }
          },
          "409": {
            "description": "Identity, workspace or review conflict",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ArchiveErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Unsupported daemon or policy",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ArchiveErrorResponse"
                }
              }
            }
          },
          "500": {
            "description": "Acceptance persistence failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ArchiveErrorResponse"
                }
              }
            }
          },
          "502": {
            "description": "Reply lost; query retained identity",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ArchiveErrorResponse"
                }
              }
            }
          },
          "503": {
            "description": "Selected daemon unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ArchiveErrorResponse"
                }
              }
            }
          },
          "504": {
            "description": "Reply timed out; query retained identity",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ArchiveErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/mail/archive-operations/workspace": {
      "get": {
        "tags": [],
        "operationId": "archive_workspace",
        "responses": {
          "200": {
            "description": "Selected workspace and recovery generation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ResponseData"
                }
              }
            }
          },
          "400": {
            "description": "Malformed Archive request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ArchiveErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "Bridge authorization required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ArchiveErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Unsupported daemon",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ArchiveErrorResponse"
                }
              }
            }
          },
          "500": {
            "description": "Receipt persistence unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ArchiveErrorResponse"
                }
              }
            }
          },
          "502": {
            "description": "IPC response unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ArchiveErrorResponse"
                }
              }
            }
          },
          "503": {
            "description": "Selected daemon unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ArchiveErrorResponse"
                }
              }
            }
          },
          "504": {
            "description": "IPC response timed out",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ArchiveErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/mail/arrivals": {
      "get": {
        "tags": [],
        "summary": "Now's arrivals line: every email first seen since Now was last opened, counted once by where it went, with Not-sure questions and the track record",
        "operationId": "mail_arrivals",
        "parameters": [
          {
            "name": "account",
            "in": "query",
            "description": "Account id; omitted covers every account",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "mark_seen",
            "in": "query",
            "description": "True when Now opens: starts a visit",
            "required": false,
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "since",
            "in": "query",
            "description": "The window start the open visit was answered; a refetch that doesn't mark keeps it",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The `Arrivals` variant",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ResponseData"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/mail/arrivals/list": {
      "get": {
        "tags": [],
        "summary": "The emails behind one count of the arrivals line, newest first, exactly as many as the count",
        "operationId": "mail_arrivals_list",
        "parameters": [
          {
            "name": "account",
            "in": "query",
            "description": "Account id; omitted covers every account",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "bucket",
            "in": "query",
            "description": "messages, todo, updates, reading, archive, screened_out, spam or sorting; omitted lists every arrival",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "since",
            "in": "query",
            "description": "RFC 3339; defaults to the line's window",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "until",
            "in": "query",
            "description": "RFC 3339; defaults to now",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "description": "Default 100",
            "required": false,
            "schema": {
              "type": "integer",
              "format": "int32",
              "minimum": 0
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The `ArrivalList` variant",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ResponseData"
                }
              }
            }
          },
          "400": {
            "description": "Unknown bucket, or until not after since"
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/mail/arrivals/modes": {
      "post": {
        "tags": [],
        "summary": "Where each of up to 200 emails went and where it is now, for Inbox's mode chips",
        "operationId": "mail_arrivals_modes",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ArrivalModesBody"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "The `ArrivalModes` variant",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ResponseData"
                }
              }
            }
          },
          "400": {
            "description": "No ids, more than 200, or a bad id"
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/mail/assistant/availability": {
      "get": {
        "tags": [],
        "summary": "Whether the assistant can run, on which model, and whether conversations leave this machine",
        "operationId": "mail_assistant_availability",
        "responses": {
          "200": {
            "description": "The `AssistantAvailability` variant",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ResponseData"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/mail/assistant/conversations": {
      "get": {
        "tags": [],
        "summary": "Assistant conversations, most recently active first",
        "operationId": "mail_assistant_list",
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "description": "At most this many (default 50)",
            "required": false,
            "schema": {
              "type": "integer",
              "format": "int32",
              "minimum": 0
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The `AssistantConversations` variant",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ResponseData"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      },
      "post": {
        "tags": [],
        "summary": "Send a message to the assistant; returns once the turn starts. Follow AssistantUpdated events",
        "operationId": "mail_assistant_send",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AssistantSendBody"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "The `AssistantConversation` variant",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ResponseData"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/mail/assistant/conversations/{id}": {
      "get": {
        "tags": [],
        "summary": "One assistant conversation, with what waits for the user",
        "operationId": "mail_assistant_get",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "Conversation id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The `AssistantConversation` variant",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ResponseData"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/mail/assistant/conversations/{id}/auto-approve": {
      "post": {
        "tags": [],
        "summary": "Let reversible changes run without asking in this conversation; sending, deleting, trash, spam and rules still ask",
        "operationId": "mail_assistant_auto_approve",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "Conversation id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AssistantAutoApproveBody"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "The `AssistantConversation` variant",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ResponseData"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/mail/assistant/conversations/{id}/cancel": {
      "post": {
        "tags": [],
        "summary": "Stop a running turn, or close what is waiting without running it",
        "operationId": "mail_assistant_cancel",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "Conversation id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The `AssistantConversation` variant",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ResponseData"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/mail/assistant/conversations/{id}/decide": {
      "post": {
        "tags": [],
        "summary": "Approve, reject or answer calls the assistant is waiting on; approving runs exactly the call shown",
        "operationId": "mail_assistant_decide",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "Conversation id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AssistantDecideBody"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "The `AssistantConversation` variant",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ResponseData"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/mail/assistant/conversations/{id}/delete": {
      "post": {
        "tags": [],
        "summary": "Delete a conversation and its transcript; dry_run says what would go",
        "operationId": "mail_assistant_delete",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "Conversation id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AssistantDeleteBody"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "The `AssistantDelete` variant",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ResponseData"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/mail/assistant/conversations/{id}/steps/{call_id}/rows": {
      "get": {
        "tags": [],
        "summary": "Every row one assistant step's stored result lists, up to 500",
        "operationId": "mail_assistant_step_rows",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "Conversation id",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "call_id",
            "in": "path",
            "description": "The step's tool call id",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "seq",
            "in": "query",
            "description": "The seq of the assistant message that declared the call",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int64"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The `AssistantStepRows` variant",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ResponseData"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/mail/assistant/model": {
      "post": {
        "tags": [],
        "summary": "Set the model the assistant uses from its next message, for every conversation; refused for a model outside the list, without its key, or off this machine while the cloud setting is off",
        "operationId": "mail_assistant_set_model",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AssistantModelBody"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "The `AssistantModelChange` variant",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ResponseData"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/mail/assistant/models": {
      "get": {
        "tags": [],
        "summary": "The models the assistant can be set to, which can be picked now and why not, and the one in use",
        "operationId": "mail_assistant_models",
        "responses": {
          "200": {
            "description": "The `AssistantModels` variant",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ResponseData"
                }
              }
            }
          },
          "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/attachments/transfer/chunk": {
      "post": {
        "tags": [],
        "summary": "Read a bounded attachment transfer chunk",
        "operationId": "attachment_transfer_chunk",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AttachmentChunkRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Base64-encoded attachment bytes at the requested offset",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AttachmentChunk"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/mail/attachments/transfer/metadata": {
      "post": {
        "tags": [],
        "summary": "Get attachment transfer metadata",
        "operationId": "attachment_transfer_metadata",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AttachmentRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Attachment identifiers, size, checksum, and maximum chunk size for the transfer",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AttachmentTransferMetadata"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/mail/categories": {
      "get": {
        "tags": [],
        "summary": "List personal categories",
        "operationId": "categories_list",
        "parameters": [
          {
            "name": "account_id",
            "in": "query",
            "description": "Filter membership counts to this account",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Personal categories and account-scoped counts",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CategoriesResponse"
                }
              }
            }
          },
          "400": {
            "description": "Malformed account id"
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      },
      "post": {
        "tags": [],
        "summary": "Create a personal category",
        "operationId": "categories_create",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CategoryNameBody"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Updated personal category catalog",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CategoriesResponse"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid bridge token"
          },
          "422": {
            "description": "The daemon rejected an invalid or duplicate category name"
          }
        }
      }
    },
    "/api/v1/mail/categories/assignment/apply": {
      "post": {
        "tags": [],
        "summary": "Apply previewed category assignments",
        "operationId": "categories_assignment_apply",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CategoryTokenBody"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Applied assignment counts and Undo mutation id",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CategoryMembershipAppliedResponse"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid bridge token"
          },
          "422": {
            "description": "The daemon rejected an invalid, stale, or expired preview token"
          }
        }
      }
    },
    "/api/v1/mail/categories/assignment/preview": {
      "post": {
        "tags": [],
        "summary": "Preview category assignments for selected messages",
        "operationId": "categories_assignment_preview",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CategoryMembershipBody"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Stale-safe assignment preview and confirmation token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CategoryMembershipPreview"
                }
              }
            }
          },
          "400": {
            "description": "Malformed account, message, or category id"
          },
          "401": {
            "description": "Missing or invalid bridge token"
          },
          "422": {
            "description": "The daemon rejected this account-scoped selection or category"
          }
        }
      }
    },
    "/api/v1/mail/categories/delete": {
      "post": {
        "tags": [],
        "summary": "Preview category deletion or apply its stale-safe preview",
        "operationId": "categories_delete",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DeleteCategoryBody"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Deletion preview, or deleted category id and name",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CategoryDeleteResponse"
                }
              }
            }
          },
          "400": {
            "description": "Malformed category id"
          },
          "401": {
            "description": "Missing or invalid bridge token"
          },
          "404": {
            "description": "Category was not found"
          },
          "422": {
            "description": "The daemon rejected a stale, missing, or expired preview token"
          }
        }
      }
    },
    "/api/v1/mail/categories/memberships": {
      "post": {
        "tags": [],
        "summary": "Read category assignments for selected messages",
        "operationId": "categories_memberships",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CategoryMembershipStateBody"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Membership counts for each selected category",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CategoryMembershipStatesResponse"
                }
              }
            }
          },
          "400": {
            "description": "Malformed account, message, or category id"
          },
          "401": {
            "description": "Missing or invalid bridge token"
          },
          "422": {
            "description": "The daemon rejected this account-scoped lookup"
          }
        }
      }
    },
    "/api/v1/mail/categories/messages": {
      "get": {
        "tags": [],
        "summary": "List messages in a personal category",
        "operationId": "categories_messages",
        "parameters": [
          {
            "name": "category_id",
            "in": "query",
            "description": "Stable category id",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "account_id",
            "in": "query",
            "description": "Restrict messages to this account",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "description": "Page size; defaults to 50",
            "required": false,
            "schema": {
              "type": "integer",
              "format": "int32",
              "minimum": 0
            }
          },
          {
            "name": "offset",
            "in": "query",
            "description": "Zero-based page offset",
            "required": false,
            "schema": {
              "type": "integer",
              "format": "int32",
              "minimum": 0
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Page of category messages",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CategoryMessagesResponse"
                }
              }
            }
          },
          "400": {
            "description": "Missing or invalid category id"
          },
          "401": {
            "description": "Missing or invalid bridge token"
          },
          "404": {
            "description": "Category was not found"
          }
        }
      }
    },
    "/api/v1/mail/categories/name/preview": {
      "post": {
        "tags": [],
        "summary": "Validate a personal category name without changing the catalog",
        "operationId": "categories_name_preview",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CategoryNamePreviewBody"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Normalized name and whether it is available",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CategoryNamePreviewResponse"
                }
              }
            }
          },
          "400": {
            "description": "Malformed category id"
          },
          "401": {
            "description": "Missing or invalid bridge token"
          },
          "422": {
            "description": "The daemon rejected an invalid category name"
          }
        }
      }
    },
    "/api/v1/mail/categories/rename": {
      "post": {
        "tags": [],
        "summary": "Rename a personal category while preserving its id and memberships",
        "operationId": "categories_rename",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RenameCategoryBody"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Updated personal category catalog",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CategoriesResponse"
                }
              }
            }
          },
          "400": {
            "description": "Malformed category id"
          },
          "401": {
            "description": "Missing or invalid bridge token"
          },
          "422": {
            "description": "The daemon rejected an invalid or duplicate category name"
          }
        }
      }
    },
    "/api/v1/mail/categories/undo": {
      "post": {
        "tags": [],
        "summary": "Undo a category assignment mutation",
        "operationId": "categories_undo",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CategoryUndoBody"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Restored and skipped membership counts",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CategoryMembershipUndoneResponse"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid bridge token"
          },
          "404": {
            "description": "Mutation was not found"
          },
          "422": {
            "description": "The daemon rejected an invalid, stale, or expired mutation id"
          }
        }
      }
    },
    "/api/v1/mail/categories/why": {
      "get": {
        "tags": [],
        "summary": "Explain category membership and rule provenance",
        "operationId": "category_why",
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/mail/classify/report": {
      "get": {
        "tags": [],
        "summary": "Stored fallback clusters and pending assessment counts; local and read-only",
        "operationId": "mail_classify_report",
        "parameters": [
          {
            "name": "account",
            "in": "query",
            "description": "Account id; omitted covers every account",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "description": "Emails examined; default 1000, maximum 10000",
            "required": false,
            "schema": {
              "type": "integer",
              "format": "int32",
              "minimum": 0
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The ClassifyReport variant",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ResponseData"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/mail/codes": {
      "get": {
        "tags": [],
        "summary": "One-time codes from the last day's mail, newest first, each current or expired",
        "operationId": "mail_codes",
        "parameters": [
          {
            "name": "account",
            "in": "query",
            "description": "Account id; omitted covers every account",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "description": "Most codes returned; default 10, at most 50",
            "required": false,
            "schema": {
              "type": "integer",
              "format": "int32",
              "minimum": 0
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The `OneTimeCodes` variant",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ResponseData"
                }
              }
            }
          },
          "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"
          }
        }
      },
      "post": {
        "tags": [],
        "summary": "Keep a promise from a sent message as a dated commitment",
        "operationId": "mail_commitments_record",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RecordPromiseRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "The `RecordedPromise` variant; with `dry_run` nothing is stored and the id is empty",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ResponseData"
                }
              }
            }
          },
          "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/apply": {
      "post": {
        "tags": [],
        "summary": "Write an accepted proposal into a stored draft's text region; refused if that text changed since the proposal",
        "operationId": "mail_compose_apply",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ComposeApplyBody"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "The draft now holds the proposal",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ComposeApplyResponse"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid bridge token"
          },
          "422": {
            "description": "The proposal expired, belongs to another draft, or the draft's text changed"
          }
        }
      }
    },
    "/api/v1/mail/compose/assist": {
      "post": {
        "tags": [],
        "summary": "Writing help for the text in a compose box: write it, finish it, polish it or edit a selection. Returns a proposal and changes nothing",
        "operationId": "mail_compose_assist",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ComposeAssistBody"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "A proposal: the whole proposed text, the word diff from yours, the gaps left, and which of your sentences changed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ComposeAssistResponse"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid bridge token"
          },
          "422": {
            "description": "Nothing to finish, a selection off a character boundary, text too long, or a privacy setting that stops the model"
          }
        }
      }
    },
    "/api/v1/mail/compose/models": {
      "get": {
        "tags": [],
        "summary": "List models available to compose under the compose route and privacy policy",
        "operationId": "mail_compose_models",
        "responses": {
          "200": {
            "description": "Compose model choices, locality and availability",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ComposeModelsResponse"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/mail/compose/session": {
      "post": {
        "tags": [],
        "operationId": "compose_session_start",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ComposeSessionStartRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Compose session result",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ComposeSessionResponse"
                }
              }
            }
          },
          "409": {
            "description": "Stale draft revision; preserve unsent text",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DraftConflictResponse"
                }
              }
            }
          },
          "422": {
            "description": "Invalid compose session",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DraftConflictResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/mail/compose/session/attachment": {
      "post": {
        "tags": [],
        "operationId": "compose_session_attachment",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ComposeSessionAttachmentRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Bounded upload declaration, chunk acknowledgement, or finalized owner revision",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ComposeAttachmentResponse"
                }
              }
            }
          },
          "409": {
            "description": "Stale owner revision"
          },
          "422": {
            "description": "Invalid declaration, chunk, integrity or unsupported daemon"
          }
        }
      }
    },
    "/api/v1/mail/compose/session/audience": {
      "post": {
        "tags": [],
        "operationId": "compose_session_audience",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ComposeSessionAudienceRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Reply audience preview or updated compose session",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ComposeSessionResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid draft identity or unsupported compose content",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DraftConflictResponse"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid bridge token"
          },
          "409": {
            "description": "Stale draft revision; preserve unsent text",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DraftConflictResponse"
                }
              }
            }
          },
          "422": {
            "description": "Invalid compose session",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DraftConflictResponse"
                }
              }
            }
          }
        }
      }
    },
    "/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": [],
        "operationId": "compose_session_discard",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ComposeSessionPathRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Compose session result",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DiscardedComposeResponse"
                }
              }
            }
          },
          "409": {
            "description": "Stale draft revision; preserve unsent text",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DraftConflictResponse"
                }
              }
            }
          },
          "422": {
            "description": "Invalid compose session",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DraftConflictResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/mail/compose/session/promises": {
      "post": {
        "tags": [],
        "summary": "Find promises in an outgoing compose session",
        "operationId": "compose_session_promises",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DetectComposePromisesRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "The `Promises` variant. A missing, blocked or slow model is a status, never an error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ResponseData"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/mail/compose/session/refresh": {
      "post": {
        "tags": [],
        "operationId": "compose_session_refresh",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ComposeSessionPathRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Compose session result",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ComposeSessionResponse"
                }
              }
            }
          },
          "409": {
            "description": "Stale draft revision; preserve unsent text",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DraftConflictResponse"
                }
              }
            }
          },
          "422": {
            "description": "Invalid compose session",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DraftConflictResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/mail/compose/session/restore": {
      "post": {
        "tags": [],
        "summary": "Restore compose session",
        "operationId": "compose_session_restore",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ComposeSessionRestoreRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ComposeSessionResponse"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid bridge token"
          },
          "409": {
            "description": "The draft's body is a supplied HTML document, which the markdown compose editor cannot represent. Body carries `code: \"html_draft_not_editable\"` and `previewHtml` (the document verbatim, for read-only display). Retrying cannot succeed."
          }
        }
      }
    },
    "/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",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ComposeSessionSendRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Compose safety report"
          },
          "400": {
            "description": "Local recovery requires explicit canonical reopen",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DraftConflictResponse"
                }
              }
            }
          },
          "401": {
            "description": "Missing bridge token"
          },
          "409": {
            "description": "Stale draft revision; preserve unsent text",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DraftConflictResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/mail/compose/session/save": {
      "post": {
        "tags": [],
        "operationId": "compose_session_save",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ComposeSessionSendRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Saved draft session",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SavedDraftResponse"
                }
              }
            }
          },
          "400": {
            "description": "Local recovery requires explicit canonical reopen",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DraftConflictResponse"
                }
              }
            }
          },
          "401": {
            "description": "Missing bridge token"
          },
          "409": {
            "description": "Stale draft revision; preserve unsent text",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DraftConflictResponse"
                }
              }
            }
          },
          "422": {
            "description": "Invalid draft or unsupported daemon",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DraftConflictResponse"
                }
              }
            }
          },
          "500": {
            "description": "Daemon operation failed; may carry an accepted draft revision",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DraftConflictResponse"
                }
              }
            }
          },
          "502": {
            "description": "Bridge IPC failed; may carry an accepted draft revision",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DraftConflictResponse"
                }
              }
            }
          },
          "503": {
            "description": "Daemon connection failed; may carry an accepted draft revision",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DraftConflictResponse"
                }
              }
            }
          },
          "504": {
            "description": "Daemon request timed out; may carry an accepted draft revision",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DraftConflictResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/mail/compose/session/schedule": {
      "post": {
        "tags": [],
        "operationId": "compose_session_schedule",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ComposeSessionScheduleRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Saved draft session",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ScheduledComposeResponse"
                }
              }
            }
          },
          "400": {
            "description": "Local recovery requires explicit canonical reopen",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DraftConflictResponse"
                }
              }
            }
          },
          "401": {
            "description": "Missing bridge token"
          },
          "409": {
            "description": "Stale draft revision; preserve unsent text",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DraftConflictResponse"
                }
              }
            }
          },
          "422": {
            "description": "Invalid draft or unsupported daemon",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DraftConflictResponse"
                }
              }
            }
          },
          "500": {
            "description": "Daemon operation failed; may carry an accepted draft revision",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DraftConflictResponse"
                }
              }
            }
          },
          "502": {
            "description": "Bridge IPC failed; may carry an accepted draft revision",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DraftConflictResponse"
                }
              }
            }
          },
          "503": {
            "description": "Daemon connection failed; may carry an accepted draft revision",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DraftConflictResponse"
                }
              }
            }
          },
          "504": {
            "description": "Daemon request timed out; may carry an accepted draft revision",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DraftConflictResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/mail/compose/session/send": {
      "post": {
        "tags": [],
        "summary": "Send compose session",
        "operationId": "compose_session_send",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ComposeSessionSendRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Sent compose session"
          },
          "400": {
            "description": "Local recovery requires explicit canonical reopen",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DraftConflictResponse"
                }
              }
            }
          },
          "401": {
            "description": "Missing bridge token"
          },
          "409": {
            "description": "Stale draft revision; preserve unsent text",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DraftConflictResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/mail/compose/session/update": {
      "post": {
        "tags": [],
        "operationId": "compose_session_update",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ComposeSessionUpdateRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Saved draft session",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ComposeSessionResponse"
                }
              }
            }
          },
          "401": {
            "description": "Missing bridge token"
          },
          "409": {
            "description": "Stale draft revision; preserve unsent text",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DraftConflictResponse"
                }
              }
            }
          },
          "422": {
            "description": "Invalid draft or unsupported daemon",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DraftConflictResponse"
                }
              }
            }
          },
          "500": {
            "description": "Daemon operation failed; may carry an accepted draft revision",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DraftConflictResponse"
                }
              }
            }
          },
          "502": {
            "description": "Bridge IPC failed; may carry an accepted draft revision",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DraftConflictResponse"
                }
              }
            }
          },
          "503": {
            "description": "Daemon connection failed; may carry an accepted draft revision",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DraftConflictResponse"
                }
              }
            }
          },
          "504": {
            "description": "Daemon request timed out; may carry an accepted draft revision",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DraftConflictResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/mail/contacts/autocomplete": {
      "get": {
        "tags": [],
        "summary": "Prefix-search known senders",
        "operationId": "contacts_autocomplete",
        "responses": {
          "200": {
            "description": "Known senders matching the query",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ContactsAutocompleteResponse"
                }
              }
            }
          },
          "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/corrections": {
      "get": {
        "tags": [],
        "summary": "Every move, sender mode and Not-sure answer, newest first",
        "operationId": "mail_corrections",
        "parameters": [
          {
            "name": "account",
            "in": "query",
            "description": "Account id; omitted covers every account",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "description": "Default 50",
            "required": false,
            "schema": {
              "type": "integer",
              "format": "int32",
              "minimum": 0
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The `Corrections` variant",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ResponseData"
                }
              }
            }
          },
          "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/desk": {
      "get": {
        "tags": [],
        "summary": "The desk: owed replies, due promises, waiting threads and new mail from people",
        "operationId": "mail_desk",
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/mail/desk/dismiss": {
      "post": {
        "tags": [],
        "summary": "Done waiting: take threads off the desk's Waiting lane (dry_run previews)",
        "operationId": "mail_desk_dismiss",
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/mail/desk/done": {
      "post": {
        "tags": [],
        "summary": "Done: put desk items away (archive, mark read, keep off the desk; resolve a promise). dry_run previews",
        "operationId": "mail_desk_done",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DeskDoneBody"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "The `DeskItemsResolved` variant: one outcome per item and the undo id",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ResponseData"
                }
              }
            }
          },
          "400": {
            "description": "No items"
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/mail/desk/later": {
      "post": {
        "tags": [],
        "summary": "Reply later, or bring back if nobody replies, until a time (by who wrote last). dry_run previews",
        "operationId": "mail_desk_later",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DeskLaterBody"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "The `ThreadsDeferred` variant: one item per conversation and the undo id",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ResponseData"
                }
              }
            }
          },
          "400": {
            "description": "No conversations"
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/mail/desk/restore": {
      "post": {
        "tags": [],
        "summary": "Undo done waiting",
        "operationId": "mail_desk_restore",
        "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": [],
        "operationId": "mail_drafts_save_local",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/Draft"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Canonical saved draft",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ResponseData"
                }
              }
            }
          },
          "409": {
            "description": "Stale revision",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DraftConflictResponse"
                }
              }
            }
          },
          "422": {
            "description": "Invalid draft or legacy daemon",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DraftConflictResponse"
                }
              }
            }
          }
        }
      }
    },
    "/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": [],
        "operationId": "mail_drafts_send_stored",
        "parameters": [
          {
            "name": "draft_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "operation_id",
            "in": "query",
            "description": "Retained reviewed send operation",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "expected_revision",
            "in": "query",
            "description": "Reviewed draft revision",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int64"
            }
          },
          {
            "name": "managed_attachments_reviewed",
            "in": "query",
            "description": "True only after reviewing current managed attachment metadata; defaults false",
            "required": false,
            "schema": {
              "type": "boolean"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Send receipt or outcome",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ResponseData"
                }
              }
            }
          },
          "401": {
            "description": "Missing bridge token"
          }
        }
      }
    },
    "/api/v1/mail/drafts/{draft_id}/stored": {
      "delete": {
        "tags": [],
        "operationId": "mail_drafts_delete_stored",
        "parameters": [
          {
            "name": "draft_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "expected_revision",
            "in": "query",
            "description": "Revision from the deletion preview",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int64"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Draft deleted",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ResponseData"
                }
              }
            }
          },
          "409": {
            "description": "Stale revision",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DraftConflictResponse"
                }
              }
            }
          },
          "422": {
            "description": "Legacy daemon",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DraftConflictResponse"
                }
              }
            }
          }
        }
      }
    },
    "/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/freshness": {
      "get": {
        "tags": [],
        "summary": "Freshness: the newest mail received, each account's sync health and the last arrivals with their modes",
        "operationId": "mail_freshness",
        "parameters": [
          {
            "name": "account",
            "in": "query",
            "description": "Account id; omitted covers every account: the freshest mail and the worst sync state",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "description": "Arrivals to return; default 5, at most 50",
            "required": false,
            "schema": {
              "type": "integer",
              "format": "int32",
              "minimum": 0
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The `Freshness` variant",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ResponseData"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/mail/gists": {
      "post": {
        "tags": [],
        "summary": "List-row gists for many conversations: cached ones at once, missing ones queued with generate",
        "operationId": "mail_thread_gists",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ThreadGistsBody"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "The `ThreadGists` variant: model state, cached gists, queued and skipped ids",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ResponseData"
                }
              }
            }
          },
          "400": {
            "description": "A malformed thread id or more than 100 ids"
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/mail/hints/{hint}": {
      "post": {
        "tags": [],
        "summary": "Dismiss a hint in every client, or show it again",
        "operationId": "mail_hint_seen",
        "parameters": [
          {
            "name": "hint",
            "in": "path",
            "description": "`todo.runway`",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/HintSeenBody"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "The `ModeGuides` variant",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ResponseData"
                }
              }
            }
          },
          "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/pin": {
      "post": {
        "tags": [],
        "summary": "Pin or unpin messages so a sweep leaves them where they are",
        "operationId": "mail_messages_pin",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PinMessagesBody"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "The `MessagesPinned` variant",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ResponseData"
                }
              }
            }
          },
          "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/messages/{message_id}/inline-image": {
      "get": {
        "tags": [],
        "summary": "Bytes of one inline (cid:) image, by its HTML src",
        "operationId": "mail_message_inline_image",
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/mail/messages/{message_id}/kind": {
      "get": {
        "tags": [],
        "summary": "Why a message is where it is: its kind, rule and reason",
        "operationId": "mail_message_kind",
        "parameters": [
          {
            "name": "message_id",
            "in": "path",
            "description": "Message id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The `MessageKind` variant",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ResponseData"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/mail/messages/{message_id}/move": {
      "post": {
        "tags": [],
        "summary": "Move one email to a mode (X), or with sender set the sender's mode (P); To do and Archive add it there (dry_run previews)",
        "operationId": "mail_message_move",
        "parameters": [
          {
            "name": "message_id",
            "in": "path",
            "description": "The email",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/MoveBody"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "The `MessageMoved` variant, with the correction id undo takes",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ResponseData"
                }
              }
            }
          },
          "400": {
            "description": "Unknown mode or bad id"
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/mail/modes/guide": {
      "get": {
        "tags": [],
        "summary": "How a mode explains itself: header, empty states, why template, keys and hints",
        "operationId": "mail_mode_guide",
        "parameters": [
          {
            "name": "mode",
            "in": "query",
            "description": "`todo`; omitted returns every shipped mode",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The `ModeGuides` variant",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ResponseData"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/mail/modes/membership": {
      "get": {
        "tags": [],
        "summary": "Which modes hold one thread and why, named by the thread or one of its messages",
        "operationId": "mail_mode_membership_get",
        "parameters": [
          {
            "name": "thread_id",
            "in": "query",
            "description": "The thread",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "message_id",
            "in": "query",
            "description": "Or one of its messages",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The `ModeMembership` variant",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ResponseData"
                }
              }
            }
          },
          "400": {
            "description": "Neither id given"
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      },
      "post": {
        "tags": [],
        "summary": "Which modes hold each of up to 100 threads, in request order",
        "operationId": "mail_mode_membership_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ModeMembershipBody"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "The `ModeMembership` variant",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ResponseData"
                }
              }
            }
          },
          "400": {
            "description": "No threads, or more than 100"
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/mail/modes/{mode}/done": {
      "post": {
        "tags": [],
        "summary": "Done here: threads, a sender's threads or named to-dos leave one mode, archived only when no other mode holds them (dry_run previews)",
        "operationId": "mail_mode_done",
        "parameters": [
          {
            "name": "mode",
            "in": "path",
            "description": "`messages`, `todo`, `updates` or `reading`",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ModeDoneBody"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "The `ModeDone` variant: one outcome per thread with its handoff copy, and the undo id",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ResponseData"
                }
              }
            }
          },
          "400": {
            "description": "Unknown mode or no threads"
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/mail/moves/{correction_id}/undo": {
      "post": {
        "tags": [],
        "summary": "Put a move back exactly as it was; undoing twice changes nothing",
        "operationId": "mail_move_undo",
        "parameters": [
          {
            "name": "correction_id",
            "in": "path",
            "description": "From the move's outcome",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int64"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The `MoveUndone` variant",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ResponseData"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/mail/mutation-jobs": {
      "post": {
        "tags": [],
        "summary": "Start a mutation as a background job",
        "operationId": "mail_mutation_jobs",
        "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/now": {
      "get": {
        "tags": [],
        "summary": "Now: People, Due soon, one Updates card and an evening Reading pick, at most three items each",
        "operationId": "mail_now",
        "parameters": [
          {
            "name": "account",
            "in": "query",
            "description": "Account id; omitted covers every account",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The `Now` variant",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ResponseData"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/mail/owed": {
      "get": {
        "tags": [],
        "summary": "List threads that owe a reply",
        "operationId": "mail_owed",
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/mail/people": {
      "get": {
        "tags": [],
        "summary": "Messages: conversations needing attention by default; explicit All conversations includes history",
        "operationId": "mail_people",
        "parameters": [
          {
            "name": "account",
            "in": "query",
            "description": "Account id; omitted covers every account",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "turn",
            "in": "query",
            "description": "Omit for Needs attention; `all` includes conversation history; `mine` or `theirs` selects a side's turn",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "unread",
            "in": "query",
            "description": "`true`: only rows with unread mail from them. Counts in the response are unchanged",
            "required": false,
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "pace",
            "in": "query",
            "description": "`true`: only rows where your turn has run past your usual pace. Counts in the response are unchanged",
            "required": false,
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "description": "Rows in Recent and Quiet (default 50); totals count all",
            "required": false,
            "schema": {
              "type": "integer",
              "format": "int32",
              "minimum": 0
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The `Messages` variant",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ResponseData"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/mail/people/ack": {
      "post": {
        "tags": [],
        "summary": "Got it: a short acknowledgement in your usual greeting and sign-off (dry_run previews the exact text)",
        "operationId": "mail_people_ack",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AckBody"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "The `MessagesAck` variant",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ResponseData"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/mail/people/merge": {
      "post": {
        "tags": [],
        "summary": "Merge addresses into one person, by hand (dry_run previews)",
        "operationId": "mail_people_merge",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/MergeBody"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "The `PersonMerge` variant",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ResponseData"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/mail/people/merge-suggestions": {
      "get": {
        "tags": [],
        "summary": "Merges mxr suggests: the same name on addresses you have written to. Never applied on its own",
        "operationId": "mail_people_merge_suggestions",
        "parameters": [
          {
            "name": "account",
            "in": "query",
            "description": "Account id; omitted covers every account",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The `MergeSuggestions` variant",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ResponseData"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/mail/people/page": {
      "get": {
        "tags": [],
        "summary": "A person's page: relationship line, every topic, and the selected topic as new text with trimmed markers",
        "operationId": "mail_people_page",
        "parameters": [
          {
            "name": "person",
            "in": "query",
            "description": "A row id (`person:<email>`, `group:<thread>`) or an address",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "topic",
            "in": "query",
            "description": "Thread id of the conversation to show",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "conversation",
            "in": "query",
            "description": "`false` returns the profile only, with no conversation or message text; default true",
            "required": false,
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "account",
            "in": "query",
            "description": "Account id; omitted searches every account",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The `PersonPage` variant",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ResponseData"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/mail/people/split": {
      "post": {
        "tags": [],
        "summary": "Take an address back out of its person (dry_run previews)",
        "operationId": "mail_people_split",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SplitBody"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "The `PersonMerge` variant",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ResponseData"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/mail/places/{place}": {
      "get": {
        "tags": [],
        "summary": "List a place (Reading or Paper trail) as bundles by sender",
        "operationId": "mail_place_list",
        "parameters": [
          {
            "name": "place",
            "in": "path",
            "description": "`reading` or `paper-trail`",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "account",
            "in": "query",
            "description": "Account id; omitted covers every account",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "sender",
            "in": "query",
            "description": "Only this sender's bundle",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "description": "Bundles per page (default 50)",
            "required": false,
            "schema": {
              "type": "integer",
              "format": "int32",
              "minimum": 0
            }
          },
          {
            "name": "offset",
            "in": "query",
            "description": "Bundles to skip",
            "required": false,
            "schema": {
              "type": "integer",
              "format": "int32",
              "minimum": 0
            }
          },
          {
            "name": "messages_per_bundle",
            "in": "query",
            "description": "Messages listed per bundle (default 20)",
            "required": false,
            "schema": {
              "type": "integer",
              "format": "int32",
              "minimum": 0
            }
          },
          {
            "name": "message_offset",
            "in": "query",
            "description": "Messages to skip in each bundle, for paging one sender",
            "required": false,
            "schema": {
              "type": "integer",
              "format": "int32",
              "minimum": 0
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The `Place` variant",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ResponseData"
                }
              }
            }
          },
          "400": {
            "description": "Unknown place or bad account id"
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/mail/places/{place}/sweep": {
      "post": {
        "tags": [],
        "summary": "Archive everything unpinned in a place or one sender's bundle (dry_run previews)",
        "operationId": "mail_place_sweep",
        "parameters": [
          {
            "name": "place",
            "in": "path",
            "description": "`reading` or `paper-trail`",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SweepPlaceBody"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "The `PlaceSwept` variant: the preview, and the archive job unless dry_run",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ResponseData"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/mail/rail": {
      "get": {
        "tags": [],
        "summary": "The rail: Now, the five modes and Inbox with keys, counts and early-version notes, plus More",
        "operationId": "mail_rail",
        "parameters": [
          {
            "name": "account",
            "in": "query",
            "description": "Account id; omitted covers every account",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The `Rail` variant",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ResponseData"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/mail/reading": {
      "get": {
        "tags": [],
        "summary": "Reading's edition: bands since your last visit, earlier and fading, ranked by what you read, with Later and the sources",
        "operationId": "mail_reading_edition",
        "parameters": [
          {
            "name": "account",
            "in": "query",
            "description": "Account id; omitted covers every account",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "mark_visit",
            "in": "query",
            "description": "Record that Reading was opened",
            "required": false,
            "schema": {
              "type": "boolean"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The `ReadingEdition` variant",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ResponseData"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/mail/reading/engagement": {
      "post": {
        "tags": [],
        "summary": "Local reading engagement (opened, time, progress); not written with MXR_ACTIVITY=off",
        "operationId": "mail_reading_engagement",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ReadingEngagementBody"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "The `ReadingEngagement` variant",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ResponseData"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/mail/reading/highlights": {
      "get": {
        "tags": [],
        "summary": "Every Reading highlight, with the same as one Markdown document",
        "operationId": "mail_reading_highlights_get",
        "parameters": [
          {
            "name": "account",
            "in": "query",
            "description": "Account id; omitted covers every account",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The `ReadingHighlights` variant",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ResponseData"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      },
      "post": {
        "tags": [],
        "summary": "Save a passage from a Reading item, with an optional note",
        "operationId": "mail_reading_highlights_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ReadingHighlightBody"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "The `ReadingHighlight` variant",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ResponseData"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/mail/reading/highlights/{id}/note": {
      "post": {
        "tags": [],
        "summary": "Change a highlight's note; a blank note clears it. Highlights made in Marginalia are refused. The run returns a mutation id for undo",
        "operationId": "mail_reading_highlight_note",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "The highlight's id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ReadingHighlightNoteBody"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "The `ReadingHighlightChanged` variant",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ResponseData"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/mail/reading/highlights/{id}/remove": {
      "post": {
        "tags": [],
        "summary": "Remove a highlight, or with `dry_run` name what it would remove. Highlights made in Marginalia are refused. The run returns a mutation id for undo",
        "operationId": "mail_reading_highlight_remove",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "The highlight's id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "description": "Optional; omitted removes",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ReadingHighlightRemoveBody"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "The `ReadingHighlightChanged` variant",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ResponseData"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/mail/reading/items/{item_key}": {
      "get": {
        "tags": [],
        "summary": "One Reading item for the reader: text, saved article, highlights and minutes left. Never fetches",
        "operationId": "mail_reading_item",
        "parameters": [
          {
            "name": "item_key",
            "in": "path",
            "description": "`<message id>:<index>`, URL-encoded",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The `ReadingItem` variant",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ResponseData"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/mail/reading/items/{item_key}/article": {
      "post": {
        "tags": [],
        "summary": "Fetch and save the article a Reading item links to, contacting its site; private addresses are refused",
        "operationId": "mail_reading_article",
        "parameters": [
          {
            "name": "item_key",
            "in": "path",
            "description": "`<message id>:<index>`, URL-encoded",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ReadingArticleBody"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "The `ReadingArticle` variant",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ResponseData"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/mail/reading/items/{item_key}/marginalia": {
      "post": {
        "tags": [],
        "summary": "Send a Reading item to Marginalia, or find it there if sent before; dry_run contacts nothing",
        "operationId": "mail_reading_marginalia_send",
        "parameters": [
          {
            "name": "item_key",
            "in": "path",
            "description": "`<message id>:<index>`",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/MarginaliaSendBody"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "The `MarginaliaSend` variant",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ResponseData"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/mail/reading/later": {
      "post": {
        "tags": [],
        "summary": "Put Reading items on Later or take them off (dry_run previews)",
        "operationId": "mail_reading_later",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ReadingLaterBody"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "The `ReadingLater` variant",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ResponseData"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/mail/reading/marginalia": {
      "get": {
        "tags": [],
        "summary": "Whether Marginalia is connected, where, and how many items were sent",
        "operationId": "mail_reading_marginalia_get",
        "responses": {
          "200": {
            "description": "The `MarginaliaStatus` variant",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ResponseData"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      },
      "post": {
        "tags": [],
        "summary": "Connect Marginalia with its site and a personal token (checked first), or disconnect with null",
        "operationId": "mail_reading_marginalia_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/MarginaliaConnectionBody"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "The `MarginaliaStatus` variant",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ResponseData"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/mail/reading/marginalia/highlights": {
      "post": {
        "tags": [],
        "summary": "Read back highlights made in Marginalia on one sent item, or every sent item",
        "operationId": "mail_reading_marginalia_sync",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/MarginaliaSyncBody"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "The `MarginaliaSync` variant",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ResponseData"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/mail/reading/sources": {
      "post": {
        "tags": [],
        "summary": "Per-source Reading settings: the sender's own layout, or no more unsubscribe offers",
        "operationId": "mail_reading_sources",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ReadingSourceBody"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "The `ReadingSource` variant",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ResponseData"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/mail/records": {
      "get": {
        "tags": [],
        "summary": "Archive's ledger: records by month with counts, totals, facets and what is coming up",
        "operationId": "mail_records_ledger",
        "parameters": [
          {
            "name": "account",
            "in": "query",
            "description": "Account id; omitted covers every account",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "kind",
            "in": "query",
            "description": "Comma-separated kinds: receipt, order, booking, invoice, statement, ticket, contract, warranty, account",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "issuer",
            "in": "query",
            "description": "One issuer: the issuer page",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "year",
            "in": "query",
            "description": "By the transaction's date",
            "required": false,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "min_amount_minor",
            "in": "query",
            "description": "At least this, in minor units",
            "required": false,
            "schema": {
              "type": "integer",
              "format": "int64"
            }
          },
          {
            "name": "max_amount_minor",
            "in": "query",
            "description": "At most this, in minor units",
            "required": false,
            "schema": {
              "type": "integer",
              "format": "int64"
            }
          },
          {
            "name": "has_pdf",
            "in": "query",
            "description": "With or without a PDF",
            "required": false,
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "checked",
            "in": "query",
            "description": "Every amount and date confirmed, or not",
            "required": false,
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "group",
            "in": "query",
            "description": "One trip or series",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "description": "Rows on this page (default 200)",
            "required": false,
            "schema": {
              "type": "integer",
              "format": "int32",
              "minimum": 0
            }
          },
          {
            "name": "offset",
            "in": "query",
            "description": "Rows to skip",
            "required": false,
            "schema": {
              "type": "integer",
              "format": "int32",
              "minimum": 0
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The `RecordLedger` variant",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ResponseData"
                }
              }
            }
          },
          "400": {
            "description": "Unknown kind"
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/mail/records/answer": {
      "get": {
        "tags": [],
        "summary": "The answer box: the field a query asks for from record fields, with no model; falls back to mxr ask only when no record matches",
        "operationId": "mail_records_answer",
        "parameters": [
          {
            "name": "q",
            "in": "query",
            "description": "What you remember: \"lisbon booking ref\"",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "account",
            "in": "query",
            "description": "Account id; omitted covers every account",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "fallback",
            "in": "query",
            "description": "Fall back to mxr ask over all mail (default true)",
            "required": false,
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "description": "Records in \"also matching\" (default 4)",
            "required": false,
            "schema": {
              "type": "integer",
              "format": "int32",
              "minimum": 0
            }
          },
          {
            "name": "list",
            "in": "query",
            "description": "Every match as a list, whatever the query asks for (default false)",
            "required": false,
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "offset",
            "in": "query",
            "description": "Where a list's page starts (default 0)",
            "required": false,
            "schema": {
              "type": "integer",
              "format": "int32",
              "minimum": 0
            }
          },
          {
            "name": "list_limit",
            "in": "query",
            "description": "Records in a list's page (default 200)",
            "required": false,
            "schema": {
              "type": "integer",
              "format": "int32",
              "minimum": 0
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The `RecordAnswer` variant",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ResponseData"
                }
              }
            }
          },
          "400": {
            "description": "Empty query"
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/mail/records/dismiss": {
      "post": {
        "tags": [],
        "summary": "Not a record, or back again; the email is never touched (dry_run previews)",
        "operationId": "mail_records_dismiss",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RecordDismissBody"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "The `RecordChange` variant",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ResponseData"
                }
              }
            }
          },
          "400": {
            "description": "No record ids"
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/mail/records/export": {
      "post": {
        "tags": [],
        "summary": "Export records as CSV, and PDFs to a folder; dry_run returns the row count, totals, unchecked rows and missing PDFs for the same rows",
        "operationId": "mail_records_export",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RecordExportBody"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "The `RecordExport` variant",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ResponseData"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/mail/records/file": {
      "post": {
        "tags": [],
        "summary": "File an email as a record yourself (dry_run returns the card it would file)",
        "operationId": "mail_records_file",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RecordFileBody"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "The `RecordChange` variant",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ResponseData"
                }
              }
            }
          },
          "400": {
            "description": "Invalid message id"
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/mail/records/sender": {
      "post": {
        "tags": [],
        "summary": "Always or never file a sender's mail (dry_run previews)",
        "operationId": "mail_records_sender",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RecordSenderBody"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "The `RecordChange` variant",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ResponseData"
                }
              }
            }
          },
          "400": {
            "description": "Invalid message id or verdict"
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/mail/records/subscriptions": {
      "get": {
        "tags": [],
        "summary": "Subscriptions: receipts and invoices at a steady cadence, with next charge, yearly cost, price changes, status and totals per currency",
        "operationId": "mail_records_subscriptions",
        "parameters": [
          {
            "name": "account",
            "in": "query",
            "description": "Account id; omitted covers every account",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The `RecordSubscriptions` variant",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ResponseData"
                }
              }
            }
          },
          "400": {
            "description": "Bad account id"
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/mail/records/{record_id}": {
      "get": {
        "tags": [],
        "summary": "One record's card: every field with where it came from, its documents and source emails",
        "operationId": "mail_record_get",
        "parameters": [
          {
            "name": "record_id",
            "in": "path",
            "description": "A full id or a unique prefix",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The `Record` variant",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ResponseData"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/mail/records/{record_id}/field": {
      "post": {
        "tags": [],
        "summary": "Fix, confirm or clear a record field, or mark the card checked (dry_run previews)",
        "operationId": "mail_record_field",
        "parameters": [
          {
            "name": "record_id",
            "in": "path",
            "description": "A full id or a unique prefix",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RecordFieldBody"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "The `RecordChange` variant",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ResponseData"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/mail/recovery/activate": {
      "post": {
        "tags": [],
        "operationId": "recovery_activate",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RecoveryActivateBody"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Activation preview or result; old intentions are never replayed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ResponseData"
                }
              }
            }
          },
          "401": {
            "description": "Bridge authorization required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ArchiveErrorResponse"
                }
              }
            }
          },
          "409": {
            "description": "Workspace or generation changed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ArchiveErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/mail/recovery/prepare-draft": {
      "post": {
        "tags": [],
        "operationId": "recovery_prepare",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RecoveryPrepareBody"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Preview or creation of a new draft while the original remains held",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ResponseData"
                }
              }
            }
          },
          "401": {
            "description": "Bridge authorization required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ArchiveErrorResponse"
                }
              }
            }
          },
          "409": {
            "description": "Workspace, generation, or draft revision changed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ArchiveErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/mail/recovery/status": {
      "get": {
        "tags": [],
        "operationId": "recovery_status",
        "responses": {
          "200": {
            "description": "Persistent restored-profile pause, held drafts and retired intentions",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ResponseData"
                }
              }
            }
          },
          "401": {
            "description": "Bridge authorization required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ArchiveErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Daemon does not support protocol 12 recovery",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ArchiveErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/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/relationships/rebuild": {
      "post": {
        "tags": [],
        "summary": "Rebuild relationship profiles for every contact with recent mail, or count them on a dry run",
        "operationId": "mail_relationships_rebuild",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RebuildRelationshipsRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Contacts and model calls, made or predicted",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RebuildRelationshipsResponse"
                }
              }
            }
          },
          "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/rows/seen": {
      "post": {
        "tags": [],
        "summary": "Mark the opened To do or Updates row revision seen, without completing it",
        "operationId": "mail_row_seen",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RowSeenBody"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Ack",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ResponseData"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/mail/scheduled-sends": {
      "get": {
        "tags": [],
        "summary": "List pending scheduled sends",
        "operationId": "scheduled_sends_list",
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      },
      "post": {
        "tags": [],
        "operationId": "scheduled_sends_create",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ScheduleStoredDraftRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Scheduled draft",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ResponseData"
                }
              }
            }
          },
          "422": {
            "description": "Managed attachments require explicit review"
          }
        }
      }
    },
    "/api/v1/mail/scheduled-sends/{draft_id}": {
      "delete": {
        "tags": [],
        "summary": "Cancel a scheduled send",
        "operationId": "scheduled_sends_cancel",
        "parameters": [
          {
            "name": "draft_id",
            "in": "path",
            "description": "The scheduled draft",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "undo_window",
            "in": "query",
            "description": "The send was held for a client's undo window; kept out of the activity log",
            "required": false,
            "schema": {
              "type": "boolean"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          },
          "400": {
            "description": "The draft id is not valid"
          },
          "401": {
            "description": "Missing or invalid bridge token"
          },
          "404": {
            "description": "No send is waiting for this draft"
          },
          "422": {
            "description": "The send has already started"
          }
        }
      }
    },
    "/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/send-outcomes/{operation_id}": {
      "get": {
        "tags": [],
        "operationId": "mail_send_outcome",
        "parameters": [
          {
            "name": "operation_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "account_id",
            "in": "query",
            "description": "Owning account ID",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Durable send outcome",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ResponseData"
                }
              }
            }
          },
          "401": {
            "description": "Missing bridge token"
          }
        }
      }
    },
    "/api/v1/mail/send-outcomes/{operation_id}/recover": {
      "post": {
        "tags": [],
        "operationId": "mail_recover_send_outcome",
        "parameters": [
          {
            "name": "operation_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "account_id",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RecoverSendBody"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Evidence-bound recovery preview or resumed original operation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ResponseData"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/mail/send-time": {
      "get": {
        "tags": [],
        "summary": "Recommend a send time for recipients",
        "operationId": "mail_send_time",
        "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/senders/kind": {
      "post": {
        "tags": [],
        "summary": "Move a sender to people, Reading, Paper trail or screened out, or back to automatic",
        "operationId": "mail_sender_kind",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SenderKindBody"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "The `SenderKindSet` variant, with the previous kind for undo",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ResponseData"
                }
              }
            }
          },
          "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 default-account sync",
        "operationId": "mail_sync",
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/mail/sync/all": {
      "post": {
        "tags": [],
        "summary": "Trigger global sync",
        "operationId": "mail_sync_all",
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/mail/sync/preview": {
      "post": {
        "tags": [],
        "summary": "Preview accounts selected for global sync",
        "operationId": "mail_sync_preview",
        "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/previews": {
      "post": {
        "tags": [],
        "summary": "Headline facts for up to 100 threads with no bodies: subject, latest sender, date, snippet, counts, attachments",
        "operationId": "mail_thread_previews",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ThreadPreviewsBody"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "The `ThreadPreviews` variant, in request order; unknown ids are left out",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ResponseData"
                }
              }
            }
          },
          "400": {
            "description": "No threads, a malformed thread id, or more than 100"
          },
          "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}/context": {
      "get": {
        "tags": [],
        "summary": "Store facts for the reader's context block",
        "operationId": "mail_thread_context",
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/mail/threads/{thread_id}/context/gist": {
      "get": {
        "tags": [],
        "summary": "Model-written gist and ask for a conversation, cached per newest message",
        "operationId": "mail_thread_gist",
        "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/mail/time/resolve": {
      "get": {
        "tags": [],
        "summary": "Resolve a natural-language time phrase",
        "operationId": "mail_time_resolve",
        "parameters": [
          {
            "name": "input",
            "in": "query",
            "description": "The phrase, such as \"fri 3\" or \"in 2d\"",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "now",
            "in": "query",
            "description": "RFC3339 anchor for relative phrases; defaults to the daemon's clock",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "time_zone",
            "in": "query",
            "description": "IANA zone to resolve in, such as \"Europe/London\"; defaults to the daemon's zone",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The `ResolvedTime` variant: exactly one of `resolution` and `error` is set",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ResponseData"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/mail/todos": {
      "get": {
        "tags": [],
        "summary": "The To do runway: Now, Coming up by week, Later, Whenever and Done this week",
        "operationId": "mail_todos_runway",
        "parameters": [
          {
            "name": "account",
            "in": "query",
            "description": "Account id; omitted covers every account",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "mark_seen",
            "in": "query",
            "description": "Record that To do was opened, so the expired count starts again",
            "required": false,
            "schema": {
              "type": "boolean"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The `TodoRunway` variant",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ResponseData"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      },
      "post": {
        "tags": [],
        "summary": "Make a to-do from a message yourself (dry_run previews)",
        "operationId": "mail_todos_create",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TodoCreateBody"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "The `TodoChange` variant",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ResponseData"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/mail/todos/catchup": {
      "get": {
        "tags": [],
        "summary": "The first run's one-time catch-up, with what was already over",
        "operationId": "mail_todos_catchup_get",
        "parameters": [
          {
            "name": "account",
            "in": "query",
            "description": "Account id; omitted covers every account",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The `TodoCatchup` variant",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ResponseData"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      },
      "post": {
        "tags": [],
        "summary": "Keep or let go in the catch-up; let_go_all takes every row still waiting (dry_run previews)",
        "operationId": "mail_todos_catchup_set",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TodoCatchupBody"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "The `TodoChange` variant",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ResponseData"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/mail/todos/in/{state}": {
      "get": {
        "tags": [],
        "summary": "Every to-do in one state, newest change first; `expired` is the Expired list",
        "operationId": "mail_todos_in_state",
        "parameters": [
          {
            "name": "state",
            "in": "path",
            "description": "`open`, `done`, `dismissed` or `expired`",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "account",
            "in": "query",
            "description": "Account id; omitted covers every account",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "description": "Rows (default 200)",
            "required": false,
            "schema": {
              "type": "integer",
              "format": "int32",
              "minimum": 0
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The `Todos` variant",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ResponseData"
                }
              }
            }
          },
          "400": {
            "description": "Unknown state"
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/mail/todos/microsoft": {
      "get": {
        "tags": [],
        "summary": "Whether the optional ms-todo CLI is installed on the daemon",
        "operationId": "mail_microsoft_todo_status",
        "responses": {
          "200": {
            "description": "The `MicrosoftTodoStatus` variant",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ResponseData"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/mail/todos/microsoft/sync": {
      "post": {
        "tags": [],
        "summary": "Reconcile linked tasks without discarding conflicting edits",
        "operationId": "mail_microsoft_todo_sync",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/MicrosoftTodoSyncBody"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "The `MicrosoftTodoSync` variant",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ResponseData"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/mail/todos/state": {
      "post": {
        "tags": [],
        "summary": "Tick off, reopen or mark to-dos not a to-do (dry_run previews)",
        "operationId": "mail_todos_state",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TodoStateBody"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "The `TodoChange` variant",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ResponseData"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/mail/todos/{todo_id}": {
      "get": {
        "tags": [],
        "summary": "One to-do with where each of its fields came from",
        "operationId": "mail_todo_get",
        "parameters": [
          {
            "name": "todo_id",
            "in": "path",
            "description": "A full id or a unique prefix",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The `Todo` variant",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ResponseData"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/mail/todos/{todo_id}/correct": {
      "post": {
        "tags": [],
        "summary": "Correct ownership, task status or details with safe undo",
        "operationId": "mail_todo_correct",
        "parameters": [
          {
            "name": "todo_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TodoCorrectionBody"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "The `TodoChange` variant",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ResponseData"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/mail/todos/{todo_id}/correction/undo": {
      "post": {
        "tags": [],
        "summary": "Undo a correction unless the row has changed",
        "operationId": "mail_todo_undo_correction",
        "parameters": [
          {
            "name": "todo_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TodoCorrectionUndoBody"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "The `TodoChange` variant",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ResponseData"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/mail/todos/{todo_id}/edit": {
      "post": {
        "tags": [],
        "summary": "Correct a to-do's fields; it is yours from then on (dry_run previews)",
        "operationId": "mail_todo_edit",
        "parameters": [
          {
            "name": "todo_id",
            "in": "path",
            "description": "A full id or a unique prefix",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TodoEditBody"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "The `TodoChange` variant",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ResponseData"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/mail/todos/{todo_id}/microsoft": {
      "post": {
        "tags": [],
        "summary": "Preview or create a two-way Microsoft To Do task link",
        "operationId": "mail_microsoft_todo_link",
        "parameters": [
          {
            "name": "todo_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/MicrosoftTodoLinkBody"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "The `MicrosoftTodoSend` variant",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ResponseData"
                }
              }
            }
          },
          "400": {
            "description": "Preview is stale or ms-todo is unavailable"
          }
        }
      }
    },
    "/api/v1/mail/todos/{todo_id}/resolution": {
      "post": {
        "tags": [],
        "summary": "Review, accept, dismiss or undo a later-email resolution offer",
        "operationId": "mail_todo_resolve",
        "parameters": [
          {
            "name": "todo_id",
            "in": "path",
            "description": "A full id or a unique prefix",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TodoResolutionBody"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "The `TodoChange` variant",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ResponseData"
                }
              }
            }
          },
          "400": {
            "description": "The offer is stale or the requested action is unavailable"
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/mail/todos/{todo_id}/schedule": {
      "post": {
        "tags": [],
        "summary": "Show a to-do on your own date, or clear it (dry_run previews)",
        "operationId": "mail_todo_schedule",
        "parameters": [
          {
            "name": "todo_id",
            "in": "path",
            "description": "A full id or a unique prefix",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TodoScheduleBody"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "The `TodoChange` variant",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ResponseData"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/mail/updates": {
      "get": {
        "tags": [],
        "summary": "The Updates digest: one line per source in Needs a look, Changed and Routine, at the latest cut or a past one, plus what arrived since",
        "operationId": "mail_updates_digest",
        "parameters": [
          {
            "name": "account",
            "in": "query",
            "description": "Account id; omitted covers every account",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "cut",
            "in": "query",
            "description": "A past cut, RFC3339; the latest when omitted",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "mark_seen",
            "in": "query",
            "description": "Record that Updates was opened",
            "required": false,
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "expired",
            "in": "query",
            "description": "List every update past its window",
            "required": false,
            "schema": {
              "type": "boolean"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The `UpdatesDigest` variant",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ResponseData"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/mail/updates/let-go": {
      "post": {
        "tags": [],
        "summary": "Let go of a digest or one of its sources: exactly the cut's updates leave Updates, archived only when no other mode holds them (dry_run previews; selection_token pins the run to the preview)",
        "operationId": "mail_updates_let_go",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdatesLetGoBody"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "The `UpdatesLetGo` variant, with the undo id",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ResponseData"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/mail/updates/sources": {
      "post": {
        "tags": [],
        "summary": "Tune an Updates source: every digest, changes only, muted or breakthrough (dry_run previews)",
        "operationId": "mail_updates_source",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateSourceBody"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "The `UpdateSource` variant, with the prior setting for undo",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ResponseData"
                }
              }
            }
          },
          "400": {
            "description": "No source named"
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/mail/whois": {
      "get": {
        "tags": [],
        "summary": "Explain a person or term from local evidence",
        "operationId": "mail_whois",
        "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 local stores",
        "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/accounts/{key}/identity": {
      "post": {
        "tags": [],
        "summary": "Set an account's colour and tag",
        "operationId": "account_identity",
        "parameters": [
          {
            "name": "key",
            "in": "path",
            "description": "The account's config key, such as `work`",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SetAccountIdentityBody"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "The `AccountOperation` variant. When the daemon refuses a tag (malformed, or held by another account), `result.ok` is false and `result.save.detail` says why; nothing is saved",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ResponseData"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid bridge token"
          },
          "422": {
            "description": "The body doesn't match the shape: a colour outside the eight slots, or a field of the wrong type"
          }
        }
      }
    },
    "/api/v1/platform/analytics/cadence-drift": {
      "get": {
        "tags": [],
        "summary": "Watched contacts past their usual cadence",
        "operationId": "analytics_cadence_drift",
        "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/cadence/unwatch": {
      "post": {
        "tags": [],
        "summary": "Remove a contact from the cadence watchlist",
        "operationId": "cadence_unwatch",
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/platform/cadence/watch": {
      "get": {
        "tags": [],
        "summary": "List the cadence watchlist",
        "operationId": "cadence_watch_list",
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      },
      "post": {
        "tags": [],
        "summary": "Add a contact to the cadence watchlist",
        "operationId": "cadence_watch",
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      }
    },
    "/api/v1/platform/keymap": {
      "get": {
        "tags": [],
        "summary": "Every key in every client, with the person's keys.toml applied (the Keymap variant)",
        "operationId": "platform_keymap_get",
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      },
      "post": {
        "tags": [],
        "summary": "Change keys.toml: an action's keys or the single-key switch; {change: KeysChangeData, dry_run} previews (the KeysUpdate variant)",
        "operationId": "platform_keymap_update",
        "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/notifications/chimes": {
      "get": {
        "tags": [],
        "summary": "Get the notification chime setting",
        "operationId": "notification_chimes_get",
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Missing or invalid bridge token"
          }
        }
      },
      "post": {
        "tags": [],
        "summary": "Change fields of the notification chime setting (the body is a NotificationChimesPatchData)",
        "operationId": "notification_chimes_update",
        "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/categories": {
      "post": {
        "tags": [],
        "summary": "Preview or apply complete category-rule reconciliation",
        "operationId": "rule_categories",
        "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/treatment": {
      "post": {
        "tags": [],
        "summary": "Preview or apply account-scoped sorting",
        "operationId": "rule_treatment",
        "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/unread-counts": {
      "get": {
        "tags": [],
        "summary": "Unread match counts per saved search",
        "operationId": "saved_searches_unread_counts",
        "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": {
      "AcceptedComposeDraft": {
        "type": "object",
        "required": [
          "draft_id",
          "revision"
        ],
        "properties": {
          "draft_id": {
            "$ref": "#/components/schemas/DraftId"
          },
          "revision": {
            "type": "integer",
            "format": "int64"
          }
        }
      },
      "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"
          }
        }
      },
      "AccountColor": {
        "type": "string",
        "description": "One of eight named account colour slots, in assignment order.",
        "enum": [
          "sky",
          "amber",
          "green",
          "yellow",
          "blue",
          "vermilion",
          "purple",
          "slate",
          "unknown"
        ]
      },
      "AccountConfigData": {
        "type": "object",
        "required": [
          "key",
          "name",
          "email",
          "is_default"
        ],
        "properties": {
          "color": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/AccountColor",
                "description": "Config override for the account's colour. `None` keeps the stored\nslot. Upserts that omit it also keep the override already in config."
              },
              {
                "type": "null"
              }
            ]
          },
          "email": {
            "type": "string"
          },
          "enabled": {
            "type": "boolean"
          },
          "is_default": {
            "type": "boolean"
          },
          "key": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "send": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/AccountSendConfigData"
              },
              {
                "type": "null"
              }
            ]
          },
          "sync": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/AccountSyncConfigData"
              },
              {
                "type": "null"
              }
            ]
          },
          "tag": {
            "type": [
              "string",
              "null"
            ],
            "description": "Config override for the account's tag, uppercased by the daemon.\n`None` keeps the override already in config, or the derived tag."
          }
        }
      },
      "AccountEditModeData": {
        "type": "string",
        "enum": [
          "full",
          "runtime_only"
        ]
      },
      "AccountFreshnessData": {
        "type": "object",
        "description": "One account's freshness.",
        "required": [
          "account_id",
          "account_name",
          "label",
          "health"
        ],
        "properties": {
          "account_id": {
            "$ref": "#/components/schemas/AccountId"
          },
          "account_name": {
            "type": "string"
          },
          "health": {
            "$ref": "#/components/schemas/SyncHealthData",
            "description": "As of `generated_at`. A client ticking forward turns `ok` into\n`stale` itself (`effective_health`)."
          },
          "label": {
            "type": "string",
            "description": "Actual account identity used in status copy, normally its email\naddress; never a provider-wide label such as \"Gmail\"."
          },
          "last_sync_attempt_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "last_sync_error": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/SyncErrorData"
              },
              {
                "type": "null"
              }
            ]
          },
          "last_sync_ok_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "newest_message_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "The newest message received in any mailbox, whatever its mode."
          },
          "sync_in_progress": {
            "type": "boolean"
          }
        }
      },
      "AccountId": {
        "type": "string",
        "format": "uuid"
      },
      "AccountIdentityData": {
        "type": "object",
        "description": "An account's resolved colour and tag, as the daemon shows them (blueprint 33).",
        "required": [
          "color",
          "tag"
        ],
        "properties": {
          "color": {
            "$ref": "#/components/schemas/AccountColor"
          },
          "tag": {
            "type": "string"
          }
        }
      },
      "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": [
              {
                "$ref": "#/components/schemas/AccountOperationStep"
              },
              {
                "type": "null"
              }
            ]
          },
          "device_code_url": {
            "type": [
              "string",
              "null"
            ]
          },
          "device_code_user_code": {
            "type": [
              "string",
              "null"
            ]
          },
          "ok": {
            "type": "boolean"
          },
          "save": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/AccountOperationStep"
              },
              {
                "type": "null"
              }
            ]
          },
          "saved": {
            "type": "boolean",
            "description": "True when the config change was written to disk even though `ok` is\nfalse, because a later phase (runtime reload, cached mail) failed. The\nchange is saved but not fully applied."
          },
          "send": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/AccountOperationStep"
              },
              {
                "type": "null"
              }
            ]
          },
          "summary": {
            "type": "string"
          },
          "sync": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/AccountOperationStep"
              },
              {
                "type": "null"
              }
            ]
          },
          "tls_cert_sha256": {
            "type": [
              "string",
              "null"
            ],
            "description": "SHA-256 of the IMAP server's leaf certificate, reported by an account\ntest so it can be copied into `tls_cert_sha256`. Absent for plaintext\naccounts and non-IMAP accounts."
          }
        }
      },
      "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"
          },
          "identity": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/AccountIdentityData",
                "description": "Absent from daemons older than blueprint 33, so clients draw no mark."
              },
              {
                "type": "null"
              }
            ]
          },
          "is_default": {
            "type": "boolean"
          },
          "key": {
            "type": [
              "string",
              "null"
            ]
          },
          "name": {
            "type": "string"
          },
          "provider_kind": {
            "type": "string"
          },
          "send": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/AccountSendConfigData"
              },
              {
                "type": "null"
              }
            ]
          },
          "send_kind": {
            "type": [
              "string",
              "null"
            ]
          },
          "source": {
            "$ref": "#/components/schemas/AccountSourceData"
          },
          "sync": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/AccountSyncConfigData"
              },
              {
                "type": "null"
              }
            ]
          },
          "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"
              },
              "max_connections": {
                "type": "integer",
                "minimum": 0
              },
              "password": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "password_ref": {
                "type": "string"
              },
              "port": {
                "type": "integer",
                "format": "int32",
                "minimum": 0
              },
              "tls_cert_sha256": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "Hex SHA-256 of the server's leaf certificate; see the config reference."
              },
              "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"
                ]
              }
            }
          }
        ]
      },
      "AccountSyncHistory": {
        "type": "object",
        "description": "Recent `sync_log` history for one account, as `mxr doctor` reports it.",
        "required": [
          "account_id",
          "account_name",
          "recent_syncs",
          "failed_syncs",
          "unfinished_syncs",
          "finished_syncs",
          "recurring_errors"
        ],
        "properties": {
          "account_id": {
            "$ref": "#/components/schemas/AccountId"
          },
          "account_name": {
            "type": "string"
          },
          "failed_syncs": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "finished_syncs": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "latest_duration_secs": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64",
            "minimum": 0
          },
          "median_duration_secs": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64",
            "description": "Whole seconds, since `sync_log` timestamps are stored at second\nresolution.",
            "minimum": 0
          },
          "recent_syncs": {
            "type": "integer",
            "format": "int32",
            "description": "Rows read for this account, newest first.",
            "minimum": 0
          },
          "recurring_errors": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RecurringSyncError"
            }
          },
          "slowest_duration_secs": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64",
            "minimum": 0
          },
          "trend": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/SyncDurationTrend",
                "description": "`None` when either comparison window has fewer than five finished syncs."
              },
              {
                "type": "null"
              }
            ]
          },
          "unfinished_syncs": {
            "type": "integer",
            "format": "int32",
            "description": "Rows without `finished_at`: still running, or abandoned mid-run. They\nnever contribute to the duration fields.",
            "minimum": 0
          }
        }
      },
      "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
          },
          "progress": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/SyncProgressData",
                "description": "Live progress of the pass currently running, when one is. Held in\ndaemon memory rather than the status row: it changes far too often to\nbe worth a write per step, and it means nothing once the daemon that\nreported it is gone."
              },
              {
                "type": "null"
              }
            ]
          },
          "sync_in_progress": {
            "type": "boolean"
          }
        }
      },
      "AckBody": {
        "type": "object",
        "description": "Body of `POST /api/v1/mail/people/ack`.",
        "required": [
          "thread_id"
        ],
        "properties": {
          "dry_run": {
            "type": "boolean",
            "description": "True by default: a preview of the exact plan with its token. Only an\nexplicit `false`, with the preview's token and text, sends."
          },
          "expect_text": {
            "type": [
              "string",
              "null"
            ],
            "description": "The previewed text: the send refuses anything else."
          },
          "preview_token": {
            "type": [
              "string",
              "null"
            ],
            "description": "The preview's token, issued within the last minute."
          },
          "thread_id": {
            "type": "string"
          }
        }
      },
      "AckPlanData": {
        "type": "object",
        "description": "Returned by `Request::AckMessage`: the exact acknowledgement Got it\nsends, built from how you write to them (no model).",
        "required": [
          "account_id",
          "thread_id",
          "reply_to_message_id",
          "from",
          "to",
          "subject",
          "text",
          "html",
          "built_from",
          "countdown_seconds",
          "dry_run"
        ],
        "properties": {
          "account_id": {
            "$ref": "#/components/schemas/AccountId"
          },
          "built_from": {
            "type": "string",
            "description": "\"Your usual greeting and sign-off with Samir.\" or \"No greeting or\nsign-off of yours to go on, so a plain thanks.\""
          },
          "countdown_seconds": {
            "type": "integer",
            "format": "int32",
            "description": "Clients show the text this long before sending, with undo.",
            "minimum": 0
          },
          "dry_run": {
            "type": "boolean"
          },
          "from": {
            "type": "string",
            "description": "The address it is sent from."
          },
          "html": {
            "type": "string",
            "description": "The exact HTML part that is sent, built from `text` by the same\nbuilder: every value is escaped, so nothing in a name or greeting\nbecomes a link or markup."
          },
          "preview_expires_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "preview_token": {
            "type": [
              "string",
              "null"
            ],
            "description": "Set on a preview: send with it, and `text`, within a minute. It binds\nthe recipient, sender, target message and text."
          },
          "reply_to_message_id": {
            "$ref": "#/components/schemas/MessageId",
            "description": "The message being acknowledged: their latest."
          },
          "sent_message_id": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/MessageId",
                "description": "Set once sent."
              },
              {
                "type": "null"
              }
            ]
          },
          "subject": {
            "type": "string"
          },
          "text": {
            "type": "string",
            "description": "The exact text that is sent, as its plain-text part."
          },
          "thread_id": {
            "$ref": "#/components/schemas/ThreadId"
          },
          "to": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Address"
            },
            "description": "Exactly one recipient: Got it never replies to all."
          }
        }
      },
      "Act": {
        "type": "string",
        "enum": [
          "request",
          "commitment",
          "obligation",
          "offer",
          "question",
          "information",
          "pleasantry"
        ]
      },
      "ActionKind": {
        "type": "string",
        "enum": [
          "pay",
          "fix_payment",
          "sign",
          "verify",
          "reply",
          "send",
          "provide",
          "upload",
          "book",
          "attend",
          "renew_or_cancel",
          "register",
          "contact",
          "other"
        ]
      },
      "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"
        ]
      },
      "Actor": {
        "type": "string",
        "enum": [
          "owner",
          "correspondent",
          "third_party",
          "everyone",
          "nobody"
        ]
      },
      "Address": {
        "type": "object",
        "required": [
          "email"
        ],
        "properties": {
          "email": {
            "type": "string"
          },
          "name": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "AiLocalityData": {
        "type": "string",
        "enum": [
          "local",
          "cloud"
        ]
      },
      "AiProvenanceData": {
        "type": "object",
        "description": "Where model-written text came from, so every client can say so.",
        "required": [
          "model",
          "locality",
          "sources"
        ],
        "properties": {
          "locality": {
            "$ref": "#/components/schemas/AiLocalityData"
          },
          "model": {
            "type": "string"
          },
          "sources": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AiSourceData"
            },
            "description": "What the prompt carried, in order."
          }
        }
      },
      "AiSourceData": {
        "type": "string",
        "enum": [
          "this_thread",
          "relationship_history",
          "your_message"
        ]
      },
      "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": [
              {
                "$ref": "#/components/schemas/AccountId"
              },
              {
                "type": "null"
              }
            ]
          },
          "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"
          }
        }
      },
      "ArchiveErrorResponse": {
        "type": "object",
        "required": [
          "error",
          "code"
        ],
        "properties": {
          "code": {
            "type": "string"
          },
          "details": {},
          "error": {
            "type": "string"
          }
        }
      },
      "ArchiveIdentityData": {
        "type": "object",
        "required": [
          "operation_id",
          "caller_id",
          "workspace"
        ],
        "properties": {
          "caller_id": {
            "type": "string"
          },
          "operation_id": {
            "type": "string"
          },
          "workspace": {
            "$ref": "#/components/schemas/ArchiveWorkspaceData"
          }
        }
      },
      "ArchiveItemData": {
        "type": "object",
        "required": [
          "message_id",
          "account_id",
          "provider_id",
          "was_inbox",
          "prior_flags_bits",
          "prior_label_provider_ids",
          "state"
        ],
        "properties": {
          "account_id": {
            "$ref": "#/components/schemas/AccountId"
          },
          "message_id": {
            "$ref": "#/components/schemas/MessageId"
          },
          "prior_flags_bits": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "prior_label_provider_ids": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "provider_id": {
            "type": "string"
          },
          "reason": {
            "type": [
              "string",
              "null"
            ]
          },
          "state": {
            "$ref": "#/components/schemas/ArchiveItemStateData"
          },
          "was_inbox": {
            "type": "boolean"
          }
        }
      },
      "ArchiveItemStateData": {
        "type": "string",
        "enum": [
          "pending",
          "unknown",
          "provider_succeeded",
          "completed",
          "not_executed"
        ]
      },
      "ArchiveOperationData": {
        "type": "object",
        "required": [
          "identity",
          "review_id",
          "mutation_id",
          "accepted",
          "started_at",
          "items"
        ],
        "properties": {
          "accepted": {
            "type": "boolean"
          },
          "identity": {
            "$ref": "#/components/schemas/ArchiveIdentityData"
          },
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ArchiveItemData"
            }
          },
          "mutation_id": {
            "type": "string"
          },
          "review_id": {
            "type": "string"
          },
          "running": {
            "type": "boolean"
          },
          "started_at": {
            "type": "integer",
            "format": "int64"
          },
          "undo_available": {
            "type": "boolean"
          }
        }
      },
      "ArchivePreviewBody": {
        "type": "object",
        "required": [
          "identity",
          "mutation"
        ],
        "properties": {
          "identity": {
            "$ref": "#/components/schemas/ArchiveIdentityData"
          },
          "mutation": {
            "$ref": "#/components/schemas/MutationCommand"
          }
        }
      },
      "ArchiveQueryBody": {
        "type": "object",
        "required": [
          "identity"
        ],
        "properties": {
          "identity": {
            "$ref": "#/components/schemas/ArchiveIdentityData"
          }
        }
      },
      "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"
          }
        }
      },
      "ArchiveSubmitBody": {
        "type": "object",
        "required": [
          "identity",
          "review_id",
          "mutation"
        ],
        "properties": {
          "identity": {
            "$ref": "#/components/schemas/ArchiveIdentityData"
          },
          "mutation": {
            "$ref": "#/components/schemas/MutationCommand"
          },
          "review_id": {
            "type": "string"
          }
        }
      },
      "ArchiveWorkspaceData": {
        "type": "object",
        "required": [
          "workspace_id",
          "recovery_generation"
        ],
        "properties": {
          "recovery_generation": {
            "type": "string"
          },
          "workspace_id": {
            "type": "string"
          }
        }
      },
      "ArrivalBucketData": {
        "type": "string",
        "description": "Where an arrival is counted: a mode, or one of the buckets that make\nthe counts sum.",
        "enum": [
          "messages",
          "todo",
          "updates",
          "reading",
          "archive",
          "screened_out",
          "spam",
          "trash",
          "sorting"
        ]
      },
      "ArrivalCountData": {
        "type": "object",
        "description": "One count on the line, and what opening it lists.",
        "required": [
          "bucket",
          "count",
          "label"
        ],
        "properties": {
          "bucket": {
            "$ref": "#/components/schemas/ArrivalBucketData"
          },
          "count": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "label": {
            "type": "string",
            "description": "\"8 Messages\"."
          }
        }
      },
      "ArrivalData": {
        "type": "object",
        "description": "One message that arrived, with the modes its conversation went to.",
        "required": [
          "account_id",
          "message_id",
          "thread_id",
          "from",
          "subject",
          "received_at",
          "in_inbox",
          "modes"
        ],
        "properties": {
          "account_id": {
            "$ref": "#/components/schemas/AccountId"
          },
          "from": {
            "$ref": "#/components/schemas/Address"
          },
          "in_inbox": {
            "type": "boolean",
            "description": "The message is in the provider's inbox."
          },
          "message_id": {
            "$ref": "#/components/schemas/MessageId"
          },
          "modes": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ModeMembershipData"
            },
            "description": "The mode its sender's rule sent it to (the sender decision, list\nheaders, the address), with its one-word `tag`. Empty when it\narrived out of the inbox or from someone screened out."
          },
          "received_at": {
            "type": "string",
            "format": "date-time"
          },
          "subject": {
            "type": "string"
          },
          "thread_id": {
            "$ref": "#/components/schemas/ThreadId"
          }
        }
      },
      "ArrivalItemData": {
        "type": "object",
        "description": "One email in an arrivals list.",
        "required": [
          "account_id",
          "message_id",
          "thread_id",
          "sender_email",
          "subject",
          "date",
          "first_seen_at",
          "arrived_in",
          "bucket",
          "chip"
        ],
        "properties": {
          "account_id": {
            "$ref": "#/components/schemas/AccountId"
          },
          "also_archive": {
            "type": "boolean"
          },
          "also_todo": {
            "type": "boolean"
          },
          "arrived_in": {
            "$ref": "#/components/schemas/ArrivalBucketData",
            "description": "Where it went when it arrived."
          },
          "bucket": {
            "$ref": "#/components/schemas/ArrivalBucketData",
            "description": "Where it is now, after any correction."
          },
          "chip": {
            "type": "string",
            "description": "The chip: \"→ Updates · automated sender\"."
          },
          "date": {
            "type": "string",
            "format": "date-time"
          },
          "first_seen_at": {
            "type": "string",
            "format": "date-time"
          },
          "message_id": {
            "$ref": "#/components/schemas/MessageId"
          },
          "moved": {
            "type": "boolean",
            "description": "Moved by you, this email only."
          },
          "not_sure": {
            "type": "boolean"
          },
          "reason": {
            "type": [
              "string",
              "null"
            ],
            "description": "\"has List-Unsubscribe\"."
          },
          "sender_email": {
            "type": "string"
          },
          "sender_name": {
            "type": [
              "string",
              "null"
            ]
          },
          "subject": {
            "type": "string"
          },
          "thread_id": {
            "$ref": "#/components/schemas/ThreadId"
          },
          "unread": {
            "type": "boolean"
          }
        }
      },
      "ArrivalListData": {
        "type": "object",
        "description": "Returned by `Request::ListArrivals`.",
        "required": [
          "since",
          "until",
          "total",
          "items"
        ],
        "properties": {
          "bucket": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/ArrivalBucketData"
              },
              {
                "type": "null"
              }
            ]
          },
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ArrivalItemData"
            }
          },
          "since": {
            "type": "string",
            "format": "date-time"
          },
          "total": {
            "type": "integer",
            "format": "int32",
            "description": "How many match in all; `items` is the newest page.",
            "minimum": 0
          },
          "until": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "ArrivalModesBody": {
        "type": "object",
        "description": "Body of `POST /api/v1/mail/arrivals/modes`.",
        "required": [
          "message_ids"
        ],
        "properties": {
          "message_ids": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "At most 200, answered in this order."
          }
        }
      },
      "ArrivalsData": {
        "type": "object",
        "description": "Returned by `Request::GetArrivals`: the line on Now.",
        "required": [
          "generated_at",
          "since",
          "until",
          "since_label",
          "total",
          "counts",
          "line",
          "never_bury"
        ],
        "properties": {
          "also": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ArrivalCountData"
            },
            "description": "To do and Archive, shown as \"also\" and never added."
          },
          "classification_report": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/ClassifyReportData",
                "description": "Bounded stored fallback clusters, in the existing sorting disclosure."
              },
              {
                "type": "null"
              }
            ]
          },
          "clear_line": {
            "type": [
              "string",
              "null"
            ],
            "description": "When nothing on Now waits: \"Clear. All 50 emails since 08:12 are\naccounted for.\" Absent when nothing arrived."
          },
          "counts": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ArrivalCountData"
            },
            "description": "Non-zero counts in the line's order. They sum to `total`."
          },
          "generated_at": {
            "type": "string",
            "format": "date-time"
          },
          "latest_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "line": {
            "type": "string",
            "description": "\"Since 08:12: 50 arrived. 8 Messages · 10 Updates · 31 Reading · 1\nspam. Also 2 in To do.\" or \"Nothing new since 08:12. Latest mail 2h\nago.\""
          },
          "never_bury": {
            "type": "string",
            "description": "The never-bury rules that are live, for the line's `?`."
          },
          "not_sure": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/NotSureData"
            },
            "description": "At most three a day."
          },
          "not_sure_hint": {
            "type": [
              "string",
              "null"
            ],
            "description": "The hint the first Not-sure item carries until the user has seen it."
          },
          "not_sure_line": {
            "type": [
              "string",
              "null"
            ],
            "description": "\"2 emails I wasn't sure about. Where should these go?\""
          },
          "since": {
            "type": "string",
            "format": "date-time",
            "description": "The window: since Now was last opened, at most 24 hours back; the\nstart of today when Now was never opened."
          },
          "since_label": {
            "type": "string",
            "description": "\"08:12\", or \"Tue 22:10\" for an earlier day."
          },
          "total": {
            "type": "integer",
            "format": "int32",
            "description": "Every inbound email first seen in the window, each counted once.",
            "minimum": 0
          },
          "track_record": {
            "type": [
              "string",
              "null"
            ],
            "description": "\"Last week mxr sorted 310 emails; you moved 2.\" Only once a move\nexists."
          },
          "until": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "AskAmount": {
        "type": "object",
        "required": [
          "zone",
          "span",
          "minor",
          "currency"
        ],
        "properties": {
          "currency": {
            "type": "string"
          },
          "minor": {
            "type": "integer",
            "format": "int64"
          },
          "span": {
            "$ref": "#/components/schemas/AskSpan"
          },
          "zone": {
            "type": "integer",
            "minimum": 0
          }
        }
      },
      "AskAnswer": {
        "type": "string",
        "enum": [
          "asks_you",
          "asks_you_to_reply",
          "you_promised",
          "you_asked_them",
          "they_promised_you",
          "nothing",
          "not_sure"
        ]
      },
      "AskDate": {
        "type": "object",
        "required": [
          "zone",
          "span",
          "at",
          "checked"
        ],
        "properties": {
          "at": {
            "type": "string",
            "format": "date-time"
          },
          "checked": {
            "type": "boolean"
          },
          "span": {
            "$ref": "#/components/schemas/AskSpan"
          },
          "zone": {
            "type": "integer",
            "minimum": 0
          }
        }
      },
      "AskReference": {
        "type": "object",
        "required": [
          "zone",
          "span",
          "kind",
          "value"
        ],
        "properties": {
          "kind": {
            "type": "string"
          },
          "span": {
            "$ref": "#/components/schemas/AskSpan"
          },
          "value": {
            "type": "string"
          },
          "zone": {
            "type": "integer",
            "minimum": 0
          }
        }
      },
      "AskSpan": {
        "type": "object",
        "description": "UTF-8 byte offsets into the unmodified zone text; end is exclusive.",
        "required": [
          "start",
          "end"
        ],
        "properties": {
          "end": {
            "type": "integer",
            "minimum": 0
          },
          "start": {
            "type": "integer",
            "minimum": 0
          }
        }
      },
      "AskState": {
        "type": "string",
        "enum": [
          "pending",
          "done",
          "failed",
          "cancelled",
          "conditional",
          "hypothetical"
        ]
      },
      "AskSummary": {
        "type": "object",
        "description": "Bounded mode projection of the persisted answer. Full zones stay in the\nlocal assessment; the message, zone and byte span identify the evidence.",
        "required": [
          "message_id",
          "policy_version",
          "input_fingerprint",
          "pending_body",
          "units",
          "more_units"
        ],
        "properties": {
          "input_fingerprint": {
            "type": "string"
          },
          "message_id": {
            "$ref": "#/components/schemas/MessageId"
          },
          "more_units": {
            "type": "boolean"
          },
          "pending_body": {
            "type": "boolean"
          },
          "policy_version": {
            "type": "string"
          },
          "units": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AskUnitSummary"
            }
          }
        }
      },
      "AskTags": {
        "type": "object",
        "required": [
          "act",
          "actor",
          "state",
          "action"
        ],
        "properties": {
          "act": {
            "$ref": "#/components/schemas/Act"
          },
          "action": {
            "$ref": "#/components/schemas/ActionKind"
          },
          "actor": {
            "$ref": "#/components/schemas/Actor"
          },
          "amount": {
            "type": [
              "integer",
              "null"
            ],
            "minimum": 0
          },
          "due": {
            "type": [
              "integer",
              "null"
            ],
            "minimum": 0
          },
          "reference": {
            "type": [
              "integer",
              "null"
            ],
            "minimum": 0
          },
          "state": {
            "$ref": "#/components/schemas/AskState"
          }
        }
      },
      "AskUnitSummary": {
        "type": "object",
        "required": [
          "unit",
          "zone",
          "span",
          "answer"
        ],
        "properties": {
          "amount": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/AskAmount"
              },
              {
                "type": "null"
              }
            ]
          },
          "answer": {
            "$ref": "#/components/schemas/AskAnswer"
          },
          "author": {
            "type": [
              "string",
              "null"
            ]
          },
          "due": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/AskDate"
              },
              {
                "type": "null"
              }
            ]
          },
          "quote": {
            "type": [
              "string",
              "null"
            ],
            "description": "Exact source text, or absent when too long for a mode response."
          },
          "reference": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/AskReference"
              },
              {
                "type": "null"
              }
            ]
          },
          "span": {
            "$ref": "#/components/schemas/AskSpan"
          },
          "tags": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/AskTags"
              },
              {
                "type": "null"
              }
            ]
          },
          "unit": {
            "type": "integer",
            "minimum": 0
          },
          "zone": {
            "type": "integer",
            "minimum": 0
          }
        }
      },
      "AssessmentClaim": {
        "type": "object",
        "required": [
          "rule",
          "reason",
          "source",
          "evidence"
        ],
        "properties": {
          "evidence": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "reason": {
            "type": "string"
          },
          "rule": {
            "type": "string"
          },
          "source": {
            "type": "string"
          }
        }
      },
      "AssessmentFacts": {
        "type": "object",
        "description": "Canonical observations useful for finding missing classifier distinctions.",
        "required": [
          "sender_shape",
          "has_list_id",
          "has_unsubscribe",
          "auto_generated",
          "bulk",
          "templated_sender",
          "written_to",
          "body_cached",
          "recipients",
          "addressed"
        ],
        "properties": {
          "addressed": {
            "type": "boolean"
          },
          "auto_generated": {
            "type": "boolean"
          },
          "body_cached": {
            "type": "boolean"
          },
          "bulk": {
            "type": "boolean"
          },
          "has_list_id": {
            "type": "boolean"
          },
          "has_unsubscribe": {
            "type": "boolean"
          },
          "recipients": {
            "type": "integer",
            "minimum": 0
          },
          "sender_shape": {
            "type": "string"
          },
          "templated_sender": {
            "type": "boolean"
          },
          "written_to": {
            "type": "boolean"
          }
        }
      },
      "AssistActionData": {
        "type": "string",
        "description": "What the writing help does with the text. A request without one lets the\ndaemon choose from what is typed.",
        "enum": [
          "write",
          "finish",
          "polish",
          "edit_selection"
        ]
      },
      "AssistAdjustData": {
        "type": "object",
        "description": "One-line adjustments the user ticked, each a single instruction to the model.",
        "properties": {
          "more_formal": {
            "type": "boolean"
          },
          "proofread": {
            "type": "boolean"
          },
          "shorter": {
            "type": "boolean"
          },
          "warmer": {
            "type": "boolean"
          }
        }
      },
      "AssistantAnswerData": {
        "type": "object",
        "properties": {
          "other": {
            "type": [
              "string",
              "null"
            ]
          },
          "selected": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "AssistantAutoApproveBody": {
        "type": "object",
        "description": "Body of `POST /api/v1/mail/assistant/conversations/{id}/auto-approve`.",
        "required": [
          "enabled"
        ],
        "properties": {
          "enabled": {
            "type": "boolean"
          }
        }
      },
      "AssistantAvailabilityData": {
        "type": "object",
        "description": "Whether the assistant can run, and on what.",
        "required": [
          "available",
          "leaves_machine"
        ],
        "properties": {
          "available": {
            "type": "boolean"
          },
          "leaves_machine": {
            "type": "boolean",
            "description": "True when conversations go to a model off this machine."
          },
          "model": {
            "type": [
              "string",
              "null"
            ]
          },
          "reason": {
            "type": [
              "string",
              "null"
            ],
            "description": "Why it can't run, in words for the user."
          }
        }
      },
      "AssistantCallStateData": {
        "type": "string",
        "enum": [
          "running",
          "done",
          "failed",
          "waiting",
          "approved",
          "auto_approved",
          "declined",
          "answered",
          "cancelled",
          "interrupted"
        ]
      },
      "AssistantConversationData": {
        "type": "object",
        "required": [
          "id",
          "title",
          "status",
          "created_at",
          "updated_at",
          "items",
          "pending"
        ],
        "properties": {
          "auto_approve": {
            "type": "boolean",
            "description": "Reversible changes (archive, move, star, read, Reading later,\ncategories, to-do state) run without asking. Sending, deleting, trash, spam and rules always ask. Set\nonly by the user (`SetAssistantAutoApprove`)."
          },
          "created_at": {
            "type": "integer",
            "format": "int64"
          },
          "id": {
            "type": "string"
          },
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AssistantItemData"
            }
          },
          "last_error": {
            "type": [
              "string",
              "null"
            ],
            "description": "Why the last turn failed, in a sentence for the user with what to do\nnext. Older daemons send the raw error here."
          },
          "last_error_detail": {
            "type": [
              "string",
              "null"
            ],
            "description": "The raw error behind `last_error`, when the daemon reworded it."
          },
          "last_outcome": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/AssistantOutcomeData"
              },
              {
                "type": "null"
              }
            ]
          },
          "pending": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AssistantPendingData"
            }
          },
          "status": {
            "$ref": "#/components/schemas/AssistantStatusData"
          },
          "title": {
            "type": "string"
          },
          "updated_at": {
            "type": "integer",
            "format": "int64"
          }
        }
      },
      "AssistantConversationSummaryData": {
        "type": "object",
        "required": [
          "id",
          "title",
          "status",
          "created_at",
          "updated_at",
          "message_count",
          "pending_count"
        ],
        "properties": {
          "created_at": {
            "type": "integer",
            "format": "int64",
            "description": "Unix seconds."
          },
          "id": {
            "type": "string"
          },
          "last_outcome": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/AssistantOutcomeData"
              },
              {
                "type": "null"
              }
            ]
          },
          "message_count": {
            "type": "integer",
            "format": "int64"
          },
          "pending_count": {
            "type": "integer",
            "minimum": 0
          },
          "status": {
            "$ref": "#/components/schemas/AssistantStatusData"
          },
          "title": {
            "type": "string"
          },
          "updated_at": {
            "type": "integer",
            "format": "int64"
          }
        }
      },
      "AssistantDecideBody": {
        "type": "object",
        "description": "Body of `POST /api/v1/mail/assistant/conversations/{id}/decide`.",
        "required": [
          "decisions"
        ],
        "properties": {
          "decisions": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AssistantDecisionData"
            }
          }
        }
      },
      "AssistantDecisionData": {
        "allOf": [
          {
            "$ref": "#/components/schemas/AssistantDecisionKindData"
          },
          {
            "type": "object",
            "required": [
              "call_id"
            ],
            "properties": {
              "call_id": {
                "type": "string"
              }
            }
          }
        ],
        "description": "The user's answer to one waiting call."
      },
      "AssistantDecisionKindData": {
        "oneOf": [
          {
            "type": "object",
            "required": [
              "decision"
            ],
            "properties": {
              "decision": {
                "type": "string",
                "enum": [
                  "approve"
                ]
              }
            }
          },
          {
            "type": "object",
            "required": [
              "decision"
            ],
            "properties": {
              "decision": {
                "type": "string",
                "enum": [
                  "reject"
                ]
              },
              "reason": {
                "type": [
                  "string",
                  "null"
                ]
              }
            }
          },
          {
            "type": "object",
            "description": "One answer per question, in order.",
            "required": [
              "answers",
              "decision"
            ],
            "properties": {
              "answers": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/AssistantAnswerData"
                }
              },
              "decision": {
                "type": "string",
                "enum": [
                  "answer"
                ]
              }
            }
          }
        ]
      },
      "AssistantDeleteBody": {
        "type": "object",
        "description": "Body of `POST /api/v1/mail/assistant/conversations/{id}/delete`.",
        "properties": {
          "dry_run": {
            "type": "boolean",
            "description": "Say what would be deleted, without deleting it."
          }
        }
      },
      "AssistantDeleteData": {
        "type": "object",
        "required": [
          "conversation_id",
          "title",
          "message_count",
          "dry_run",
          "deleted"
        ],
        "properties": {
          "conversation_id": {
            "type": "string"
          },
          "deleted": {
            "type": "boolean"
          },
          "dry_run": {
            "type": "boolean"
          },
          "message_count": {
            "type": "integer",
            "format": "int64"
          },
          "title": {
            "type": "string"
          }
        }
      },
      "AssistantItemData": {
        "oneOf": [
          {
            "type": "object",
            "required": [
              "seq",
              "text",
              "created_at",
              "kind"
            ],
            "properties": {
              "created_at": {
                "type": "integer",
                "format": "int64"
              },
              "kind": {
                "type": "string",
                "enum": [
                  "user"
                ]
              },
              "seq": {
                "type": "integer",
                "format": "int64"
              },
              "text": {
                "type": "string"
              }
            }
          },
          {
            "type": "object",
            "required": [
              "seq",
              "text",
              "created_at",
              "kind"
            ],
            "properties": {
              "created_at": {
                "type": "integer",
                "format": "int64"
              },
              "failed_call_ids": {
                "type": "array",
                "items": {
                  "type": "string"
                },
                "description": "The steps right before this reply that failed and weren't redone\nafter: a small model can say it did what these didn't, so\nclients name them under the reply."
              },
              "kind": {
                "type": "string",
                "enum": [
                  "assistant"
                ]
              },
              "leaves_machine": {
                "type": [
                  "boolean",
                  "null"
                ],
                "description": "Whether the model that wrote this reply runs off this machine,\nas it was when it wrote it. Absent for replies from before the\ndaemon recorded it."
              },
              "model": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "rows": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/AssistantReadoutRowData"
                },
                "description": "When the reply links two or more emails or people that one step\nlisted, those rows, in the order the reply names them (at most\n8), for clients to draw as a list under the sentence that\nintroduces them. Empty otherwise."
              },
              "seq": {
                "type": "integer",
                "format": "int64"
              },
              "text": {
                "type": "string"
              }
            }
          },
          {
            "type": "object",
            "description": "Earlier messages were summarised to fit the model's context window.\nEverything before this point reaches the model only as `text`.",
            "required": [
              "seq",
              "text",
              "created_at",
              "kind"
            ],
            "properties": {
              "created_at": {
                "type": "integer",
                "format": "int64"
              },
              "kind": {
                "type": "string",
                "enum": [
                  "summary"
                ]
              },
              "seq": {
                "type": "integer",
                "format": "int64"
              },
              "text": {
                "type": "string"
              }
            }
          },
          {
            "type": "object",
            "required": [
              "seq",
              "call_id",
              "tool",
              "reason",
              "arguments",
              "state",
              "created_at",
              "kind"
            ],
            "properties": {
              "arguments": {},
              "call_id": {
                "type": "string"
              },
              "created_at": {
                "type": "integer",
                "format": "int64"
              },
              "kind": {
                "type": "string",
                "enum": [
                  "tool_call"
                ]
              },
              "readout": {
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/AssistantReadoutData",
                    "description": "What the result found, in words, read from the whole result."
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "reason": {
                "type": "string",
                "description": "The model's one-line reason, for the user."
              },
              "result": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "The start of the result as mxr returned it, for a details view."
              },
              "seq": {
                "type": "integer",
                "format": "int64"
              },
              "state": {
                "$ref": "#/components/schemas/AssistantCallStateData"
              },
              "title": {
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/AssistantStepTitleData",
                    "description": "The step in the daemon's words, for the wire line. Absent from\nolder daemons: clients then fall back to `reason`."
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "tool": {
                "type": "string"
              }
            }
          }
        ],
        "description": "One entry in the conversation as the user sees it. A tool call and its\nresult are one item."
      },
      "AssistantLinkData": {
        "oneOf": [
          {
            "type": "object",
            "description": "An email conversation.",
            "required": [
              "thread_id",
              "kind"
            ],
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "thread"
                ]
              },
              "thread_id": {
                "type": "string"
              }
            }
          },
          {
            "type": "object",
            "description": "Someone's row in Messages.",
            "required": [
              "person_id",
              "kind"
            ],
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "person"
                ]
              },
              "person_id": {
                "type": "string"
              }
            }
          }
        ],
        "description": "Where a client opens something the assistant found. Replies link the\nsame places as markdown links: `mxr:thread/<id>` and `mxr:person/<id>`."
      },
      "AssistantModelBody": {
        "type": "object",
        "description": "Body of `POST /api/v1/mail/assistant/model`.",
        "required": [
          "model"
        ],
        "properties": {
          "dry_run": {
            "type": "boolean",
            "description": "Check the choice and say what would change, without changing it."
          },
          "model": {
            "type": "string",
            "description": "A model id from the list `GET .../assistant/models` returns."
          }
        }
      },
      "AssistantModelChangeData": {
        "type": "object",
        "description": "What `SetAssistantModel` did, or with `dry_run` would do.",
        "required": [
          "dry_run",
          "changed",
          "models"
        ],
        "properties": {
          "changed": {
            "type": "boolean",
            "description": "False when the model was already the one in use."
          },
          "dry_run": {
            "type": "boolean"
          },
          "models": {
            "$ref": "#/components/schemas/AssistantModelsData",
            "description": "The models after the change (with `dry_run`, as they would be)."
          },
          "previous": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "AssistantModelsData": {
        "type": "object",
        "description": "The models the assistant can be set to, and the one it uses now.",
        "required": [
          "choices"
        ],
        "properties": {
          "choices": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ModelChoiceData"
            }
          },
          "current": {
            "type": [
              "string",
              "null"
            ],
            "description": "The model the next turn uses. It may not be in `choices`: a model set\nby hand in config.toml stays as it is until one is picked."
          }
        }
      },
      "AssistantOutcomeData": {
        "type": "string",
        "description": "How the last turn ended.",
        "enum": [
          "finished",
          "cancelled",
          "step_limit",
          "failed",
          "interrupted"
        ]
      },
      "AssistantPendingData": {
        "oneOf": [
          {
            "type": "object",
            "description": "A change. Approving runs exactly `arguments`.",
            "required": [
              "call_id",
              "tool",
              "arguments",
              "reason",
              "kind"
            ],
            "properties": {
              "arguments": {},
              "call_id": {
                "type": "string"
              },
              "kind": {
                "type": "string",
                "enum": [
                  "approval"
                ]
              },
              "preview": {
                "description": "What the change will do, from the tool's own preview."
              },
              "preview_error": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "reason": {
                "type": "string"
              },
              "title": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "The change in words, \"Archive 14 emails\". Absent from older\ndaemons."
              },
              "tool": {
                "type": "string"
              },
              "warning": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "The daemon's warning for a change that can't be put back, \"Sends\nan email. Can't be undone.\". Absent for a reversible change and\nfrom older daemons, whose clients then work it out themselves."
              }
            }
          },
          {
            "type": "object",
            "required": [
              "call_id",
              "reason",
              "questions",
              "kind"
            ],
            "properties": {
              "call_id": {
                "type": "string"
              },
              "kind": {
                "type": "string",
                "enum": [
                  "question"
                ]
              },
              "questions": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/AssistantQuestionData"
                }
              },
              "reason": {
                "type": "string"
              }
            }
          }
        ],
        "description": "A call waiting for the user."
      },
      "AssistantProgressData": {
        "oneOf": [
          {
            "type": "object",
            "required": [
              "step",
              "kind"
            ],
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "thinking"
                ]
              },
              "step": {
                "type": "integer",
                "format": "int32",
                "minimum": 0
              }
            }
          },
          {
            "type": "object",
            "required": [
              "tool",
              "reason",
              "kind"
            ],
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "calling"
                ]
              },
              "reason": {
                "type": "string"
              },
              "title": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "The call in words while it runs, \"Searching your mail for\n\"shipped\"\". Absent from older daemons."
              },
              "tool": {
                "type": "string"
              }
            }
          },
          {
            "type": "object",
            "description": "The reply so far, while the model writes it. The whole text each\ntime, so a missed event loses nothing.",
            "required": [
              "text",
              "kind"
            ],
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "writing"
                ]
              },
              "text": {
                "type": "string"
              }
            }
          },
          {
            "type": "object",
            "description": "Summarising earlier messages to fit the context window.",
            "required": [
              "kind"
            ],
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "summarizing"
                ]
              }
            }
          }
        ],
        "description": "What a running turn is doing now."
      },
      "AssistantQuestionData": {
        "type": "object",
        "required": [
          "question"
        ],
        "properties": {
          "allow_other": {
            "type": "boolean"
          },
          "header": {
            "type": [
              "string",
              "null"
            ]
          },
          "multi_select": {
            "type": "boolean"
          },
          "options": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AssistantQuestionOptionData"
            }
          },
          "question": {
            "type": "string"
          }
        }
      },
      "AssistantQuestionOptionData": {
        "type": "object",
        "required": [
          "label"
        ],
        "properties": {
          "description": {
            "type": [
              "string",
              "null"
            ]
          },
          "label": {
            "type": "string"
          }
        }
      },
      "AssistantReadoutData": {
        "type": "object",
        "description": "A tool result for people: what it lists (the first few, with where to\nopen each) or, when it lists nothing, its plain fields.",
        "properties": {
          "facts": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AssistantReadoutFactData"
            }
          },
          "rows": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AssistantReadoutRowData"
            }
          },
          "total": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64",
            "description": "How many things the result lists in all, when it lists any.",
            "minimum": 0
          }
        }
      },
      "AssistantReadoutFactData": {
        "type": "object",
        "description": "A plain field of a result, such as \"Archived: 3\".",
        "required": [
          "label",
          "value"
        ],
        "properties": {
          "label": {
            "type": "string"
          },
          "value": {
            "type": "string"
          }
        }
      },
      "AssistantReadoutRowData": {
        "type": "object",
        "description": "One thing a result lists: an email, a person, a to-do.",
        "required": [
          "title"
        ],
        "properties": {
          "account_id": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/AccountId",
                "description": "The account the listed email came to. Absent for people and to-dos, and from older daemons."
              },
              {
                "type": "null"
              }
            ]
          },
          "at": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64",
            "description": "When the email arrived or the person last wrote: unix seconds."
          },
          "attachment": {
            "type": "boolean",
            "description": "The email carries an attachment."
          },
          "detail": {
            "type": [
              "string",
              "null"
            ]
          },
          "link": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/AssistantLinkData"
              },
              {
                "type": "null"
              }
            ]
          },
          "sender": {
            "type": [
              "string",
              "null"
            ],
            "description": "Who an email is from, apart from `detail`. Absent for people and\nfrom older daemons."
          },
          "snippet": {
            "type": [
              "string",
              "null"
            ],
            "description": "The start of an email's text, clipped."
          },
          "title": {
            "type": "string"
          },
          "unread": {
            "type": "boolean",
            "description": "The email or the person's latest activity is unread."
          }
        }
      },
      "AssistantSendBody": {
        "type": "object",
        "description": "Body of `POST /api/v1/mail/assistant/conversations`.",
        "required": [
          "message"
        ],
        "properties": {
          "context": {
            "$ref": "#/components/schemas/AssistantViewContextData",
            "description": "What the user has open, so \"this\" and \"these\" resolve."
          },
          "conversation_id": {
            "type": [
              "string",
              "null"
            ],
            "description": "Continue this conversation; omitted starts a new one."
          },
          "message": {
            "type": "string"
          }
        }
      },
      "AssistantStatusData": {
        "type": "string",
        "description": "Where a conversation stands.",
        "enum": [
          "idle",
          "running",
          "awaiting_user"
        ]
      },
      "AssistantStepTitleData": {
        "type": "object",
        "description": "A step in plain words, in the two tenses a client shows. Built by the\ndaemon from the tool and its arguments, never from the model's reason.",
        "required": [
          "running",
          "done"
        ],
        "properties": {
          "done": {
            "type": "string",
            "description": "Once it ended, whichever way it ended: \"Searched your mail: 14\nfound\", \"Couldn't star 1 email: it needs your confirmation first\",\n\"Waiting for you: archive 14 emails\"."
          },
          "running": {
            "type": "string",
            "description": "While it runs: \"Searching your mail for \"shipped\"\"."
          }
        }
      },
      "AssistantViewContextData": {
        "type": "object",
        "description": "What the user has open when they send a message, so \"this\" and\n\"these\" mean something.",
        "properties": {
          "open_message_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "open_thread_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "search_query": {
            "type": [
              "string",
              "null"
            ]
          },
          "selected_message_ids": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "view": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "AttachmentChunk": {
        "type": "object",
        "required": [
          "message_id",
          "attachment_id",
          "offset",
          "data_base64"
        ],
        "properties": {
          "attachment_id": {
            "$ref": "#/components/schemas/AttachmentId"
          },
          "data_base64": {
            "type": "string",
            "description": "Standard base64 bytes; never a JSON integer array."
          },
          "message_id": {
            "$ref": "#/components/schemas/MessageId"
          },
          "offset": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          }
        }
      },
      "AttachmentChunkRequest": {
        "type": "object",
        "required": [
          "message_id",
          "attachment_id",
          "offset",
          "length"
        ],
        "properties": {
          "attachment_id": {
            "type": "string"
          },
          "length": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "message_id": {
            "type": "string"
          },
          "offset": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          }
        }
      },
      "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
          }
        }
      },
      "AttachmentRequest": {
        "type": "object",
        "required": [
          "message_id",
          "attachment_id"
        ],
        "properties": {
          "attachment_id": {
            "type": "string"
          },
          "message_id": {
            "type": "string"
          }
        }
      },
      "AttachmentTransferMetadata": {
        "type": "object",
        "required": [
          "message_id",
          "attachment_id",
          "filename",
          "mime_type",
          "length_bytes",
          "sha256",
          "max_chunk_bytes"
        ],
        "properties": {
          "attachment_id": {
            "$ref": "#/components/schemas/AttachmentId"
          },
          "filename": {
            "type": "string"
          },
          "length_bytes": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "max_chunk_bytes": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "message_id": {
            "$ref": "#/components/schemas/MessageId"
          },
          "mime_type": {
            "type": "string"
          },
          "sha256": {
            "type": "string",
            "description": "Lowercase hexadecimal SHA-256 of the complete attachment."
          }
        }
      },
      "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"
        ]
      },
      "AutoTodoData": {
        "type": "object",
        "description": "The outcome of automatic to-do creation for one alert (blueprint 22,\nD193).",
        "required": [
          "state",
          "reason_code",
          "reason_text"
        ],
        "properties": {
          "reason_code": {
            "type": "string",
            "description": "Stable code: `verified_alert`, or why not (`imap_gives_no_verdict`,\n`not_dmarc_pass`, `thin_history`, `lookalike`, `mailing_list`,\n`too_old`, `parcel_not_tied`, `switched_off`, ...)."
          },
          "reason_text": {
            "type": "string",
            "description": "The sentence the row shows."
          },
          "state": {
            "type": "string",
            "description": "`created` or `not_created`."
          }
        }
      },
      "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": [
              {
                "$ref": "#/components/schemas/CalendarPerson"
              },
              {
                "type": "null"
              }
            ]
          },
          "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": [
              {
                "$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)."
              },
              {
                "type": "null"
              }
            ]
          },
          "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"
            ]
          }
        }
      },
      "CategoriesResponse": {
        "type": "object",
        "required": [
          "categories"
        ],
        "properties": {
          "categories": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PersonalCategory"
            }
          }
        }
      },
      "CategoryAssignmentEffect": {
        "type": "object",
        "required": [
          "message_id",
          "category_id",
          "before",
          "after",
          "reason"
        ],
        "properties": {
          "after": {
            "type": "boolean"
          },
          "before": {
            "type": "boolean"
          },
          "category_id": {
            "$ref": "#/components/schemas/CategoryId"
          },
          "message_id": {
            "$ref": "#/components/schemas/MessageId"
          },
          "reason": {
            "type": "string"
          }
        }
      },
      "CategoryDeletePreview": {
        "type": "object",
        "required": [
          "category_id",
          "name",
          "affected_messages",
          "preview_token"
        ],
        "properties": {
          "affected_messages": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "category_id": {
            "$ref": "#/components/schemas/CategoryId"
          },
          "name": {
            "type": "string"
          },
          "preview_token": {
            "type": "string"
          }
        }
      },
      "CategoryDeleteResponse": {
        "oneOf": [
          {
            "$ref": "#/components/schemas/CategoryDeletePreview"
          },
          {
            "$ref": "#/components/schemas/CategoryDeletedResponse"
          }
        ]
      },
      "CategoryDeletedResponse": {
        "type": "object",
        "required": [
          "category_id",
          "name"
        ],
        "properties": {
          "category_id": {
            "$ref": "#/components/schemas/CategoryId"
          },
          "name": {
            "type": "string"
          }
        }
      },
      "CategoryId": {
        "type": "string",
        "format": "uuid"
      },
      "CategoryMembershipAppliedResponse": {
        "type": "object",
        "required": [
          "mutation_id",
          "added",
          "removed"
        ],
        "properties": {
          "added": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "mutation_id": {
            "type": "string"
          },
          "removed": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          }
        }
      },
      "CategoryMembershipBody": {
        "type": "object",
        "properties": {
          "account_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "add_category_ids": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "message_ids": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "remove_category_ids": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "CategoryMembershipPreview": {
        "type": "object",
        "required": [
          "category_ids",
          "message_count",
          "added",
          "removed",
          "preview_token"
        ],
        "properties": {
          "added": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "category_ids": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CategoryId"
            }
          },
          "effects": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CategoryAssignmentEffect"
            }
          },
          "message_count": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "preview_token": {
            "type": "string"
          },
          "removed": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          }
        }
      },
      "CategoryMembershipState": {
        "type": "object",
        "required": [
          "category_id",
          "selected_messages",
          "assigned_messages"
        ],
        "properties": {
          "assigned_messages": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "category_id": {
            "$ref": "#/components/schemas/CategoryId"
          },
          "selected_messages": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          }
        }
      },
      "CategoryMembershipStateBody": {
        "type": "object",
        "required": [
          "message_ids",
          "category_ids"
        ],
        "properties": {
          "account_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "category_ids": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "message_ids": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "CategoryMembershipStatesResponse": {
        "type": "object",
        "required": [
          "states"
        ],
        "properties": {
          "states": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CategoryMembershipState"
            }
          }
        }
      },
      "CategoryMembershipUndoneResponse": {
        "type": "object",
        "required": [
          "restored",
          "skipped"
        ],
        "properties": {
          "restored": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "skipped": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          }
        }
      },
      "CategoryMessagesResponse": {
        "type": "object",
        "required": [
          "envelopes",
          "total",
          "has_more"
        ],
        "properties": {
          "envelopes": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Envelope"
            }
          },
          "has_more": {
            "type": "boolean"
          },
          "total": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          }
        }
      },
      "CategoryNameBody": {
        "type": "object",
        "required": [
          "name"
        ],
        "properties": {
          "name": {
            "type": "string"
          }
        }
      },
      "CategoryNamePreviewBody": {
        "type": "object",
        "required": [
          "name"
        ],
        "properties": {
          "category_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "name": {
            "type": "string"
          }
        }
      },
      "CategoryNamePreviewResponse": {
        "type": "object",
        "required": [
          "normalized_name",
          "available"
        ],
        "properties": {
          "available": {
            "type": "boolean"
          },
          "normalized_name": {
            "type": "string"
          }
        }
      },
      "CategoryTokenBody": {
        "type": "object",
        "required": [
          "preview_token"
        ],
        "properties": {
          "preview_token": {
            "type": "string"
          }
        }
      },
      "CategoryUndoBody": {
        "type": "object",
        "required": [
          "mutation_id"
        ],
        "properties": {
          "mutation_id": {
            "type": "string"
          }
        }
      },
      "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"
            ]
          }
        }
      },
      "ClassifyComparisonData": {
        "type": "object",
        "required": [
          "current_version",
          "requested_version",
          "available_versions",
          "available",
          "pending_assessments",
          "compared",
          "missing_previous_assessments",
          "changes",
          "truncated"
        ],
        "properties": {
          "available": {
            "type": "boolean"
          },
          "available_versions": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "changes": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ClassifyHomeChangeData"
            }
          },
          "compared": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "current_version": {
            "type": "string"
          },
          "missing_previous_assessments": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "pending_assessments": {
            "type": "integer",
            "format": "int32",
            "description": "Missing or stale current assessments excluded from comparison.",
            "minimum": 0
          },
          "requested_version": {
            "type": "string"
          },
          "truncated": {
            "type": "boolean"
          }
        }
      },
      "ClassifyEvalAskKindData": {
        "type": "object",
        "description": "Precision and recall for one kind of ask.",
        "required": [
          "kind",
          "direction",
          "counts"
        ],
        "properties": {
          "counts": {
            "$ref": "#/components/schemas/ClassifyEvalCountsData"
          },
          "direction": {
            "type": "string",
            "description": "`asks_you` (inbound mail asks) or `you_promised` (your sent mail)."
          },
          "kind": {
            "type": "string",
            "description": "A kind from blueprint 37: `pay`, `fix_payment`, `sign`, `verify`,\n`reply`, `send`, `provide`, `upload`, `book`, `attend`,\n`renew_or_cancel`, `register`, `contact` or `other`."
          }
        }
      },
      "ClassifyEvalAsksData": {
        "type": "object",
        "description": "What the emails ask of you: to-do rows against the labelled items.",
        "required": [
          "emails",
          "total",
          "kinds",
          "fields",
          "duplicates",
          "merges",
          "twins",
          "slices",
          "reply_owed"
        ],
        "properties": {
          "duplicates": {
            "type": "integer",
            "format": "int32",
            "description": "Matched items with two rows for one expected item.",
            "minimum": 0
          },
          "emails": {
            "type": "integer",
            "format": "int32",
            "description": "Labelled emails graded on what they ask.",
            "minimum": 0
          },
          "fields": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ClassifyEvalFieldData"
            },
            "description": "Exact match per field on matched items."
          },
          "kinds": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ClassifyEvalAskKindData"
            },
            "description": "Per kind of ask. Every kind a person can be asked for is listed (with\nzero counts when nothing was expected or found), then any kind of\npromise that appeared."
          },
          "merges": {
            "type": "integer",
            "format": "int32",
            "description": "Expected items absorbed into another email's row of the same sender,\nkind and counterparty (two accounts from one sender).",
            "minimum": 0
          },
          "reply_owed": {
            "$ref": "#/components/schemas/ClassifyEvalReplyData"
          },
          "slices": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ClassifyEvalSliceData"
            }
          },
          "total": {
            "$ref": "#/components/schemas/ClassifyEvalCountsData",
            "description": "All kinds together."
          },
          "twins": {
            "$ref": "#/components/schemas/ClassifyEvalTwinsData"
          }
        }
      },
      "ClassifyEvalCountsData": {
        "type": "object",
        "description": "How many items were expected, found and matched.",
        "required": [
          "expected",
          "found",
          "true_positives",
          "false_positives",
          "false_negatives"
        ],
        "properties": {
          "expected": {
            "type": "integer",
            "format": "int32",
            "description": "Items the labels expect.",
            "minimum": 0
          },
          "false_negatives": {
            "type": "integer",
            "format": "int32",
            "description": "Expected items nothing matched.",
            "minimum": 0
          },
          "false_positives": {
            "type": "integer",
            "format": "int32",
            "description": "Found items that match no expected item.",
            "minimum": 0
          },
          "found": {
            "type": "integer",
            "format": "int32",
            "description": "Items (to-do rows) the classifier made.",
            "minimum": 0
          },
          "precision_percent": {
            "type": [
              "number",
              "null"
            ],
            "format": "double",
            "description": "`true_positives / found` as a percentage with one decimal; absent when\nnothing was found, because precision is then undefined."
          },
          "recall_percent": {
            "type": [
              "number",
              "null"
            ],
            "format": "double",
            "description": "`true_positives / expected`; absent when nothing was expected."
          },
          "true_positives": {
            "type": "integer",
            "format": "int32",
            "description": "Found items that match an expected item by kind and direction.",
            "minimum": 0
          }
        }
      },
      "ClassifyEvalFieldData": {
        "type": "object",
        "description": "How often one field of a matched item is exactly right.",
        "required": [
          "field",
          "pairs",
          "exact",
          "exact_percent",
          "missing",
          "wrong",
          "spurious"
        ],
        "properties": {
          "exact": {
            "type": "integer",
            "format": "int32",
            "description": "Pairs where the row's field equals the label's, an absent value on\nboth sides counting as equal. A due date is exact only when the row's\nday is the day the label names.",
            "minimum": 0
          },
          "exact_percent": {
            "type": "number",
            "format": "double"
          },
          "field": {
            "type": "string",
            "description": "`amount`, `due` or `counterparty`."
          },
          "missing": {
            "type": "integer",
            "format": "int32",
            "description": "The label states a value and the row has none.",
            "minimum": 0
          },
          "pairs": {
            "type": "integer",
            "format": "int32",
            "description": "Matched items: the ones this field is compared on.",
            "minimum": 0
          },
          "present": {
            "type": "integer",
            "format": "int32",
            "description": "The label states a value the eval cannot resolve to an exact one, and\nthe row has one. Counted apart and never as exact.",
            "minimum": 0
          },
          "spurious": {
            "type": "integer",
            "format": "int32",
            "description": "The label states none and the row has one.",
            "minimum": 0
          },
          "wrong": {
            "type": "integer",
            "format": "int32",
            "description": "Both have a value and they differ.",
            "minimum": 0
          }
        }
      },
      "ClassifyEvalMismatchData": {
        "type": "object",
        "description": "One wrong answer.",
        "required": [
          "scenario",
          "provider_id",
          "question",
          "expected",
          "actual"
        ],
        "properties": {
          "actual": {
            "type": "string",
            "description": "The answer today's code gave."
          },
          "expected": {
            "type": "string"
          },
          "held_out": {
            "type": "boolean",
            "description": "The email is worded in a phrasing held out of what agents see while\nchanging a judge."
          },
          "label_review": {
            "type": [
              "string",
              "null"
            ],
            "description": "Why the label itself is a judgement call, when it is: a mismatch\nhere may be the label's fault, not the classifier's."
          },
          "provider_id": {
            "type": "string"
          },
          "question": {
            "type": "string"
          },
          "reason": {
            "type": "string",
            "description": "Why today's code answered so: the deciding rule's reason. Empty\nfor to-do and record answers."
          },
          "scenario": {
            "type": "string"
          },
          "twin_of": {
            "type": [
              "string",
              "null"
            ],
            "description": "The scenario this one is a near-miss twin of."
          }
        }
      },
      "ClassifyEvalQuestionData": {
        "type": "object",
        "description": "Accuracy on one question about an email. What an email asks of you (to-dos)\nis not one of these: it is graded in [`ClassifyEvalAsksData`].",
        "required": [
          "question",
          "evaluated",
          "correct",
          "accuracy_percent"
        ],
        "properties": {
          "accuracy_percent": {
            "type": "number",
            "format": "double",
            "description": "`correct / evaluated` as a percentage with one decimal; 0 when\nnothing was evaluated."
          },
          "correct": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "evaluated": {
            "type": "integer",
            "format": "int32",
            "description": "Labelled emails present in this mailbox and answerable (an email\nwhose home cannot be worked out is not asked about its home).",
            "minimum": 0
          },
          "question": {
            "type": "string",
            "description": "`who`, `home` or `record`."
          }
        }
      },
      "ClassifyEvalReplyData": {
        "type": "object",
        "description": "Whether a reply is owed, graded as its own question.",
        "required": [
          "emails",
          "counts",
          "projection"
        ],
        "properties": {
          "counts": {
            "$ref": "#/components/schemas/ClassifyEvalCountsData",
            "description": "`expected` emails owe a reply, `found` are marked as needing one."
          },
          "emails": {
            "type": "integer",
            "format": "int32",
            "description": "Emails graded on it.",
            "minimum": 0
          },
          "projection": {
            "type": "string",
            "description": "What the classifier's answer reads, so the number is not taken for\nmore than it is."
          }
        }
      },
      "ClassifyEvalSetData": {
        "type": "string",
        "description": "Which labelled set to measure. `Mine` arrives with corrections\n(blueprint 32, build order 5).",
        "enum": [
          "quick",
          "full"
        ]
      },
      "ClassifyEvalSliceData": {
        "type": "object",
        "description": "The ask results over one slice of the emails.",
        "required": [
          "dimension",
          "value",
          "emails",
          "counts"
        ],
        "properties": {
          "counts": {
            "$ref": "#/components/schemas/ClassifyEvalCountsData"
          },
          "dimension": {
            "type": "string",
            "description": "`sender_kind`, `locale`, `template_family` or `phrasing`."
          },
          "emails": {
            "type": "integer",
            "format": "int32",
            "description": "Labelled emails in the slice.",
            "minimum": 0
          },
          "value": {
            "type": "string",
            "description": "For example `person`, `en-ZA`, `bill-due`, `held_out`."
          }
        }
      },
      "ClassifyEvalSummaryData": {
        "type": "object",
        "required": [
          "set",
          "label_schema_version",
          "labelled_in_set",
          "present",
          "placed_live",
          "not_placed",
          "unlabelled",
          "questions",
          "home_projection"
        ],
        "properties": {
          "asks": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/ClassifyEvalAsksData",
                "description": "What the emails ask of you, graded per kind of ask and per field\n(label schema v2). Absent when nothing was graded."
              },
              {
                "type": "null"
              }
            ]
          },
          "held_out_present": {
            "type": "integer",
            "format": "int32",
            "description": "Of the present emails, the ones worded in a held-out phrasing. A\njudge that learned the generator, not the mail, scores worse here\nthan overall.",
            "minimum": 0
          },
          "held_out_questions": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ClassifyEvalQuestionData"
            },
            "description": "Accuracy on the held-out emails alone, per question. Empty when the\nset has none."
          },
          "home_projection": {
            "type": "string",
            "description": "What `home` reads: the arrivals line's current-policy destination."
          },
          "label_schema_version": {
            "type": "integer",
            "format": "int32",
            "description": "Version of the questions the expectations answer, so a change to\nthem never silently invalidates old labels.",
            "minimum": 0
          },
          "labelled_in_set": {
            "type": "integer",
            "format": "int32",
            "description": "Labelled emails in the set.",
            "minimum": 0
          },
          "message": {
            "type": [
              "string",
              "null"
            ],
            "description": "A plain sentence when there is nothing to measure."
          },
          "not_placed": {
            "type": "integer",
            "format": "int32",
            "description": "Present emails whose home could not be worked out at all, so there is\nnone to compare.",
            "minimum": 0
          },
          "placed_live": {
            "type": "integer",
            "format": "int32",
            "description": "Legacy field, always zero: historical mail also reads stored assessments.",
            "minimum": 0
          },
          "present": {
            "type": "integer",
            "format": "int32",
            "description": "Of those, the ones found in this mailbox.",
            "minimum": 0
          },
          "questions": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ClassifyEvalQuestionData"
            }
          },
          "set": {
            "$ref": "#/components/schemas/ClassifyEvalSetData"
          },
          "unlabelled": {
            "type": "integer",
            "format": "int32",
            "description": "Stored emails in scope that no scenario labels.",
            "minimum": 0
          }
        }
      },
      "ClassifyEvalTwinsData": {
        "type": "object",
        "description": "Twin pairs, where both members must be right on what they ask.",
        "required": [
          "pairs",
          "both_right",
          "differing_pairs",
          "differing_both_right"
        ],
        "properties": {
          "both_right": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "differing_both_right": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "differing_pairs": {
            "type": "integer",
            "format": "int32",
            "description": "Of those, pairs whose members expect different asks (one asks\nsomething and the other nothing, or different kinds).",
            "minimum": 0
          },
          "pairs": {
            "type": "integer",
            "format": "int32",
            "description": "Pairs with both members present.",
            "minimum": 0
          }
        }
      },
      "ClassifyFallbackClusterData": {
        "type": "object",
        "required": [
          "facts",
          "home",
          "who",
          "rule",
          "count",
          "examples"
        ],
        "properties": {
          "count": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "examples": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/MessageId"
            }
          },
          "facts": {
            "$ref": "#/components/schemas/AssessmentFacts"
          },
          "home": {
            "type": "string"
          },
          "rule": {
            "type": "string"
          },
          "who": {
            "type": "string"
          }
        }
      },
      "ClassifyHomeChangeData": {
        "type": "object",
        "required": [
          "message_id",
          "previous_home",
          "current_home",
          "deciding_reason"
        ],
        "properties": {
          "current_home": {
            "type": "string"
          },
          "deciding_reason": {
            "type": "string"
          },
          "message_id": {
            "$ref": "#/components/schemas/MessageId"
          },
          "previous_home": {
            "type": "string"
          }
        }
      },
      "ClassifyReportData": {
        "type": "object",
        "description": "A bounded local picture of stored home decisions. It never creates assessments.",
        "required": [
          "policy_version",
          "examined",
          "missing",
          "stale",
          "pending_body",
          "fallback",
          "truncated",
          "clusters"
        ],
        "properties": {
          "clusters": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ClassifyFallbackClusterData"
            }
          },
          "examined": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "fallback": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "missing": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "pending_body": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "policy_version": {
            "type": "string"
          },
          "stale": {
            "type": "integer",
            "format": "int32",
            "description": "Stored rows whose observed inputs changed; awaiting reconciliation.",
            "minimum": 0
          },
          "truncated": {
            "type": "boolean"
          }
        }
      },
      "ClientKind": {
        "type": "string",
        "description": "Cooperative client identity, declared during setup and repeated on each\nenvelope for activity attribution. Missing legacy envelope tags decode as\n`Cli`; they cannot replace the mandatory `DeclareClient` handshake.",
        "enum": [
          "human",
          "tui",
          "cli",
          "script",
          "web",
          "daemon",
          "agent",
          "mcp",
          "assistant"
        ]
      },
      "ClosenessData": {
        "type": "string",
        "description": "How close you are, from your history with them: reciprocity, recency\nand longevity (Whittaker, Jones and Terveen, CSCW 2002).",
        "enum": [
          "close",
          "regular",
          "occasional",
          "new"
        ]
      },
      "CommitUnsubscribePreviewRequest": {
        "type": "object",
        "required": [
          "address",
          "preview_token",
          "archive"
        ],
        "properties": {
          "account_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "address": {
            "type": "string"
          },
          "archive": {
            "type": "boolean"
          },
          "archive_on_no_method": {
            "type": "boolean"
          },
          "preview_token": {
            "type": "string"
          }
        }
      },
      "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"
          },
          "date_unverified": {
            "type": "boolean",
            "description": "`by_when` is a date a model wrote before due words existed, so it\nstays on the row but nothing acts on it (desk, to-dos). Clients show\nit as \"date unverified\"."
          },
          "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"
        ]
      },
      "ComposeApplyBody": {
        "type": "object",
        "description": "Body of `POST /api/v1/mail/compose/apply`.",
        "required": [
          "proposal_id",
          "draft_id"
        ],
        "properties": {
          "draft_id": {
            "type": "string"
          },
          "proposal_id": {
            "type": "string"
          }
        }
      },
      "ComposeApplyResponse": {
        "type": "object",
        "description": "Answer to `POST /api/v1/mail/compose/apply`.",
        "required": [
          "draft_id",
          "text_hash"
        ],
        "properties": {
          "draft_id": {
            "$ref": "#/components/schemas/DraftId"
          },
          "text_hash": {
            "type": "string",
            "description": "Hex SHA-256 of the draft's new text region."
          }
        }
      },
      "ComposeAssistBody": {
        "type": "object",
        "description": "Body of `POST /api/v1/mail/compose/assist`: the fields of the daemon's\n`ComposeAssist` request.",
        "required": [
          "draft",
          "text"
        ],
        "properties": {
          "action": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/AssistActionData",
                "description": "Absent: the daemon picks write, finish or edit from the text."
              },
              {
                "type": "null"
              }
            ]
          },
          "adjust": {
            "$ref": "#/components/schemas/AssistAdjustData"
          },
          "draft": {
            "$ref": "#/components/schemas/DraftTargetData",
            "description": "What the help is for: a stored draft, a reply, a forward or a new message."
          },
          "instruction": {
            "type": [
              "string",
              "null"
            ]
          },
          "model": {
            "type": [
              "string",
              "null"
            ],
            "description": "Optional configured model for this draft only."
          },
          "revise": {
            "type": [
              "string",
              "null"
            ],
            "description": "The id of the proposal on screen, when revising it: the model is shown\nthat proposal and the instruction is applied to it. `text` stays the\nuser's own text."
          },
          "selection": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/TextRangeData",
                "description": "A byte range of `text` on character boundaries; the rest is kept as it is."
              },
              {
                "type": "null"
              }
            ]
          },
          "text": {
            "type": "string",
            "description": "The text region of the compose box, without signature or forward header.\nEmpty when nothing is typed."
          }
        }
      },
      "ComposeAssistResponse": {
        "type": "object",
        "description": "Answer to `POST /api/v1/mail/compose/assist`.",
        "required": [
          "proposal"
        ],
        "properties": {
          "proposal": {
            "$ref": "#/components/schemas/ComposeProposalData",
            "description": "Never touches the draft; accept it by applying `text` or `compose/apply`."
          }
        }
      },
      "ComposeAttachmentChunkResponse": {
        "type": "object",
        "required": [
          "ok"
        ],
        "properties": {
          "ok": {
            "type": "boolean"
          }
        },
        "additionalProperties": false
      },
      "ComposeAttachmentOwnerResponse": {
        "type": "object",
        "required": [
          "draft_id",
          "revision"
        ],
        "properties": {
          "draft_id": {
            "$ref": "#/components/schemas/DraftId"
          },
          "revision": {
            "type": "integer",
            "format": "int64"
          }
        },
        "additionalProperties": false
      },
      "ComposeAttachmentResponse": {
        "oneOf": [
          {
            "$ref": "#/components/schemas/ComposeAttachmentOwnerResponse"
          },
          {
            "$ref": "#/components/schemas/ComposeAttachmentChunkResponse"
          },
          {
            "$ref": "#/components/schemas/ComposeAttachmentUploadResponse"
          }
        ]
      },
      "ComposeAttachmentUploadResponse": {
        "type": "object",
        "required": [
          "draft_id",
          "revision",
          "path",
          "filename",
          "size_bytes"
        ],
        "properties": {
          "draft_id": {
            "$ref": "#/components/schemas/DraftId"
          },
          "filename": {
            "type": "string"
          },
          "path": {
            "type": "string"
          },
          "revision": {
            "type": "integer",
            "format": "int64"
          },
          "size_bytes": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          }
        },
        "additionalProperties": false
      },
      "ComposeFrontmatter": {
        "type": "object",
        "required": [
          "to",
          "subject",
          "from"
        ],
        "properties": {
          "attach": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "bcc": {
            "type": "string"
          },
          "cc": {
            "type": "string"
          },
          "forward_source": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/ForwardSource",
                "description": "Prepared original content and daemon-owned resources for a forward."
              },
              {
                "type": "null"
              }
            ]
          },
          "from": {
            "type": "string"
          },
          "in-reply-to": {
            "type": [
              "string",
              "null"
            ]
          },
          "intent": {
            "$ref": "#/components/schemas/DraftIntent"
          },
          "references": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "signature": {
            "type": [
              "string",
              "null"
            ]
          },
          "subject": {
            "type": "string"
          },
          "thread-id": {
            "type": [
              "string",
              "null"
            ]
          },
          "to": {
            "type": "string"
          }
        }
      },
      "ComposeIssueView": {
        "type": "object",
        "required": [
          "severity",
          "message"
        ],
        "properties": {
          "message": {
            "type": "string"
          },
          "severity": {
            "type": "string"
          }
        }
      },
      "ComposeModelsResponse": {
        "type": "object",
        "description": "The models available to the compose writer under its own policy.",
        "required": [
          "models"
        ],
        "properties": {
          "models": {
            "$ref": "#/components/schemas/AssistantModelsData"
          }
        }
      },
      "ComposeProposalData": {
        "type": "object",
        "description": "What the writing help proposes. Nothing changes the draft until the user\naccepts it with `ApplyComposeProposal`.",
        "required": [
          "proposal_id",
          "action",
          "base",
          "text",
          "changes",
          "gaps",
          "provenance",
          "yours_changed",
          "composer_version"
        ],
        "properties": {
          "action": {
            "$ref": "#/components/schemas/AssistActionData"
          },
          "base": {
            "type": "string",
            "description": "Hex SHA-256 of the request text with trailing blank space ignored: the\ntext region the proposal was written against. Applying refuses when the\ndraft's text region no longer hashes to it."
          },
          "changes": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TextChangeData"
            }
          },
          "composer_version": {
            "type": "string",
            "description": "Version of the rules that checked this proposal."
          },
          "gaps": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/GapData"
            }
          },
          "proposal_id": {
            "type": "string"
          },
          "provenance": {
            "$ref": "#/components/schemas/DraftProvenanceData",
            "description": "Always filled: the model that answered, where it ran and what it read."
          },
          "style_marks": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ComposeStyleMarkData"
            },
            "description": "Additive fields: older peers can ignore or omit them."
          },
          "style_score": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "style_version": {
            "type": "string"
          },
          "text": {
            "type": "string"
          },
          "yours_changed": {
            "type": "array",
            "items": {
              "type": "integer",
              "format": "int32",
              "minimum": 0
            },
            "description": "Positions, from zero, of the user's sentences that the proposal changed\nor dropped. Sentences are the request text split at `.`, `!`, `?` and\nline breaks, with empty ones skipped; case and spacing do not count as a\nchange."
          }
        }
      },
      "ComposeSessionAttachmentRequest": {
        "type": "object",
        "required": [
          "draft_path",
          "account_id",
          "operation"
        ],
        "properties": {
          "account_id": {
            "type": "string"
          },
          "content_base64": {
            "type": [
              "string",
              "null"
            ]
          },
          "draft_path": {
            "type": "string"
          },
          "expected_revision": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64"
          },
          "metadata": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/DraftAttachment"
              },
              {
                "type": "null"
              }
            ]
          },
          "offset": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64",
            "minimum": 0
          },
          "operation": {
            "type": "string"
          },
          "resource_id": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/DraftAttachmentId"
              },
              {
                "type": "null"
              }
            ]
          }
        }
      },
      "ComposeSessionAudienceRequest": {
        "type": "object",
        "required": [
          "draft_path",
          "draft_id",
          "reply_all",
          "expected_revision"
        ],
        "properties": {
          "draft_id": {
            "type": "string"
          },
          "draft_path": {
            "type": "string"
          },
          "dry_run": {
            "type": "boolean"
          },
          "expected_revision": {
            "type": "integer",
            "format": "int64"
          },
          "reply_all": {
            "type": "boolean"
          }
        }
      },
      "ComposeSessionData": {
        "type": "object",
        "required": [
          "draftPath",
          "rawContent",
          "frontmatter",
          "bodyMarkdown",
          "previewHtml",
          "issues"
        ],
        "properties": {
          "accountId": {
            "type": [
              "string",
              "null"
            ]
          },
          "bodyMarkdown": {
            "type": "string"
          },
          "cursorLine": {
            "type": [
              "integer",
              "null"
            ],
            "minimum": 0
          },
          "draftId": {
            "type": [
              "string",
              "null"
            ]
          },
          "draftIntent": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/DraftIntent",
                "description": "Stored intent when reopening a saved draft."
              },
              {
                "type": "null"
              }
            ]
          },
          "draftPath": {
            "type": "string"
          },
          "editorCommand": {
            "type": [
              "string",
              "null"
            ]
          },
          "frontmatter": {
            "$ref": "#/components/schemas/ComposeFrontmatter"
          },
          "issues": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ComposeIssueView"
            }
          },
          "kind": {
            "type": [
              "string",
              "null"
            ]
          },
          "preservedRecoveryPath": {
            "type": [
              "string",
              "null"
            ]
          },
          "previewHtml": {
            "type": "string"
          },
          "rawContent": {
            "type": "string"
          },
          "recoverySourcePath": {
            "type": [
              "string",
              "null"
            ],
            "description": "Private recovery destination; automatic saves preserve it without canonical effects."
          },
          "revision": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64"
          },
          "workspace": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/ArchiveWorkspaceData"
              },
              {
                "type": "null"
              }
            ]
          }
        }
      },
      "ComposeSessionKindRequest": {
        "type": "string",
        "enum": [
          "new",
          "reply",
          "reply_all",
          "forward",
          "invite_reply"
        ]
      },
      "ComposeSessionPathRequest": {
        "type": "object",
        "required": [
          "draft_path"
        ],
        "properties": {
          "draft_path": {
            "type": "string"
          },
          "expected_attachments": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "type": "string"
            },
            "description": "Original attachment references whose identity a private recovery refresh must preserve."
          },
          "expected_revision": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64"
          }
        }
      },
      "ComposeSessionResponse": {
        "type": "object",
        "required": [
          "session"
        ],
        "properties": {
          "session": {
            "$ref": "#/components/schemas/ComposeSessionData"
          }
        }
      },
      "ComposeSessionRestoreRequest": {
        "type": "object",
        "required": [
          "draft_id"
        ],
        "properties": {
          "draft_id": {
            "type": "string"
          }
        }
      },
      "ComposeSessionScheduleRequest": {
        "type": "object",
        "required": [
          "draft_path",
          "account_id",
          "send_at"
        ],
        "properties": {
          "account_id": {
            "type": "string"
          },
          "draft_id": {
            "type": [
              "string",
              "null"
            ],
            "description": "The stored draft this session was restored from, if any. With it the\nschedule updates that draft in place; without it a new local draft is\nstored."
          },
          "draft_path": {
            "type": "string"
          },
          "expected_revision": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64"
          },
          "send_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "ComposeSessionSendRequest": {
        "type": "object",
        "required": [
          "draft_path",
          "account_id"
        ],
        "properties": {
          "account_id": {
            "type": "string"
          },
          "draft_id": {
            "type": [
              "string",
              "null"
            ],
            "description": "The stored draft this session was restored from, when it was one — the\nsame id the client passed to `ComposeSessionRestoreRequest`. Acted on by\nthe save handler only: with it, saving updates that local draft in\nplace before any requested provider link/sync."
          },
          "draft_path": {
            "type": "string"
          },
          "expected_revision": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64"
          },
          "operation_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "override_safety_token": {
            "type": [
              "string",
              "null"
            ],
            "description": "Token from a prior safety-check report authorizing a send despite\nblockers. Forwarded to `SendDraft`; ignored by save/check handlers."
          },
          "save_to_server": {
            "type": "boolean",
            "description": "Explicit provider-link request. Linked drafts already synchronize when\nupdated; this flag links a local-only draft to the provider."
          }
        }
      },
      "ComposeSessionStartRequest": {
        "type": "object",
        "required": [
          "kind"
        ],
        "properties": {
          "action": {
            "type": [
              "string",
              "null"
            ],
            "description": "Required when `kind == InviteReply`. One of `accept`, `tentative`,\n`decline`. Ignored for other kinds."
          },
          "kind": {
            "$ref": "#/components/schemas/ComposeSessionKindRequest"
          },
          "message_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "to": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "ComposeSessionUpdateRequest": {
        "type": "object",
        "required": [
          "draft_path",
          "to",
          "cc",
          "bcc",
          "subject",
          "from"
        ],
        "properties": {
          "account_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "attach": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "bcc": {
            "type": "string"
          },
          "body": {
            "type": [
              "string",
              "null"
            ]
          },
          "cc": {
            "type": "string"
          },
          "draft_path": {
            "type": "string"
          },
          "expected_revision": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64"
          },
          "from": {
            "type": "string"
          },
          "retry_recovery": {
            "type": "boolean",
            "description": "Explicit canonical persistence retry using a private recovery's observed revision."
          },
          "subject": {
            "type": "string"
          },
          "to": {
            "type": "string"
          }
        }
      },
      "ComposeStyleMarkData": {
        "type": "object",
        "description": "A deterministic style tell in proposal text. Ranges are UTF-8 byte offsets.",
        "required": [
          "pattern",
          "name",
          "start",
          "end",
          "context"
        ],
        "properties": {
          "context": {
            "type": "string"
          },
          "end": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "name": {
            "type": "string"
          },
          "pattern": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "start": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          }
        }
      },
      "ComposerData": {
        "type": "object",
        "description": "The box at the bottom, already addressed.",
        "required": [
          "label",
          "reply_to_message_id",
          "reply_all"
        ],
        "properties": {
          "label": {
            "type": "string",
            "description": "\"Reply to Samir · Contract renewal\"."
          },
          "reply_all": {
            "type": "boolean",
            "description": "Reply all is on by default in a group, off on a one-to-one topic."
          },
          "reply_to_message_id": {
            "$ref": "#/components/schemas/MessageId"
          }
        }
      },
      "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"
          }
        }
      },
      "ContactSuggestion": {
        "type": "object",
        "description": "One prefix-search hit. `name` is the sender's display name when the daemon\nhas a non-blank one; clients fall back to the address when it is `null`.",
        "required": [
          "email"
        ],
        "properties": {
          "email": {
            "type": "string"
          },
          "name": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "ContactsAutocompleteResponse": {
        "type": "object",
        "required": [
          "contacts"
        ],
        "properties": {
          "contacts": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ContactSuggestion"
            }
          }
        }
      },
      "ConversationAttachmentData": {
        "type": "object",
        "required": [
          "attachment_id",
          "filename",
          "size_bytes"
        ],
        "properties": {
          "attachment_id": {
            "$ref": "#/components/schemas/AttachmentId"
          },
          "filename": {
            "type": "string"
          },
          "size_bytes": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          }
        }
      },
      "ConversationData": {
        "type": "object",
        "description": "The selected topic, as a conversation.",
        "required": [
          "account_id",
          "thread_id",
          "subject",
          "shape",
          "state",
          "messages",
          "earlier_count",
          "composer"
        ],
        "properties": {
          "account_id": {
            "$ref": "#/components/schemas/AccountId"
          },
          "composer": {
            "$ref": "#/components/schemas/ComposerData"
          },
          "earlier_count": {
            "type": "integer",
            "format": "int32",
            "description": "Earlier messages left out of a long thread.",
            "minimum": 0
          },
          "messages": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ConversationMessageData"
            },
            "description": "Oldest first."
          },
          "shape": {
            "$ref": "#/components/schemas/ThreadShapeData"
          },
          "state": {
            "$ref": "#/components/schemas/TopicStateData"
          },
          "subject": {
            "type": "string"
          },
          "thread_id": {
            "$ref": "#/components/schemas/ThreadId"
          }
        }
      },
      "ConversationMessageData": {
        "type": "object",
        "description": "One message in a conversation, as its new text.",
        "required": [
          "message_id",
          "from",
          "from_me",
          "date",
          "text",
          "trimmed",
          "layout",
          "paragraphs"
        ],
        "properties": {
          "ask_quote": {
            "type": [
              "string",
              "null"
            ],
            "description": "The ask, verbatim, when this message makes it: clients highlight it."
          },
          "attachments": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ConversationAttachmentData"
            }
          },
          "date": {
            "type": "string",
            "format": "date-time"
          },
          "from": {
            "$ref": "#/components/schemas/Address"
          },
          "from_me": {
            "type": "boolean"
          },
          "has_preserved_context": {
            "type": "boolean",
            "description": "Preserved question, quote or forwarded source context is part of this\nmessage; clients must keep the whole text visible when excerpting."
          },
          "layout": {
            "$ref": "#/components/schemas/MessageLayoutData"
          },
          "message_id": {
            "$ref": "#/components/schemas/MessageId"
          },
          "only_quoted": {
            "type": "boolean",
            "description": "Nothing but quoted text: `text` is the \"(only quoted text)\"\nplaceholder, and the message as sent is the way to read it."
          },
          "paragraphs": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "source": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/MessageTextSourceData",
                "description": "Missing in older daemon payloads; clients must treat that as unknown."
              },
              {
                "type": "null"
              }
            ]
          },
          "text": {
            "type": "string",
            "description": "The new text in every client: signatures and trailing history removed,\nwith inline questions or forwarded context retained beside answers."
          },
          "trimmed": {
            "$ref": "#/components/schemas/TrimmedData"
          },
          "trimmed_label": {
            "type": [
              "string",
              "null"
            ],
            "description": "\"trimmed: quote, sig\", when something was removed. `o` (or `v`)\nshows the message as sent."
          }
        }
      },
      "CorrectionData": {
        "type": "object",
        "description": "One stored correction.",
        "required": [
          "id",
          "account_id",
          "scope",
          "sender_email",
          "from_mode",
          "to_mode",
          "source",
          "created_at"
        ],
        "properties": {
          "account_id": {
            "$ref": "#/components/schemas/AccountId"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "from_mode": {
            "type": "string"
          },
          "id": {
            "type": "integer",
            "format": "int64"
          },
          "message_id": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/MessageId"
              },
              {
                "type": "null"
              }
            ]
          },
          "rule": {
            "type": [
              "string",
              "null"
            ]
          },
          "scope": {
            "type": "string",
            "description": "`email` or `sender`."
          },
          "sender_email": {
            "type": "string"
          },
          "source": {
            "type": "string",
            "description": "`move`, `sender` or `not_sure`."
          },
          "to_mode": {
            "type": "string"
          },
          "undone_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          }
        }
      },
      "DaemonEvent": {
        "oneOf": [
          {
            "type": "object",
            "required": [
              "boot_id",
              "deadline_at",
              "event"
            ],
            "properties": {
              "boot_id": {
                "type": "string"
              },
              "deadline_at": {
                "type": "integer",
                "format": "int64"
              },
              "event": {
                "type": "string",
                "enum": [
                  "ServerStopping"
                ]
              }
            }
          },
          {
            "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"
                },
                "description": "The newest arrivals, capped so one event always fits an IPC frame.\nA large initial backfill carries a sample, not the whole batch."
              },
              "event": {
                "type": "string",
                "enum": [
                  "NewMessages"
                ]
              },
              "total": {
                "type": "integer",
                "description": "How many messages actually arrived. Equal to `envelopes.len()` for\nan ordinary sync; larger when the batch was capped. Additive with a\nserde default so an older client still decodes the event.\n\nThe default cuts the other way too: an event from a pre-0.6.25\ndaemon carries no `total` and so decodes as `0`, which is smaller\nthan the `envelopes` it shipped with. Readers must treat\n`envelopes.len()` as the floor (`total.max(envelopes.len())`)\nrather than reporting the zero.",
                "minimum": 0
              }
            }
          },
          {
            "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": [
                  {
                    "$ref": "#/components/schemas/AccountId"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "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": [
                  {
                    "$ref": "#/components/schemas/AccountId"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "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": [
                  {
                    "$ref": "#/components/schemas/AccountId"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "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": [
                  {
                    "$ref": "#/components/schemas/AccountId"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "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": [
                  {
                    "$ref": "#/components/schemas/AccountId"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "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
              }
            }
          },
          {
            "type": "object",
            "description": "A list-row gist queued by `Request::GetThreadGists { generate: true }`\nis written (always `status: ready`).",
            "required": [
              "gist",
              "event"
            ],
            "properties": {
              "event": {
                "type": "string",
                "enum": [
                  "ThreadGistReady"
                ]
              },
              "gist": {
                "$ref": "#/components/schemas/ThreadGistData"
              }
            }
          },
          {
            "type": "object",
            "description": "A timed reply later came back: the message is in the reply queue\nagain and its conversation on the desk. Sent once per return, even\nacross restarts.",
            "required": [
              "message_id",
              "event"
            ],
            "properties": {
              "event": {
                "type": "string",
                "enum": [
                  "ReplyLaterReturned"
                ]
              },
              "message_id": {
                "$ref": "#/components/schemas/MessageId"
              }
            }
          },
          {
            "type": "object",
            "description": "Where mail sits changed: an email or a sender was moved, a move was\nundone, or new arrivals were placed. Clients refetch their modes,\nNow and Inbox's chips.\nAn assistant conversation changed: a message was added, a call\nstarted, or the turn settled. Clients refetch the conversation.",
            "required": [
              "conversation_id",
              "status",
              "event"
            ],
            "properties": {
              "conversation_id": {
                "type": "string"
              },
              "event": {
                "type": "string",
                "enum": [
                  "AssistantUpdated"
                ]
              },
              "progress": {
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/AssistantProgressData"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "status": {
                "$ref": "#/components/schemas/AssistantStatusData"
              }
            }
          },
          {
            "type": "object",
            "required": [
              "event"
            ],
            "properties": {
              "account_id": {
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/AccountId"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "event": {
                "type": "string",
                "enum": [
                  "ModesChanged"
                ]
              }
            }
          },
          {
            "type": "object",
            "description": "An account's owned addresses changed: an alias was added or removed, or\nthe primary moved. Clients that cache anything built from the owned set\n(such as prepared reply recipients) must drop it.",
            "required": [
              "account_id",
              "event"
            ],
            "properties": {
              "account_id": {
                "$ref": "#/components/schemas/AccountId"
              },
              "event": {
                "type": "string",
                "enum": [
                  "AccountAddressesChanged"
                ]
              }
            }
          },
          {
            "type": "object",
            "description": "A rebuild of the contacts table committed (after the debounce that\nfollows an address change, a sync pass or a manual refresh). Clients\nshowing analytics or contacts refetch them; the counts they hold are\nfrom before the rebuild. Names no account because the rebuild covers\nevery account.",
            "required": [
              "event"
            ],
            "properties": {
              "event": {
                "type": "string",
                "enum": [
                  "ContactsRefreshed"
                ]
              }
            }
          },
          {
            "type": "object",
            "description": "Any event this build has no variant for, so a client built from here on\nskips a newer daemon's later events instead of failing to decode the\nframe and dropping the connection. The daemon never sends it. Clients\nignore it.",
            "required": [
              "event"
            ],
            "properties": {
              "event": {
                "type": "string",
                "enum": [
                  "Unknown"
                ]
              }
            }
          }
        ]
      },
      "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"
            ]
          }
        }
      },
      "DeferKindData": {
        "type": "string",
        "description": "How a conversation is deferred, decided by who wrote last (the desk's\nown rule).",
        "enum": [
          "reply_later",
          "waiting"
        ]
      },
      "DeferredThreadData": {
        "type": "object",
        "description": "What deferring one conversation did, or with `dry_run` would do.",
        "required": [
          "thread_id"
        ],
        "properties": {
          "account_id": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/AccountId",
                "description": "Absent when the conversation was not found."
              },
              {
                "type": "null"
              }
            ]
          },
          "error": {
            "type": [
              "string",
              "null"
            ],
            "description": "Why this conversation was not deferred. The others still are."
          },
          "kind": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/DeferKindData",
                "description": "Absent when the conversation could not be deferred (see `error`)."
              },
              {
                "type": "null"
              }
            ]
          },
          "message_id": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/MessageId",
                "description": "The message the time is set on: their latest message for reply\nlater, yours for waiting."
              },
              {
                "type": "null"
              }
            ]
          },
          "thread_id": {
            "$ref": "#/components/schemas/ThreadId"
          }
        }
      },
      "DeleteCategoryBody": {
        "type": "object",
        "properties": {
          "category_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "preview_token": {
            "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": [
              {
                "$ref": "#/components/schemas/ThreadId",
                "description": "Latest contributing thread, for \"open in mailbox\"."
              },
              {
                "type": "null"
              }
            ]
          },
          "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)."
          },
          "model_calls": {
            "type": "integer",
            "format": "int32",
            "description": "Messages this scan sent to the model, or on a dry run would send on\na working endpoint. A message the model was not asked about (paused,\nbacking off, privacy-blocked) does not count.",
            "minimum": 0
          },
          "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
          }
        }
      },
      "DeskDoneBody": {
        "type": "object",
        "description": "Body of `POST /api/v1/mail/desk/done`.",
        "required": [
          "items"
        ],
        "properties": {
          "dry_run": {
            "type": [
              "boolean",
              "null"
            ],
            "description": "Preview only; nothing changes."
          },
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/DeskDoneItemData"
            }
          }
        }
      },
      "DeskDoneItemData": {
        "type": "object",
        "description": "One desk item to mark done: \"nothing for me to do here, put it away\".",
        "required": [
          "thread_id"
        ],
        "properties": {
          "commitment_id": {
            "type": [
              "string",
              "null"
            ],
            "description": "A promise under Due: Done resolves it. Required for `due`."
          },
          "lane": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/DeskLaneKind",
                "description": "The lane the row is in. Omitted: `waiting` when you wrote last,\notherwise `owed`, by the desk's own rule."
              },
              {
                "type": "null"
              }
            ]
          },
          "thread_id": {
            "$ref": "#/components/schemas/ThreadId"
          }
        }
      },
      "DeskDoneOutcomeData": {
        "type": "object",
        "description": "What Done did to one item, or with `dry_run` would do.",
        "required": [
          "thread_id",
          "lane",
          "archived",
          "marked_read",
          "dismissed"
        ],
        "properties": {
          "account_id": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/AccountId",
                "description": "Absent when the conversation was not found."
              },
              {
                "type": "null"
              }
            ]
          },
          "archived": {
            "type": "integer",
            "format": "int32",
            "description": "Messages taken out of the inbox (You owe and New from people only).",
            "minimum": 0
          },
          "dismissed": {
            "type": "boolean",
            "description": "Kept off the desk until someone writes in the conversation again."
          },
          "error": {
            "type": [
              "string",
              "null"
            ],
            "description": "Why this item was not done. Other items still are; running Done\nagain retries it."
          },
          "lane": {
            "$ref": "#/components/schemas/DeskLaneKind"
          },
          "marked_read": {
            "type": "integer",
            "format": "int32",
            "description": "Messages marked read.",
            "minimum": 0
          },
          "reminders_cancelled": {
            "type": "integer",
            "format": "int32",
            "description": "Pending \"bring it back if no reply\" reminders cancelled, so the\nconversation doesn't come back on its own.",
            "minimum": 0
          },
          "reply_later_cleared": {
            "type": "integer",
            "format": "int32",
            "description": "Messages taken out of the reply-later queue.",
            "minimum": 0
          },
          "resolved_commitment_id": {
            "type": [
              "string",
              "null"
            ],
            "description": "The promise resolved (Due only). Other open promises on the\nconversation still show under Due."
          },
          "thread_id": {
            "$ref": "#/components/schemas/ThreadId"
          }
        }
      },
      "DeskElsewhereData": {
        "type": "object",
        "description": "Counts for everything that is not on the desk, for the one-line summary.",
        "required": [
          "reading",
          "paper_trail",
          "deliveries",
          "invites",
          "screener"
        ],
        "properties": {
          "deliveries": {
            "type": "integer",
            "format": "int32",
            "description": "Deliveries that have not arrived and were not dismissed.",
            "minimum": 0
          },
          "invites": {
            "type": "integer",
            "format": "int32",
            "description": "Upcoming invites you have not answered.",
            "minimum": 0
          },
          "paper_trail": {
            "type": "integer",
            "format": "int32",
            "description": "Inbox mail from automated senders (receipts, notifications) in the\nrecent window.",
            "minimum": 0
          },
          "reading": {
            "type": "integer",
            "format": "int32",
            "description": "Inbox mail from newsletters and lists in the recent window, read or\nnot: never an unread count.",
            "minimum": 0
          },
          "screener": {
            "type": "integer",
            "format": "int32",
            "description": "Senders with recent mail and no screener decision. Across every\naccount it is the count of `screener_account` alone, the one queue\nthe Screener page opens, so the badge equals that page.",
            "minimum": 0
          },
          "screener_account": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/AccountId",
                "description": "The first account (in account order) with senders waiting on a\nscreener decision, so a link from an all-accounts desk opens a queue\nthat has them."
              },
              {
                "type": "null"
              }
            ]
          }
        }
      },
      "DeskLaneData": {
        "type": "object",
        "description": "One lane: the rows returned (capped by the request's `lane_limit`) and\nhow many there are in total.",
        "required": [
          "rows",
          "total"
        ],
        "properties": {
          "rows": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/DeskRowData"
            }
          },
          "total": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          }
        }
      },
      "DeskLaneKind": {
        "type": "string",
        "description": "Which part of the desk a row belongs to. A thread appears in at most one\nlane; when it qualifies for several, the earlier lane in this order wins.",
        "enum": [
          "owed",
          "due",
          "waiting",
          "people_new"
        ]
      },
      "DeskLaterBody": {
        "type": "object",
        "description": "Body of `POST /api/v1/mail/desk/later`.",
        "required": [
          "thread_ids",
          "until"
        ],
        "properties": {
          "dry_run": {
            "type": [
              "boolean",
              "null"
            ],
            "description": "Preview only; nothing changes."
          },
          "thread_ids": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "until": {
            "type": "string",
            "description": "The instant the client previewed, as RFC3339. Never a phrase: resolve\nit with `/api/v1/mail/time/resolve` and send the chosen `at`."
          }
        }
      },
      "DeskRowData": {
        "type": "object",
        "description": "One row on the desk: a thread, who it is with, and why it is here.",
        "required": [
          "lane",
          "account_id",
          "thread_id",
          "message_id",
          "message_ids",
          "counterparty_email",
          "subject",
          "reason",
          "since",
          "age_seconds"
        ],
        "properties": {
          "account_id": {
            "$ref": "#/components/schemas/AccountId"
          },
          "age_seconds": {
            "type": "integer",
            "format": "int64",
            "description": "Seconds from `since` to `generated_at`. Negative for a promise that\nis not due yet."
          },
          "back_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "The row is back because a time you set came: reply later on You\nowe, \"bring it back if no reply\" on Waiting on. The time you set."
          },
          "commitment_id": {
            "type": [
              "string",
              "null"
            ],
            "description": "Due rows: the promise's id, for resolving it."
          },
          "counterparty_email": {
            "type": "string"
          },
          "counterparty_name": {
            "type": [
              "string",
              "null"
            ]
          },
          "lane": {
            "$ref": "#/components/schemas/DeskLaneKind"
          },
          "message_id": {
            "$ref": "#/components/schemas/MessageId",
            "description": "The message to open: the latest inbound message for owed and\npeople-new rows, your latest message for waiting rows, the promise's\nevidence message for due rows."
          },
          "message_ids": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/MessageId"
            },
            "description": "Every message of the thread in this account, so a verb on the row\n(archive, snooze) covers the whole conversation."
          },
          "overdue": {
            "type": "boolean",
            "description": "True when the row is past the person's usual pace, or past its due date."
          },
          "reason": {
            "type": "string",
            "description": "A short human reason, e.g. \"replied to your message\"."
          },
          "since": {
            "type": "string",
            "format": "date-time",
            "description": "When the clock for this row started: their message for owed and\npeople-new, your message for waiting, the due date for due."
          },
          "starred": {
            "type": "boolean",
            "description": "Any message in the conversation is starred."
          },
          "subject": {
            "type": "string"
          },
          "thread_id": {
            "$ref": "#/components/schemas/ThreadId"
          },
          "unread": {
            "type": "boolean"
          },
          "usual_samples": {
            "type": "integer",
            "format": "int32",
            "description": "How many past replies `usual_seconds` is based on.",
            "minimum": 0
          },
          "usual_seconds": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64",
            "description": "The usual time for the relevant reply with this person: yours to them\non owed rows, theirs to you on waiting rows. Median of past replies."
          }
        }
      },
      "DeskThreadRefData": {
        "type": "object",
        "description": "A conversation, named with its account.",
        "required": [
          "account_id",
          "thread_id"
        ],
        "properties": {
          "account_id": {
            "$ref": "#/components/schemas/AccountId"
          },
          "thread_id": {
            "$ref": "#/components/schemas/ThreadId"
          }
        }
      },
      "DetectComposePromisesRequest": {
        "type": "object",
        "required": [
          "draft_path",
          "account_id"
        ],
        "properties": {
          "account_id": {
            "type": "string"
          },
          "draft_path": {
            "type": "string",
            "description": "The compose session file, as the other compose routes take it."
          },
          "time_zone": {
            "type": [
              "string",
              "null"
            ],
            "description": "The browser's IANA zone, so \"by Friday\" resolves where the user is."
          }
        }
      },
      "DetectedPromiseData": {
        "type": "object",
        "required": [
          "what"
        ],
        "properties": {
          "due": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/TimeResolution",
                "description": "`due_phrase` resolved by the natural-time parser in the caller's\nzone. None when the phrase names no date the parser understands."
              },
              {
                "type": "null"
              }
            ]
          },
          "due_phrase": {
            "type": [
              "string",
              "null"
            ],
            "description": "When it is due, copied from the message (\"by Friday\"). Checked\nagainst the text, so it is never the model's invention."
          },
          "what": {
            "type": "string",
            "description": "The deliverable as a short clause, such as \"send the deck\"."
          }
        }
      },
      "DiscardedComposeResponse": {
        "type": "object",
        "required": [
          "ok"
        ],
        "properties": {
          "ok": {
            "type": "boolean"
          }
        }
      },
      "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": {
          "address_cache_stale": {
            "type": "boolean",
            "description": "The daemon's account-address registry failed its last rebuild, so sync\nwrites Unknown direction until it recovers. False from a daemon that\npredates the field, and from a report built without a running daemon."
          },
          "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": [
              {
                "$ref": "#/components/schemas/FeatureHealthReport"
              },
              {
                "type": "null"
              }
            ]
          },
          "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"
          },
          "history_retention_days": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int32",
            "description": "`logging.event_retention_days` as the daemon reads the config file now.\n`None` from a daemon that predates the field, or when the file cannot be\nread or parsed.",
            "minimum": 0
          },
          "html_helper": {
            "$ref": "#/components/schemas/HtmlHelperStats",
            "description": "Counts for the process that parses mail HTML for this daemon. All zero\nfrom a daemon that predates it, and from a report built without a\nrunning daemon."
          },
          "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
          },
          "log_total_bytes": {
            "type": "integer",
            "format": "int64",
            "description": "Active log plus rotated archives. `log_size_bytes` stays active-file only.",
            "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_history": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AccountSyncHistory"
            },
            "description": "Per-account `sync_log` summary. Empty from a daemon that predates it."
          },
          "sync_statuses": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AccountSyncStatus"
            }
          }
        }
      },
      "Draft": {
        "allOf": [
          {
            "$ref": "#/components/schemas/DraftContentSchema",
            "description": "The body, as either a markdown source or a supplied HTML document.\nFlattened so the JSON stays flat: `body_markdown`, or\n`body_html`+`body_text`."
          },
          {
            "type": "object",
            "required": [
              "id",
              "account_id",
              "to",
              "cc",
              "bcc",
              "subject",
              "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"
                }
              },
              "cc": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/Address"
                }
              },
              "created_at": {
                "type": "string",
                "format": "date-time"
              },
              "from": {
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/Address",
                    "description": "Per-message From override. `None` sends from the account's primary\naddress (default). `Some(addr)` sends from a specific owned address\n(the primary or a registered alias); the daemon validates ownership at\nsend time and rejects a `from` the account does not own. The name falls\nback to the account's display name when the override carries none."
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "id": {
                "$ref": "#/components/schemas/DraftId"
              },
              "inline_assets": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/InlineAsset"
                },
                "description": "CID-referenced inline images for an HTML body. Always empty for a\nmarkdown draft."
              },
              "inline_calendar_reply": {
                "oneOf": [
                  {
                    "$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."
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "intent": {
                "$ref": "#/components/schemas/DraftIntent"
              },
              "managed_attachments": {
                "type": [
                  "array",
                  "null"
                ],
                "items": {
                  "$ref": "#/components/schemas/DraftAttachment"
                },
                "description": "None identifies old clients; Some(empty) explicitly removes managed resources."
              },
              "reply_headers": {
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/ReplyHeaders"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "revision": {
                "type": [
                  "integer",
                  "null"
                ],
                "format": "int64",
                "description": "Durable local content revision; absent only for unsaved or legacy drafts."
              },
              "subject": {
                "type": "string"
              },
              "to": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/Address"
                }
              },
              "updated_at": {
                "type": "string",
                "format": "date-time"
              }
            }
          }
        ]
      },
      "DraftAttachment": {
        "type": "object",
        "description": "Immutable daemon-owned bytes belonging to one saved draft.",
        "required": [
          "id",
          "draft_id",
          "account_id",
          "filename",
          "mime_type",
          "length_bytes",
          "sha256"
        ],
        "properties": {
          "account_id": {
            "$ref": "#/components/schemas/AccountId"
          },
          "content_id": {
            "type": [
              "string",
              "null"
            ],
            "description": "Original Content-ID of a related forwarded MIME part."
          },
          "content_location": {
            "type": [
              "string",
              "null"
            ],
            "description": "Original MIME location for related parts whose HTML uses a relative URL."
          },
          "draft_id": {
            "$ref": "#/components/schemas/DraftId"
          },
          "filename": {
            "type": "string"
          },
          "id": {
            "$ref": "#/components/schemas/DraftAttachmentId"
          },
          "length_bytes": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "mime_type": {
            "type": "string"
          },
          "sha256": {
            "type": "string"
          }
        }
      },
      "DraftAttachmentId": {
        "type": "string",
        "format": "uuid"
      },
      "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"
          }
        }
      },
      "DraftConflictDetails": {
        "type": "object",
        "properties": {
          "current_revision": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64"
          },
          "expected_revision": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64"
          }
        }
      },
      "DraftConflictResponse": {
        "type": "object",
        "required": [
          "error",
          "code"
        ],
        "properties": {
          "accepted_draft": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/AcceptedComposeDraft"
              },
              {
                "type": "null"
              }
            ]
          },
          "code": {
            "type": "string"
          },
          "details": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/DraftConflictDetails"
              },
              {
                "type": "null"
              }
            ]
          },
          "error": {
            "type": "string"
          },
          "recovery_session": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/RecoveredComposeSession"
              },
              {
                "type": "null"
              }
            ]
          }
        }
      },
      "DraftContentSchema": {
        "type": "object",
        "description": "Documents the flattened [`DraftContent`] wire shape for OpenAPI.\n\n`DraftContent` hand-rolls its serde impls to stay backward compatible, so\na derived schema on the enum itself would describe the Rust shape rather\nthan the JSON. This mirrors what actually goes over the wire.",
        "properties": {
          "body_html": {
            "type": [
              "string",
              "null"
            ],
            "description": "Present on HTML drafts. Mutually exclusive with `body_markdown`."
          },
          "body_markdown": {
            "type": [
              "string",
              "null"
            ],
            "description": "Present on markdown drafts."
          },
          "body_text": {
            "type": [
              "string",
              "null"
            ],
            "description": "Optional `text/plain` alternative supplied alongside `body_html`."
          }
        }
      },
      "DraftEvalCaseData": {
        "type": "object",
        "description": "One replayed reply from `mxr draft eval`: the draft the model wrote from\nwhat was known just before the user replied, next to what they sent.\nLocal only; never recorded in the activity log.",
        "required": [
          "reply_message_id",
          "counterparty",
          "actual",
          "draft",
          "actual_words",
          "draft_words",
          "greeting_match",
          "sign_off_match",
          "invented_numbers",
          "placeholders"
        ],
        "properties": {
          "actual": {
            "type": "string"
          },
          "actual_words": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "counterparty": {
            "type": "string"
          },
          "draft": {
            "type": "string"
          },
          "draft_words": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "error": {
            "type": [
              "string",
              "null"
            ]
          },
          "greeting_match": {
            "type": "boolean",
            "description": "Both open the same way (or neither greets)."
          },
          "invented_numbers": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Numbers in the draft that appear nowhere the model could see."
          },
          "placeholders": {
            "type": "integer",
            "format": "int32",
            "description": "`[[?: …]]` gaps the model left for the user.",
            "minimum": 0
          },
          "reply_message_id": {
            "$ref": "#/components/schemas/MessageId"
          },
          "sign_off_match": {
            "type": "boolean",
            "description": "Both close the same way (or neither signs off)."
          }
        }
      },
      "DraftEvalCheckCountData": {
        "type": "object",
        "description": "Passes and evaluations for one check across the set.",
        "required": [
          "check",
          "passed",
          "evaluated"
        ],
        "properties": {
          "check": {
            "type": "string"
          },
          "evaluated": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "passed": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          }
        }
      },
      "DraftEvalCheckData": {
        "type": "object",
        "description": "One check on one draft: what it required and what the draft did.",
        "required": [
          "check",
          "pass",
          "requirement",
          "detail"
        ],
        "properties": {
          "check": {
            "type": "string",
            "description": "`kept`, `answers`, `gaps`, `invented`, `length` or `leftovers`."
          },
          "detail": {
            "type": "string"
          },
          "pass": {
            "type": "boolean"
          },
          "requirement": {
            "type": "string"
          }
        }
      },
      "DraftEvalQuickCaseData": {
        "type": "object",
        "description": "One corpus case drafted by the configured model and graded.",
        "required": [
          "id",
          "description",
          "draft",
          "words",
          "checks",
          "style_score"
        ],
        "properties": {
          "checks": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/DraftEvalCheckData"
            }
          },
          "description": {
            "type": "string"
          },
          "draft": {
            "type": "string",
            "description": "The draft the user would see, after clean-up."
          },
          "error": {
            "type": [
              "string",
              "null"
            ]
          },
          "id": {
            "type": "string"
          },
          "style_score": {
            "type": "integer",
            "format": "int32",
            "description": "Humanizer score: 100 reads plain, lower reads more like a model wrote it.\nReported, not graded.",
            "minimum": 0
          },
          "words": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          }
        }
      },
      "DraftEvalQuickSummaryData": {
        "type": "object",
        "required": [
          "cases",
          "errors",
          "checks",
          "style_mean",
          "model"
        ],
        "properties": {
          "cases": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "checks": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/DraftEvalCheckCountData"
            }
          },
          "errors": {
            "type": "integer",
            "format": "int32",
            "description": "Cases the model failed to draft; they are not graded.",
            "minimum": 0
          },
          "model": {
            "type": "string"
          },
          "style_mean": {
            "type": "number",
            "format": "double",
            "description": "Mean style score over the drafted cases (0 when none drafted)."
          }
        }
      },
      "DraftEvalSummaryData": {
        "type": "object",
        "required": [
          "cases",
          "failed",
          "median_length_ratio",
          "greeting_match_rate",
          "sign_off_match_rate",
          "invented_number_rate",
          "model"
        ],
        "properties": {
          "cases": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "failed": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "greeting_match_rate": {
            "type": "number",
            "format": "double"
          },
          "invented_number_rate": {
            "type": "number",
            "format": "double",
            "description": "Share of drafts with at least one invented number."
          },
          "median_length_ratio": {
            "type": "number",
            "format": "double",
            "description": "Median of draft words / actual words (1.0 is the user's length)."
          },
          "model": {
            "type": "string"
          },
          "sign_off_match_rate": {
            "type": "number",
            "format": "double"
          }
        }
      },
      "DraftId": {
        "type": "string",
        "format": "uuid"
      },
      "DraftIntent": {
        "type": "string",
        "enum": [
          "new",
          "reply",
          "reply_all",
          "forward"
        ]
      },
      "DraftLengthHintData": {
        "type": "string",
        "enum": [
          "short",
          "medium",
          "long"
        ]
      },
      "DraftProvenanceData": {
        "type": "object",
        "description": "Where an AI draft came from: the model that actually answered, whether\nthe user's other mail reached it, and the messages it read, so clients\ncan say so and open each source. Describes the request as it ran (the\nprovider pinned for it), not the configuration.",
        "required": [
          "model",
          "locality",
          "history_used"
        ],
        "properties": {
          "conversation": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/DraftSourceData"
            },
            "description": "Messages of the conversation being answered that fit in the prompt,\noldest first. Empty for a new message or a refine."
          },
          "history_used": {
            "type": "boolean",
            "description": "Something from the user's other mail reached the model: their past\nemails, the writing habits drawn from them, or the relationship\nsummary. False when the privacy gate kept it back (a cloud model\nwithout `llm.allow_cloud_relationship_data`) or there was none."
          },
          "locality": {
            "$ref": "#/components/schemas/AiLocalityData"
          },
          "model": {
            "type": "string",
            "description": "The model that wrote the draft, as its endpoint named it."
          },
          "rewrite": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/DraftRewriteProvenanceData",
                "description": "The humanizer's second model pass (to read less machine-made): who\nran it and whether its text was used. Absent when no pass was due."
              },
              {
                "type": "null"
              }
            ]
          },
          "voice_examples": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/DraftSourceData"
            },
            "description": "The user's own past emails the model was shown to copy their voice,\nin the order the prompt carried them."
          }
        }
      },
      "DraftRefineKnobsData": {
        "type": "object",
        "properties": {
          "add_context": {
            "type": [
              "string",
              "null"
            ]
          },
          "less_emoji": {
            "type": "boolean"
          },
          "more_formal": {
            "type": "boolean"
          },
          "shorter": {
            "type": "boolean"
          },
          "warmer": {
            "type": "boolean"
          }
        }
      },
      "DraftRewriteOutcomeData": {
        "type": "string",
        "enum": [
          "applied",
          "rejected",
          "skipped"
        ]
      },
      "DraftRewriteProvenanceData": {
        "type": "object",
        "description": "The model pass that rewrites a draft after it was written.",
        "required": [
          "model",
          "locality",
          "history_used"
        ],
        "properties": {
          "history_used": {
            "type": "boolean",
            "description": "The rewrite saw the user's habits and past emails, to keep the voice."
          },
          "locality": {
            "$ref": "#/components/schemas/AiLocalityData"
          },
          "model": {
            "type": "string",
            "description": "The model that answered the rewrite (or would have, when skipped)."
          },
          "outcome": {
            "$ref": "#/components/schemas/DraftRewriteOutcomeData"
          },
          "rejected_by": {
            "type": [
              "string",
              "null"
            ],
            "description": "A later pass, after the text that was kept, whose answer was\ndropped: this model saw the draft too."
          }
        }
      },
      "DraftSafetyContextData": {
        "type": "object",
        "properties": {
          "allow_llm": {
            "type": "boolean"
          },
          "mode": {
            "$ref": "#/components/schemas/DraftSafetyModeData"
          },
          "original_message_id": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/MessageId"
              },
              {
                "type": "null"
              }
            ]
          },
          "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": [
              {
                "$ref": "#/components/schemas/ThreadId"
              },
              {
                "type": "null"
              }
            ]
          }
        }
      },
      "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",
          "unfilled_gap"
        ]
      },
      "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"
        ]
      },
      "DraftSendOutcome": {
        "type": "object",
        "description": "Durable evidence independent of a live draft or a local Sent message.",
        "required": [
          "identity",
          "draft_id",
          "account_id",
          "state"
        ],
        "properties": {
          "account_id": {
            "$ref": "#/components/schemas/AccountId"
          },
          "draft_id": {
            "$ref": "#/components/schemas/DraftId"
          },
          "identity": {
            "$ref": "#/components/schemas/SendIdentity"
          },
          "local_message_id": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/MessageId"
              },
              {
                "type": "null"
              }
            ]
          },
          "provider_message_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "recovery": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/SendRecoveryStatus"
              },
              {
                "type": "null"
              }
            ]
          },
          "rfc2822_message_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "state": {
            "$ref": "#/components/schemas/SendOutcomeState"
          }
        }
      },
      "DraftSourceData": {
        "type": "object",
        "description": "One message a draft was written from, in the user's own mailbox.",
        "required": [
          "message_id",
          "thread_id",
          "date",
          "from_me",
          "person"
        ],
        "properties": {
          "date": {
            "type": "string",
            "format": "date-time"
          },
          "from_me": {
            "type": "boolean",
            "description": "The user sent it."
          },
          "message_id": {
            "$ref": "#/components/schemas/MessageId"
          },
          "person": {
            "type": "string",
            "description": "The other person's address: who the user wrote to, or who wrote it."
          },
          "person_name": {
            "type": [
              "string",
              "null"
            ]
          },
          "thread_id": {
            "$ref": "#/components/schemas/ThreadId"
          }
        }
      },
      "DraftTargetData": {
        "oneOf": [
          {
            "type": "object",
            "required": [
              "draft_id",
              "kind"
            ],
            "properties": {
              "draft_id": {
                "$ref": "#/components/schemas/DraftId"
              },
              "kind": {
                "type": "string",
                "enum": [
                  "stored"
                ]
              }
            }
          },
          {
            "type": "object",
            "required": [
              "message_id",
              "all",
              "kind"
            ],
            "properties": {
              "all": {
                "type": "boolean"
              },
              "kind": {
                "type": "string",
                "enum": [
                  "reply"
                ]
              },
              "message_id": {
                "$ref": "#/components/schemas/MessageId"
              }
            }
          },
          {
            "type": "object",
            "required": [
              "message_id",
              "to",
              "kind"
            ],
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "forward"
                ]
              },
              "message_id": {
                "$ref": "#/components/schemas/MessageId"
              },
              "to": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/Address"
                }
              }
            }
          },
          {
            "type": "object",
            "required": [
              "account_id",
              "to",
              "subject",
              "kind"
            ],
            "properties": {
              "account_id": {
                "$ref": "#/components/schemas/AccountId"
              },
              "kind": {
                "type": "string",
                "enum": [
                  "new"
                ]
              },
              "subject": {
                "type": "string"
              },
              "to": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/Address"
                }
              }
            }
          }
        ],
        "description": "The draft a writing request is about. A stored draft is read from the\ndatabase; the other targets name the thing that does not exist yet, so a\nclient can ask for help before the first save."
      },
      "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": [
              {
                "$ref": "#/components/schemas/AccountId"
              },
              {
                "type": "null"
              }
            ]
          },
          "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"
          },
          "search": {
            "$ref": "#/components/schemas/FeatureHealth",
            "description": "Lexical (tantivy) search. `Degraded` once the index worker has stopped:\nsearch stays dead for the rest of the daemon's life, and nothing else\nreports it. Defaulted so a daemon older than this field still\ndeserializes — such a daemon had no way to report the failure, which is\nindistinguishable from healthy on the wire."
          },
          "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"
          },
          "source": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/ForwardSource"
              },
              {
                "type": "null"
              }
            ]
          },
          "subject": {
            "type": "string"
          }
        }
      },
      "ForwardSource": {
        "type": "object",
        "description": "Immutable original content prepared by the daemon for a forward. The editor\nedits only the introduction; original HTML and attachment bytes stay intact.",
        "required": [
          "draft_id",
          "account_id",
          "message_id",
          "content",
          "attachments"
        ],
        "properties": {
          "account_id": {
            "$ref": "#/components/schemas/AccountId"
          },
          "attachments": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/DraftAttachment"
            }
          },
          "content": {
            "$ref": "#/components/schemas/DraftContentSchema"
          },
          "draft_id": {
            "$ref": "#/components/schemas/DraftId"
          },
          "message_id": {
            "$ref": "#/components/schemas/MessageId"
          }
        }
      },
      "FreshnessData": {
        "type": "object",
        "description": "Returned by `Request::GetFreshness`.",
        "required": [
          "generated_at",
          "stale_after_secs",
          "accounts",
          "arrivals"
        ],
        "properties": {
          "accounts": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AccountFreshnessData"
            }
          },
          "arrivals": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ArrivalData"
            },
            "description": "Newest first."
          },
          "generated_at": {
            "type": "string",
            "format": "date-time"
          },
          "newest_message_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "The newest message received in scope, any mailbox, any mode."
          },
          "stale_after_secs": {
            "type": "integer",
            "format": "int64",
            "description": "An account whose last good sync is older than this is stale.",
            "minimum": 0
          },
          "worst_account_id": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/AccountId",
                "description": "The account in the worst sync state: the one the scope's line is\nabout."
              },
              {
                "type": "null"
              }
            ]
          }
        }
      },
      "GapData": {
        "type": "object",
        "description": "A place the model could not fill, written `[[?: label]]` in the text.",
        "required": [
          "label",
          "start",
          "end"
        ],
        "properties": {
          "end": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "label": {
            "type": "string"
          },
          "start": {
            "type": "integer",
            "format": "int32",
            "description": "Byte range of the whole marker in the proposal text.",
            "minimum": 0
          }
        }
      },
      "GistModelData": {
        "type": "string",
        "enum": [
          "available",
          "disabled",
          "blocked"
        ]
      },
      "GmailCredentialSourceData": {
        "type": "string",
        "enum": [
          "bundled",
          "custom"
        ]
      },
      "HintData": {
        "type": "object",
        "description": "One hint as a client shows it: the copy, the key it names, and whether\nit was dismissed on this profile.",
        "required": [
          "id",
          "anchor",
          "text",
          "key",
          "seen"
        ],
        "properties": {
          "anchor": {
            "type": "string",
            "description": "The element it attaches to, for agents and the docs: \"the first\nrow's why line\"."
          },
          "id": {
            "type": "string",
            "description": "Stable across releases, since the seen state is keyed on it:\n\"now.from_mode\"."
          },
          "key": {
            "$ref": "#/components/schemas/ModeKeyData",
            "description": "The key the hint names, with its verb in this mode."
          },
          "seen": {
            "type": "boolean",
            "description": "Dismissed by Esc or by acting on the element, in any client."
          },
          "seen_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "text": {
            "type": "string",
            "description": "One sentence that names its key."
          }
        }
      },
      "HintSeenBody": {
        "type": "object",
        "description": "Body of `POST /api/v1/mail/hints/{hint}`.",
        "properties": {
          "seen": {
            "type": "boolean",
            "description": "True dismisses the hint in every client; false shows it again."
          }
        }
      },
      "HostAuthority": {
        "type": "object",
        "required": [
          "hosting_available"
        ],
        "properties": {
          "host_id": {
            "type": [
              "string",
              "null"
            ],
            "description": "Absent until the first pairing starts. Inspection never initializes authority."
          },
          "hosting_available": {
            "type": "boolean",
            "description": "Whether this build implements host serving; it does not report listener liveness."
          },
          "recovery_generation": {
            "type": [
              "string",
              "null"
            ]
          },
          "workspace_id": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "HtmlHelperStats": {
        "type": "object",
        "description": "How the HTML helper process has fared since its supervisor started. Counts\nonly; no message content.",
        "properties": {
          "deaths": {
            "type": "integer",
            "format": "int64",
            "default": 0,
            "minimum": 0
          },
          "fallbacks": {
            "type": "integer",
            "format": "int64",
            "description": "Requests answered with the plain-text fallback instead of a parse.",
            "default": 0,
            "minimum": 0
          },
          "installed": {
            "type": "boolean",
            "description": "Mail HTML is parsed in a helper process. False means in-process, or no\nrunning daemon to ask.",
            "default": false
          },
          "job_errors": {
            "type": "integer",
            "format": "int64",
            "default": 0,
            "minimum": 0
          },
          "requests": {
            "type": "integer",
            "format": "int64",
            "default": 0,
            "minimum": 0
          },
          "restarts": {
            "type": "integer",
            "format": "int64",
            "description": "Helpers started to replace one that timed out or died.",
            "default": 0,
            "minimum": 0
          },
          "timeouts": {
            "type": "integer",
            "format": "int64",
            "default": 0,
            "minimum": 0
          }
        }
      },
      "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
          }
        }
      },
      "ImpliedPart": {
        "type": "string",
        "description": "A part of the result the user did not type and the parser assumed.",
        "enum": [
          "date",
          "year",
          "time",
          "meridiem"
        ]
      },
      "IndexFreshness": {
        "type": "string",
        "enum": [
          "unknown",
          "current",
          "stale",
          "disabled",
          "indexing",
          "error",
          "repair_required"
        ]
      },
      "InlineAsset": {
        "type": "object",
        "description": "An image referenced from an HTML body by `<img src=\"cid:NAME\">`.\n\nOnly the path crosses IPC; the daemon reads the bytes at send time, the\nsame contract `Draft::attachments` uses. Keeping bytes off the wire matters\nbecause the IPC frame cap is 16 MiB.",
        "required": [
          "cid",
          "path"
        ],
        "properties": {
          "cid": {
            "type": "string",
            "description": "The `cid:` token the HTML references, without angle brackets."
          },
          "path": {
            "type": "string"
          }
        }
      },
      "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"
          }
        }
      },
      "InlineImageChunkData": {
        "type": "object",
        "required": [
          "offset",
          "total_length",
          "mime_type",
          "data_base64"
        ],
        "properties": {
          "data_base64": {
            "type": "string"
          },
          "mime_type": {
            "type": "string"
          },
          "offset": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "total_length": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          }
        }
      },
      "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": {
          "action": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/MutationCommand",
                "description": "What a selection job does to its messages, with `message_ids` empty.\nA repeated start under the same job id must name the same action."
              },
              {
                "type": "null"
              }
            ]
          },
          "error": {
            "type": [
              "string",
              "null"
            ]
          },
          "failure_count": {
            "type": "integer",
            "format": "int32",
            "description": "How many failure records the job holds. `ListJobs` leaves `failures`\n(and `undo_ids`) empty and says how many there are here; `GetJob`\ncarries them.",
            "minimum": 0
          },
          "failures": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/JobFailureData"
            },
            "description": "The first messages that failed, with why (at most 50); the exact total\nis in `progress.failed`."
          },
          "finished_at": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64"
          },
          "job_id": {
            "type": "string"
          },
          "kind": {
            "type": "string"
          },
          "paused_until": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64",
            "description": "Unix milliseconds. Set while the job waits out a provider rate limit;\nit resumes by itself."
          },
          "progress": {
            "$ref": "#/components/schemas/JobProgressData"
          },
          "result": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/MutationResultData"
              },
              {
                "type": "null"
              }
            ]
          },
          "selection": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/SelectionData",
                "description": "The selection a `StartSelectionJob` ran over."
              },
              {
                "type": "null"
              }
            ]
          },
          "started_at": {
            "type": "integer",
            "format": "int64"
          },
          "status": {
            "$ref": "#/components/schemas/JobStatusData"
          },
          "undo_id_count": {
            "type": "integer",
            "format": "int32",
            "description": "How many undo ids the job holds. `ListJobs` carries none; `GetJob`\ncarries them all, since clients undo a job's chunks from that list. A\nselection job (`StartSelectionJob`) has none: it cannot be undone.",
            "minimum": 0
          },
          "undo_ids": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "JobFailureData": {
        "type": "object",
        "description": "A message a job could not change, with why.",
        "required": [
          "message_id",
          "error"
        ],
        "properties": {
          "error": {
            "type": "string"
          },
          "message_id": {
            "$ref": "#/components/schemas/MessageId"
          }
        }
      },
      "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"
        ]
      },
      "KeyActionData": {
        "type": "object",
        "description": "One thing a key can do, and the keys each client binds it to.",
        "required": [
          "id",
          "label",
          "group",
          "clients"
        ],
        "properties": {
          "clients": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "`tui`, `web`, or both."
          },
          "description": {
            "type": [
              "string",
              "null"
            ]
          },
          "group": {
            "type": "string"
          },
          "id": {
            "type": "string"
          },
          "keys": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Web keys, primary first."
          },
          "label": {
            "type": "string"
          },
          "mac_keys": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Web keys bound on macOS only."
          },
          "note": {
            "type": [
              "string",
              "null"
            ],
            "description": "Why the clients' keys differ, when they do."
          },
          "palette_only": {
            "type": "boolean"
          },
          "scopes": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Web scopes the web keys are live in."
          },
          "tui": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TuiKeysData"
            }
          }
        }
      },
      "KeymapData": {
        "type": "object",
        "description": "Returned in `ResponseData::Keymap`: the definition with the person's\n`keys.toml` applied.",
        "required": [
          "actions"
        ],
        "properties": {
          "actions": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/KeyActionData"
            }
          },
          "problems": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "What in `keys.toml` mxr is ignoring, as sentences."
          },
          "remapped": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Ids of the actions whose keys the person changed (`[actions]`)."
          },
          "single_keys": {
            "type": "boolean",
            "description": "False when the person turned off every shortcut made of single\ncharacters (`single_keys = false`, WCAG 2.1.4). Clients then ignore\nthose keys outside text fields and overlays."
          }
        }
      },
      "KeysChangeData": {
        "oneOf": [
          {
            "type": "object",
            "description": "Give an action these keys, primary first, in every client; none\nleaves it to the palette.",
            "required": [
              "id",
              "keys",
              "kind"
            ],
            "properties": {
              "id": {
                "type": "string"
              },
              "keys": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "kind": {
                "type": "string",
                "enum": [
                  "set_action"
                ]
              }
            }
          },
          {
            "type": "object",
            "description": "Give an action back its default keys.",
            "required": [
              "id",
              "kind"
            ],
            "properties": {
              "id": {
                "type": "string"
              },
              "kind": {
                "type": "string",
                "enum": [
                  "reset_action"
                ]
              }
            }
          },
          {
            "type": "object",
            "description": "Turn single-character shortcuts on or off.",
            "required": [
              "on",
              "kind"
            ],
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "single_keys"
                ]
              },
              "on": {
                "type": "boolean"
              }
            }
          }
        ],
        "description": "A change to `keys.toml` (`Request::UpdateKeys`)."
      },
      "KeysUpdateData": {
        "type": "object",
        "description": "Returned in `ResponseData::KeysUpdate`.",
        "required": [
          "saved",
          "file",
          "problems",
          "keymap"
        ],
        "properties": {
          "file": {
            "type": "string",
            "description": "The `keys.toml` that was, or would be, written."
          },
          "keymap": {
            "$ref": "#/components/schemas/KeymapData",
            "description": "The key map with the change applied (when it has no problems)."
          },
          "problems": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Why the change can't be saved: a key another action has, a key a\nclient can't receive. Empty when it can."
          },
          "saved": {
            "type": "boolean",
            "description": "True when `keys.toml` was written: not a dry run, and no problems."
          }
        }
      },
      "KindRuleData": {
        "type": "string",
        "description": "Which rule decided a message's kind, most decisive first. `Decision`\nmeans the user moved the sender; everything else is automatic.",
        "enum": [
          "fallback",
          "decision",
          "delivery",
          "invite",
          "automated_address",
          "automated_domain",
          "newsletter_address",
          "newsletter_domain",
          "list_id",
          "list_unsubscribe",
          "no_reply_address",
          "transaction_alert",
          "role_address",
          "bulk_sender",
          "templated_sender",
          "list_sender",
          "person",
          "copied",
          "written_to",
          "moved",
          "custom_rule"
        ]
      },
      "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": [
              {
                "$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."
              },
              {
                "type": "null"
              }
            ]
          },
          "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"
          }
        }
      },
      "LlmBackfillHeldData": {
        "type": "object",
        "description": "How many inputs one background job held back from the model because\ntheir mail was backfilled.",
        "required": [
          "job",
          "inputs"
        ],
        "properties": {
          "inputs": {
            "type": "integer",
            "format": "int64",
            "description": "Distinct contacts, messages or to-do checks held back.",
            "minimum": 0
          },
          "job": {
            "type": "string",
            "description": "`relationship_summary`, `delivery_extraction` or `todo_resolution`."
          }
        }
      },
      "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"
          },
          "compose_model": {
            "type": [
              "string",
              "null"
            ]
          },
          "context_window": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "enabled": {
            "type": "boolean"
          },
          "model": {
            "type": "string"
          },
          "models": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "type": "string"
            }
          },
          "overrides": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/LlmOverridesData"
              },
              {
                "type": "null"
              }
            ]
          },
          "request_timeout_secs": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          }
        }
      },
      "LlmEndpointStatusData": {
        "type": "object",
        "description": "The user's own endpoint (`base_url`) as the first route of a fallback\nchain. It needs no stored key, so it has no provider.",
        "required": [
          "base_url",
          "model",
          "state",
          "next"
        ],
        "properties": {
          "base_url": {
            "type": "string",
            "description": "Empty in remote status, where endpoint addresses remain on the host."
          },
          "model": {
            "type": "string"
          },
          "next": {
            "type": "boolean",
            "description": "A request would go here now."
          },
          "reason": {
            "type": [
              "string",
              "null"
            ],
            "description": "Why it is out, e.g. `unreachable`. Fixed phrases only."
          },
          "retry_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "When a cooling or broken endpoint may be tried again."
          },
          "state": {
            "$ref": "#/components/schemas/LlmRouteStateData",
            "description": "Never `no_key`."
          }
        }
      },
      "LlmFailureKindData": {
        "type": "string",
        "enum": [
          "unreachable",
          "rate_limited",
          "timeout",
          "unauthorized",
          "empty",
          "other"
        ]
      },
      "LlmFeatureStatusData": {
        "type": "object",
        "description": "One AI feature's model and where its requests go.",
        "required": [
          "feature",
          "enabled",
          "model",
          "routed",
          "cloud"
        ],
        "properties": {
          "base_url": {
            "type": [
              "string",
              "null"
            ],
            "description": "The endpoint for a model that isn't routed."
          },
          "blocked": {
            "type": [
              "string",
              "null"
            ],
            "description": "Privacy settings keep this feature from its model."
          },
          "cloud": {
            "type": "boolean",
            "description": "Requests can leave this machine."
          },
          "enabled": {
            "type": "boolean"
          },
          "endpoint": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/LlmEndpointStatusData",
                "description": "`base_url`'s standing when `[llm.fallback]` stands behind it. Absent\nwithout a fallback."
              },
              {
                "type": "null"
              }
            ]
          },
          "fallback": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/LlmRouteStatusData"
            },
            "description": "The fallback model's routes, tried in order while `base_url` is out.\nEmpty without a fallback or when `fallback_withheld` says why."
          },
          "fallback_withheld": {
            "type": [
              "string",
              "null"
            ],
            "description": "Why this feature keeps to `base_url` although a fallback is\nconfigured: its data may not go to a cloud model."
          },
          "feature": {
            "type": "string",
            "description": "The feature's name, e.g. `summarize`."
          },
          "model": {
            "type": "string"
          },
          "routed": {
            "type": "boolean",
            "description": "The model goes through Anthropic and/or OpenRouter with stored keys\nrather than `llm.base_url`."
          },
          "routes": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/LlmRouteStatusData"
            },
            "description": "Routes in the order they are tried. Empty when not routed."
          }
        }
      },
      "LlmKeyChangeData": {
        "type": "object",
        "description": "The outcome of storing or removing a provider key.",
        "required": [
          "provider",
          "dry_run",
          "changed",
          "after"
        ],
        "properties": {
          "after": {
            "$ref": "#/components/schemas/LlmKeyStatusData",
            "description": "What the key status is after the change (or would be)."
          },
          "changed": {
            "type": "boolean",
            "description": "The store changed (or would have): a key was written or deleted."
          },
          "dry_run": {
            "type": "boolean",
            "description": "This was a preview: nothing was stored or removed."
          },
          "provider": {
            "$ref": "#/components/schemas/LlmProviderData"
          }
        }
      },
      "LlmKeySecret": {
        "type": "string",
        "description": "An LLM provider key on its way to the daemon. `Debug` never shows it, so\na logged request can't leak it."
      },
      "LlmKeySourceData": {
        "type": "string",
        "enum": [
          "stored",
          "env"
        ]
      },
      "LlmKeyStatusData": {
        "type": "object",
        "description": "Whether a provider has a key and where it comes from.",
        "required": [
          "provider",
          "present",
          "env_var"
        ],
        "properties": {
          "env_var": {
            "type": "string",
            "description": "The environment variable that is read when no key is stored."
          },
          "location": {
            "type": [
              "string",
              "null"
            ],
            "description": "The file holding a stored key, or the environment variable name."
          },
          "present": {
            "type": "boolean"
          },
          "provider": {
            "$ref": "#/components/schemas/LlmProviderData"
          },
          "source": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/LlmKeySourceData"
              },
              {
                "type": "null"
              }
            ]
          }
        }
      },
      "LlmObservationData": {
        "type": "object",
        "required": [
          "feature",
          "status"
        ],
        "properties": {
          "failure": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/LlmFailureKindData"
              },
              {
                "type": "null"
              }
            ]
          },
          "feature": {
            "type": "string",
            "description": "`default` is the base provider; other values are feature route names."
          },
          "status": {
            "$ref": "#/components/schemas/LlmObservationStatus"
          }
        }
      },
      "LlmObservationStatus": {
        "type": "string",
        "enum": [
          "succeeded",
          "failed"
        ]
      },
      "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": [
              {
                "$ref": "#/components/schemas/LlmOverrideData"
              },
              {
                "type": "null"
              }
            ],
            "default": null
          },
          "archive_ask": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/LlmOverrideData"
              },
              {
                "type": "null"
              }
            ],
            "default": null
          },
          "assistant": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/LlmOverrideData"
              },
              {
                "type": "null"
              }
            ],
            "default": null
          },
          "briefing": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/LlmOverrideData"
              },
              {
                "type": "null"
              }
            ],
            "default": null
          },
          "commitments": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/LlmOverrideData"
              },
              {
                "type": "null"
              }
            ],
            "default": null
          },
          "decision_log": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/LlmOverrideData"
              },
              {
                "type": "null"
              }
            ],
            "default": null
          },
          "delivery_extraction": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/LlmOverrideData"
              },
              {
                "type": "null"
              }
            ],
            "default": null
          },
          "draft_assist": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/LlmOverrideData"
              },
              {
                "type": "null"
              }
            ],
            "default": null
          },
          "draft_new": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/LlmOverrideData"
              },
              {
                "type": "null"
              }
            ],
            "default": null
          },
          "draft_refine": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/LlmOverrideData"
              },
              {
                "type": "null"
              }
            ],
            "default": null
          },
          "humanize_rewrite": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/LlmOverrideData"
              },
              {
                "type": "null"
              }
            ],
            "default": null
          },
          "relationship_summary": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/LlmOverrideData"
              },
              {
                "type": "null"
              }
            ],
            "default": null
          },
          "summarize": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/LlmOverrideData"
              },
              {
                "type": "null"
              }
            ],
            "default": null
          }
        }
      },
      "LlmProviderData": {
        "type": "string",
        "description": "A hosted provider mxr can hold a key for.",
        "enum": [
          "anthropic",
          "openai",
          "openrouter"
        ]
      },
      "LlmRouteStateData": {
        "type": "string",
        "enum": [
          "ok",
          "cooling",
          "broken",
          "recovering",
          "probing",
          "no_key"
        ]
      },
      "LlmRouteStatusData": {
        "type": "object",
        "required": [
          "provider",
          "model",
          "state",
          "next"
        ],
        "properties": {
          "model": {
            "type": "string",
            "description": "The id this provider knows the model by."
          },
          "next": {
            "type": "boolean",
            "description": "A request would go here now."
          },
          "provider": {
            "$ref": "#/components/schemas/LlmProviderData"
          },
          "reason": {
            "type": [
              "string",
              "null"
            ],
            "description": "Why it is out, e.g. `429 rate limited`. Fixed phrases, never text\nfrom the provider's reply."
          },
          "retry_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "When a cooling or broken route may be tried again."
          },
          "state": {
            "$ref": "#/components/schemas/LlmRouteStateData"
          }
        }
      },
      "LlmStatusSnapshot": {
        "type": "object",
        "required": [
          "enabled",
          "provider",
          "model",
          "configured_model",
          "api_key_present",
          "context_window",
          "supports_streaming",
          "request_timeout_secs"
        ],
        "properties": {
          "allow_cloud_relationship_data": {
            "type": "boolean",
            "description": "Whether history with a person may go to a cloud model. Clients key\ncached model output on it."
          },
          "api_key_env": {
            "type": [
              "string",
              "null"
            ]
          },
          "api_key_present": {
            "type": "boolean"
          },
          "backfill_held": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/LlmBackfillHeldData"
            },
            "description": "Inputs each background job held back because their mail was\nbackfilled, since the daemon started."
          },
          "background_live_only": {
            "type": "boolean",
            "description": "Background model work runs only on mail that arrived live, never on\nmail the initial backfill downloaded; commands you run reach older\nmail. False from a daemon older than this rule."
          },
          "background_paused_until": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "When the pause on background model calls after repeated endpoint\nfailures ends; the first background call after it checks the endpoint\nbefore sending mail. Absent while they run. Features on a routed model\nor with `[llm.fallback]` are never paused; their routes show their\nown health."
          },
          "base_url": {
            "type": [
              "string",
              "null"
            ]
          },
          "configured_model": {
            "type": "string"
          },
          "context_window": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "enabled": {
            "type": "boolean"
          },
          "fallback_error": {
            "type": [
              "string",
              "null"
            ],
            "description": "Why the configured fallback isn't used, e.g. a model mxr can't route."
          },
          "fallback_model": {
            "type": [
              "string",
              "null"
            ],
            "description": "The hosted model `[llm.fallback]` names, used while `base_url` is\nout. Absent when no fallback is configured."
          },
          "features": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/LlmFeatureStatusData"
            },
            "description": "Each AI feature's model, providers and their health."
          },
          "keys": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/LlmKeyStatusData"
            },
            "description": "Which providers have a key. Presence only, never the key."
          },
          "model": {
            "type": "string"
          },
          "observations": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/LlmObservationData"
            },
            "description": "Last process-local endpoint outcomes, separated by routed feature.\nThese contain typed failure classes only, never provider error text."
          },
          "policy_key": {
            "type": [
              "string",
              "null"
            ],
            "description": "Cache identity for a redacted host endpoint, not an authentication credential."
          },
          "provider": {
            "type": "string"
          },
          "request_timeout_secs": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "supports_streaming": {
            "type": "boolean"
          }
        }
      },
      "MailAssessment": {
        "type": "object",
        "required": [
          "message_id",
          "account_id",
          "policy_version",
          "home",
          "facts",
          "who",
          "deciding",
          "overridden",
          "fallback",
          "pending_body",
          "input_fingerprint"
        ],
        "properties": {
          "account_id": {
            "$ref": "#/components/schemas/AccountId"
          },
          "deciding": {
            "$ref": "#/components/schemas/AssessmentClaim"
          },
          "facts": {
            "$ref": "#/components/schemas/AssessmentFacts"
          },
          "fallback": {
            "type": "boolean"
          },
          "home": {
            "type": "string"
          },
          "input_fingerprint": {
            "type": "string",
            "description": "Digest of the canonical observed inputs, never mail content."
          },
          "message_id": {
            "$ref": "#/components/schemas/MessageId"
          },
          "not_sure": {
            "type": [
              "string",
              "null"
            ]
          },
          "overridden": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AssessmentClaim"
            }
          },
          "pending_body": {
            "type": "boolean"
          },
          "policy_version": {
            "type": "string"
          },
          "who": {
            "type": "string"
          }
        }
      },
      "MailKindData": {
        "type": "object",
        "description": "A message's kind with the reason it was given.",
        "required": [
          "kind",
          "rule",
          "reason",
          "corrected"
        ],
        "properties": {
          "corrected": {
            "type": "boolean",
            "description": "True when the user chose this kind for the sender."
          },
          "kind": {
            "$ref": "#/components/schemas/SenderKindData"
          },
          "reason": {
            "type": "string",
            "description": "A short human reason, e.g. \"automated sender, has List-Unsubscribe\"."
          },
          "rule": {
            "$ref": "#/components/schemas/KindRuleData"
          }
        }
      },
      "MailPlaceData": {
        "type": "string",
        "description": "A place for mail that isn't from people.",
        "enum": [
          "reading",
          "paper_trail"
        ]
      },
      "MarginaliaConnectionBody": {
        "type": "object",
        "description": "Body of `POST /api/v1/mail/reading/marginalia`.",
        "properties": {
          "connection": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/MarginaliaConnectionData",
                "description": "The site and a personal token to connect; null disconnects."
              },
              {
                "type": "null"
              }
            ]
          }
        }
      },
      "MarginaliaConnectionData": {
        "type": "object",
        "description": "The site and the personal token to connect Marginalia with.",
        "required": [
          "url",
          "token"
        ],
        "properties": {
          "token": {
            "type": "string",
            "description": "`mrg_…`, from Marginalia's Account, Connected apps. Kept in the\nsecrets file, never in config or logs."
          },
          "url": {
            "type": "string"
          }
        }
      },
      "MarginaliaSendBody": {
        "type": "object",
        "description": "Body of `POST /api/v1/mail/reading/items/{item_key}/marginalia`.",
        "properties": {
          "dry_run": {
            "type": "boolean",
            "description": "Name what would be sent and where; contact nothing."
          }
        }
      },
      "MarginaliaSendData": {
        "type": "object",
        "description": "What `SendReadingToMarginalia` did, or would do.",
        "required": [
          "item_key",
          "dry_run",
          "host",
          "title",
          "view",
          "bytes",
          "already_sent",
          "copy"
        ],
        "properties": {
          "already_sent": {
            "type": "boolean",
            "description": "It was sent before: nothing is sent, and it opens where it went."
          },
          "bytes": {
            "type": "integer",
            "format": "int64",
            "description": "Size of the text sent, in bytes; 0 when it was sent before.",
            "minimum": 0
          },
          "copy": {
            "type": "string",
            "description": "\"Sent to Marginalia.\" or \"Already in Marginalia.\""
          },
          "dry_run": {
            "type": "boolean"
          },
          "fetch_first": {
            "type": [
              "string",
              "null"
            ],
            "description": "The article's site, contacted first to fetch it for a digest link\nwhose article isn't saved yet."
          },
          "host": {
            "type": "string",
            "description": "The Marginalia site the item goes to."
          },
          "item_key": {
            "type": "string"
          },
          "marginalia": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/ReadingMarginaliaData"
              },
              {
                "type": "null"
              }
            ]
          },
          "title": {
            "type": "string"
          },
          "view": {
            "type": "string",
            "description": "`issue` or `article`: the text that is sent."
          }
        }
      },
      "MarginaliaStatusData": {
        "type": "object",
        "description": "Marginalia, the reading app items can be sent to.",
        "required": [
          "connected",
          "sent"
        ],
        "properties": {
          "connected": {
            "type": "boolean",
            "description": "A site and a token are saved."
          },
          "host": {
            "type": [
              "string",
              "null"
            ]
          },
          "sent": {
            "type": "integer",
            "format": "int32",
            "description": "Items sent so far, whose highlights are read back.",
            "minimum": 0
          },
          "url": {
            "type": [
              "string",
              "null"
            ],
            "description": "The site, such as `https://reader.example.com/`."
          }
        }
      },
      "MarginaliaSyncBody": {
        "type": "object",
        "description": "Body of `POST /api/v1/mail/reading/marginalia/highlights`.",
        "properties": {
          "item_key": {
            "type": [
              "string",
              "null"
            ],
            "description": "One sent item; omitted reads back every sent item."
          }
        }
      },
      "MarginaliaSyncData": {
        "type": "object",
        "description": "What `SyncMarginaliaHighlights` read back.",
        "required": [
          "items",
          "added",
          "removed",
          "forgotten"
        ],
        "properties": {
          "added": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "failed": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/MarginaliaSyncFailureData"
            }
          },
          "forgotten": {
            "type": "integer",
            "format": "int32",
            "description": "Items Marginalia no longer has: sending them again makes a new one.",
            "minimum": 0
          },
          "items": {
            "type": "integer",
            "format": "int32",
            "description": "Items whose highlights were read.",
            "minimum": 0
          },
          "removed": {
            "type": "integer",
            "format": "int32",
            "description": "Deleted in Marginalia, so removed here too.",
            "minimum": 0
          }
        }
      },
      "MarginaliaSyncFailureData": {
        "type": "object",
        "description": "One item whose highlights couldn't be read back.",
        "required": [
          "item_key",
          "error"
        ],
        "properties": {
          "error": {
            "type": "string"
          },
          "item_key": {
            "type": "string"
          }
        }
      },
      "MergeBody": {
        "type": "object",
        "description": "Body of `POST /api/v1/mail/people/merge`.",
        "required": [
          "account_id",
          "into",
          "addresses"
        ],
        "properties": {
          "account_id": {
            "type": "string"
          },
          "addresses": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "dry_run": {
            "type": "boolean"
          },
          "into": {
            "type": "string",
            "description": "The person's main address."
          }
        }
      },
      "MergeSuggestionData": {
        "type": "object",
        "description": "A merge mxr may suggest: the same name on addresses you've written to.",
        "required": [
          "account_id",
          "name",
          "addresses",
          "reason"
        ],
        "properties": {
          "account_id": {
            "$ref": "#/components/schemas/AccountId"
          },
          "addresses": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Every address with the name, the one you write to most first: the\nmerge would make it the person's primary address."
          },
          "name": {
            "type": "string"
          },
          "reason": {
            "type": "string",
            "description": "\"Same name, and you've written to both.\""
          }
        }
      },
      "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"
      },
      "MessageLayoutData": {
        "type": "string",
        "description": "Short notes read like chat; longer ones are letters.",
        "enum": [
          "compact",
          "letter"
        ]
      },
      "MessageMetadata": {
        "type": "object",
        "properties": {
          "auth_results": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "calendar": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/CalendarMetadata"
              },
              {
                "type": "null"
              }
            ]
          },
          "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": [
              {
                "$ref": "#/components/schemas/BodyPartSource"
              },
              {
                "type": "null"
              }
            ]
          },
          "text_plain_format": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/TextPlainFormat"
              },
              {
                "type": "null"
              }
            ]
          },
          "text_plain_source": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/BodyPartSource"
              },
              {
                "type": "null"
              }
            ]
          }
        }
      },
      "MessageTextSourceData": {
        "type": "string",
        "description": "Where a conversation's displayed message text came from. This describes\nbody availability, independently of any quote trimming or UI expansion.",
        "enum": [
          "stored_body",
          "provider_snippet"
        ]
      },
      "MessagesBandData": {
        "type": "string",
        "description": "The bands, top to bottom.",
        "enum": [
          "your_turn",
          "pinned",
          "recent",
          "quiet"
        ]
      },
      "MessagesData": {
        "type": "object",
        "description": "Returned by `Request::ListMessages`.",
        "required": [
          "generated_at",
          "header",
          "your_turn",
          "pinned",
          "recent",
          "quiet",
          "recent_total",
          "quiet_total",
          "row_count",
          "thread_count",
          "merge_suggestion_count"
        ],
        "properties": {
          "empty_state": {
            "type": [
              "string",
              "null"
            ],
            "description": "Set when the selected view is empty, with view-specific copy."
          },
          "filter": {
            "$ref": "#/components/schemas/MessagesFilterData",
            "description": "The filter the rows were kept by, echoed back."
          },
          "generated_at": {
            "type": "string",
            "format": "date-time"
          },
          "header": {
            "type": "string",
            "description": "The selected view's header (attention or conversation history)."
          },
          "lapsed": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/MessagesLapsedData"
            },
            "description": "Legacy field, left empty: clear attention is never filled with idle people."
          },
          "matched": {
            "type": "integer",
            "format": "int32",
            "description": "Distinct rows left after the filter, every band, before the list\nlimit. Equals `row_count` when no filter is on.",
            "minimum": 0
          },
          "merge_suggestion_count": {
            "type": "integer",
            "format": "int32",
            "description": "Merges mxr could suggest, for the hint on a person page.",
            "minimum": 0
          },
          "pinned": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/MessagesRowData"
            }
          },
          "quiet": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/MessagesRowData"
            }
          },
          "quiet_total": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "recent": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/MessagesRowData"
            }
          },
          "recent_total": {
            "type": "integer",
            "format": "int32",
            "description": "Rows in each band before the list limit, after the filter.",
            "minimum": 0
          },
          "row_count": {
            "type": "integer",
            "format": "int32",
            "description": "People and groups needing attention, before toggles or list limits.",
            "minimum": 0
          },
          "thread_count": {
            "type": "integer",
            "format": "int32",
            "description": "Conversations needing attention, before toggles or list limits.",
            "minimum": 0
          },
          "your_turn": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/MessagesRowData"
            }
          },
          "your_turn_split": {
            "$ref": "#/components/schemas/PeopleSplitData",
            "description": "Your turn's people, split as Now and the rail count them. With\n`turn=theirs` Your turn is cleared but this still describes it."
          }
        }
      },
      "MessagesFilterData": {
        "type": "object",
        "description": "What Messages keeps. Toggles AND with the turn and with each other, and\nnone of them changes the header counts.",
        "properties": {
          "past_pace": {
            "type": "boolean",
            "description": "Only rows where your turn has run past your usual pace with them."
          },
          "turn": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/MessagesTurnData",
                "description": "The explicit view; `None` selects only topics needing attention."
              },
              {
                "type": "null"
              }
            ]
          },
          "unread": {
            "type": "boolean",
            "description": "Only rows with a message from them you haven't read."
          }
        }
      },
      "MessagesLapsedData": {
        "type": "object",
        "description": "Someone whose usual pace lapsed, for the clear state: a fact, never a\nnudge.",
        "required": [
          "account_id",
          "person",
          "line"
        ],
        "properties": {
          "account_id": {
            "$ref": "#/components/schemas/AccountId"
          },
          "line": {
            "type": "string",
            "description": "\"Ari usually writes every week. Last: 19 days ago.\""
          },
          "person": {
            "$ref": "#/components/schemas/PersonRefData"
          }
        }
      },
      "MessagesPreviewData": {
        "type": "object",
        "description": "The line under a row's name.",
        "required": [
          "kind",
          "text"
        ],
        "properties": {
          "kind": {
            "$ref": "#/components/schemas/MessagesPreviewKindData"
          },
          "message_id": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/MessageId"
              },
              {
                "type": "null"
              }
            ]
          },
          "model": {
            "type": [
              "string",
              "null"
            ],
            "description": "The model whose gist found the ask, for an `ask`."
          },
          "text": {
            "type": "string"
          }
        }
      },
      "MessagesPreviewKindData": {
        "type": "string",
        "enum": [
          "ask",
          "latest",
          "you"
        ]
      },
      "MessagesRowData": {
        "type": "object",
        "description": "One row in a band.",
        "required": [
          "id",
          "kind",
          "account_id",
          "band",
          "title",
          "closeness",
          "your_turn",
          "last_at",
          "topics",
          "overdue",
          "pinned",
          "unread",
          "why"
        ],
        "properties": {
          "account_id": {
            "$ref": "#/components/schemas/AccountId"
          },
          "band": {
            "$ref": "#/components/schemas/MessagesBandData"
          },
          "closeness": {
            "$ref": "#/components/schemas/ClosenessData"
          },
          "draft": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/MessagesRowDraftData",
                "description": "Your unsent reply on one of the topics, the latest edited when\nseveral have one. Clients show it in place of the preview."
              },
              {
                "type": "null"
              }
            ]
          },
          "id": {
            "type": "string",
            "description": "`person:<email>` or `group:<thread_id>`: what `GetPerson` takes."
          },
          "kind": {
            "$ref": "#/components/schemas/MessagesRowKindData"
          },
          "last_at": {
            "type": "string",
            "format": "date-time",
            "description": "The latest activity on any topic."
          },
          "members": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PersonRefData"
            },
            "description": "The other people, for a group row."
          },
          "overdue": {
            "type": "boolean",
            "description": "Your turn has run past your usual pace with them."
          },
          "pace_label": {
            "type": [
              "string",
              "null"
            ],
            "description": "\"usually 47m\", when there is enough history."
          },
          "person": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/PersonRefData",
                "description": "The person, for a person row."
              },
              {
                "type": "null"
              }
            ]
          },
          "pinned": {
            "type": "boolean"
          },
          "preview": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/MessagesPreviewData"
              },
              {
                "type": "null"
              }
            ]
          },
          "title": {
            "type": "string",
            "description": "\"Samir Patel\", or a group's first names: \"Samir, Ruth\"."
          },
          "topics": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/MessagesTopicData"
            },
            "description": "Most pressing first: your turn, then waiting, then by recency."
          },
          "turn_since": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "When your turn started, for a Your turn row."
          },
          "unread": {
            "type": "boolean"
          },
          "usual_reply_seconds": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64",
            "description": "How fast you usually reply to them, in seconds, from past replies."
          },
          "why": {
            "type": "string",
            "description": "\"Here because: Samir asked you a question, and you write to him\noften (rule).\""
          },
          "your_turn": {
            "type": "boolean",
            "description": "A topic needs attention: an unanswered request or due explicit return."
          }
        }
      },
      "MessagesRowDraftData": {
        "type": "object",
        "description": "Your unsent reply in one of a row's conversations: the line clients show\nas \"Draft: ...\" in place of the preview, and what opening the row resumes.",
        "required": [
          "draft_id",
          "thread_id",
          "text",
          "reply_all",
          "updated_at"
        ],
        "properties": {
          "draft_id": {
            "$ref": "#/components/schemas/DraftId"
          },
          "reply_all": {
            "type": "boolean",
            "description": "The reply goes to everyone on the conversation."
          },
          "text": {
            "type": "string",
            "description": "The start of the reply's text, on one line."
          },
          "thread_id": {
            "$ref": "#/components/schemas/ThreadId",
            "description": "The conversation the reply answers: one of the row's topics."
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "MessagesRowKindData": {
        "type": "string",
        "enum": [
          "person",
          "group"
        ]
      },
      "MessagesTopicData": {
        "type": "object",
        "description": "One conversation inside a row.",
        "required": [
          "account_id",
          "thread_id",
          "subject",
          "shape",
          "state",
          "last_at",
          "message_count",
          "message_ids",
          "reply_to_message_id"
        ],
        "properties": {
          "account_id": {
            "$ref": "#/components/schemas/AccountId"
          },
          "last_at": {
            "type": "string",
            "format": "date-time"
          },
          "message_count": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "message_ids": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/MessageId"
            },
            "description": "Every message id in the thread: what done here covers."
          },
          "reply_to_message_id": {
            "$ref": "#/components/schemas/MessageId",
            "description": "The message a reply answers: their latest, else the latest."
          },
          "shape": {
            "$ref": "#/components/schemas/ThreadShapeData"
          },
          "state": {
            "$ref": "#/components/schemas/TopicStateData"
          },
          "subject": {
            "type": "string",
            "description": "The subject without \"Re:\" and \"Fwd:\"."
          },
          "thread_id": {
            "$ref": "#/components/schemas/ThreadId"
          },
          "with": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "For a group topic on a person page: the other people in it, by first\nname (\"with Ruth\")."
          }
        }
      },
      "MessagesTurnData": {
        "type": "string",
        "description": "An explicit Messages view. Omission selects Needs attention.",
        "enum": [
          "all",
          "mine",
          "theirs"
        ]
      },
      "MicrosoftTodoFieldsData": {
        "type": "object",
        "required": [
          "title",
          "completed"
        ],
        "properties": {
          "completed": {
            "type": "boolean"
          },
          "due": {
            "type": [
              "string",
              "null"
            ],
            "format": "date"
          },
          "scheduled": {
            "type": [
              "string",
              "null"
            ],
            "format": "date"
          },
          "title": {
            "type": "string"
          }
        }
      },
      "MicrosoftTodoLinkBody": {
        "type": "object",
        "properties": {
          "account_id": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/AccountId"
              },
              {
                "type": "null"
              }
            ]
          },
          "dry_run": {
            "type": "boolean"
          },
          "fingerprint": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "MicrosoftTodoSendData": {
        "type": "object",
        "description": "Preview of an explicit task link, or its durable link status. Linking\nauthorizes two-way synchronization of shared fields, never full email bodies.",
        "required": [
          "dry_run",
          "todo_id",
          "title",
          "notes",
          "fingerprint",
          "state",
          "summary"
        ],
        "properties": {
          "dry_run": {
            "type": "boolean"
          },
          "due": {
            "type": [
              "string",
              "null"
            ],
            "format": "date"
          },
          "fingerprint": {
            "type": "string",
            "description": "Returned by preview; a commit must name this unchanged payload."
          },
          "notes": {
            "type": "string"
          },
          "scheduled": {
            "type": [
              "string",
              "null"
            ],
            "format": "date"
          },
          "state": {
            "type": "string",
            "description": "preview | linked | unknown | attention"
          },
          "summary": {
            "type": "string"
          },
          "task_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "title": {
            "type": "string"
          },
          "todo_id": {
            "type": "string"
          }
        }
      },
      "MicrosoftTodoStatusData": {
        "type": "object",
        "description": "Optional local handoff to Microsoft To Do through the `ms-todo` CLI.",
        "required": [
          "installed",
          "install_url",
          "hint"
        ],
        "properties": {
          "hint": {
            "type": "string"
          },
          "install_url": {
            "type": "string"
          },
          "installed": {
            "type": "boolean",
            "description": "Available on the daemon's PATH, not the browser's computer."
          }
        }
      },
      "MicrosoftTodoSyncBody": {
        "type": "object",
        "properties": {
          "account_id": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/AccountId"
              },
              {
                "type": "null"
              }
            ]
          },
          "dry_run": {
            "type": "boolean"
          },
          "todo_id": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "MicrosoftTodoSyncData": {
        "type": "object",
        "required": [
          "dry_run",
          "results"
        ],
        "properties": {
          "dry_run": {
            "type": "boolean"
          },
          "results": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/MicrosoftTodoSyncItemData"
            }
          }
        }
      },
      "MicrosoftTodoSyncItemData": {
        "type": "object",
        "required": [
          "todo_id",
          "state",
          "summary"
        ],
        "properties": {
          "merged": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/MicrosoftTodoFieldsData"
              },
              {
                "type": "null"
              }
            ]
          },
          "microsoft": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/MicrosoftTodoFieldsData"
              },
              {
                "type": "null"
              }
            ]
          },
          "mixer": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/MicrosoftTodoFieldsData"
              },
              {
                "type": "null"
              }
            ]
          },
          "state": {
            "type": "string",
            "description": "synced | changes | conflict | paused"
          },
          "summary": {
            "type": "string"
          },
          "todo_id": {
            "type": "string"
          }
        }
      },
      "ModeDoneBody": {
        "type": "object",
        "description": "Body of `POST /api/v1/mail/modes/{mode}/done`.",
        "properties": {
          "dry_run": {
            "type": "boolean",
            "description": "Preview only: the same plan, nothing changed."
          },
          "sender": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/ModeDoneSenderData",
                "description": "Updates or Reading: every thread of this sender's there."
              },
              {
                "type": "null"
              }
            ]
          },
          "thread_ids": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "todo_ids": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "To do only: tick off just these rows."
          }
        }
      },
      "ModeDoneOutcomeData": {
        "type": "object",
        "description": "What done in one mode did to one thread, or with `dry_run` would do.",
        "required": [
          "thread_id",
          "mode",
          "provider",
          "copy"
        ],
        "properties": {
          "account_id": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/AccountId",
                "description": "Absent when the thread was not found."
              },
              {
                "type": "null"
              }
            ]
          },
          "archived": {
            "type": "integer",
            "format": "int32",
            "description": "Messages archived at the provider because the last mode let go.",
            "minimum": 0
          },
          "copy": {
            "type": "string",
            "description": "The handoff toast: \"Done in Messages. Still in To do (due Wed).\" or\n\"Done. Archived in Gmail.\""
          },
          "error": {
            "type": [
              "string",
              "null"
            ],
            "description": "Why this thread was not done. The others still are."
          },
          "marked": {
            "type": "boolean",
            "description": "Messages, Updates, Reading: the mode's done mark was written."
          },
          "marked_read": {
            "type": "integer",
            "format": "int32",
            "description": "Messages marked read with that archive.",
            "minimum": 0
          },
          "mode": {
            "$ref": "#/components/schemas/ModeKindData"
          },
          "provider": {
            "type": "string",
            "description": "\"Gmail\", \"Outlook\" or \"the mail server\": named in `copy`."
          },
          "still_in": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ModeKindData"
            },
            "description": "Modes still holding the thread after this."
          },
          "thread_id": {
            "$ref": "#/components/schemas/ThreadId"
          },
          "todos_ticked": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "To do: the rows ticked off."
          }
        }
      },
      "ModeDoneSenderData": {
        "type": "object",
        "description": "Every thread of one sender's in a mode, for done on a sender's row.",
        "required": [
          "account_id",
          "sender_email"
        ],
        "properties": {
          "account_id": {
            "$ref": "#/components/schemas/AccountId"
          },
          "sender_email": {
            "type": "string"
          }
        }
      },
      "ModeGuideData": {
        "type": "object",
        "description": "Returned in `ResponseData::ModeGuides`: one mode's teaching copy and\nits hints with their seen state on this profile.",
        "required": [
          "mode",
          "name",
          "header",
          "never_had_any",
          "add_one",
          "clear_for_now",
          "lands_here",
          "about",
          "why_template",
          "keys",
          "first_run_line",
          "hints"
        ],
        "properties": {
          "about": {
            "type": "string",
            "description": "How the mode works in one or two sentences. Only `?` and `mxr modes\nexplain` show it: nothing teaches at the top of the page."
          },
          "add_one": {
            "type": "string",
            "description": "How to add one by hand from a conversation, for the never-had-any\nstate."
          },
          "clear_for_now": {
            "type": "string",
            "description": "The empty state once everything is handled. The runway appends when\nthe next thing shows up."
          },
          "first_run_line": {
            "type": "string",
            "description": "The first-run summary's line for this mode."
          },
          "header": {
            "type": "string",
            "description": "Under the mode's name, always visible: the job and its verb."
          },
          "hints": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/HintData"
            },
            "description": "Each attached to one element in this mode."
          },
          "keys": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ModeKeyData"
            },
            "description": "Every key the mode answers to, with its verb, for `?` and the footer."
          },
          "lands_here": {
            "type": "string",
            "description": "One line on what lands here, for `?`."
          },
          "mode": {
            "type": "string",
            "description": "The id clients and `mxr modes explain` use: \"todo\"."
          },
          "name": {
            "type": "string",
            "description": "\"To do\"."
          },
          "never_had_any": {
            "type": "string",
            "description": "The empty state before anything has ever landed here."
          },
          "why_template": {
            "type": "string",
            "description": "How every row's why line reads: `{evidence}` and `{source}` are\nfilled per row."
          }
        }
      },
      "ModeKeyData": {
        "type": "object",
        "description": "One key and the verb it does in this mode: \"e tick off\".",
        "required": [
          "key",
          "verb"
        ],
        "properties": {
          "key": {
            "type": "string",
            "description": "As the clients print it: \"Enter\", \"e\", \",\"."
          },
          "verb": {
            "type": "string"
          }
        }
      },
      "ModeKindData": {
        "type": "string",
        "description": "One of the five modes. Now is a view over them, and Inbox a lens.",
        "enum": [
          "messages",
          "todo",
          "updates",
          "reading",
          "archive"
        ]
      },
      "ModeMembershipBody": {
        "type": "object",
        "description": "Body of `POST /api/v1/mail/modes/membership`.",
        "required": [
          "thread_ids"
        ],
        "properties": {
          "limit": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int32",
            "description": "Keep per-message evidence only for the newest `limit` messages.",
            "minimum": 0
          },
          "thread_ids": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "At most 100 threads, answered in this order."
          }
        }
      },
      "ModeMembershipData": {
        "type": "object",
        "description": "One mode holding a thread, and why.",
        "required": [
          "mode",
          "name",
          "key",
          "reason",
          "also_in"
        ],
        "properties": {
          "also_in": {
            "type": "string",
            "description": "The line other modes show: \"Also in To do: Sign the lease, act by\nMon 13 Oct · due Wed 15 Oct\"."
          },
          "early": {
            "type": "boolean",
            "description": "The mode's view is an early version built on an existing one."
          },
          "key": {
            "type": "string",
            "description": "\"g x\"."
          },
          "mode": {
            "$ref": "#/components/schemas/ModeKindData"
          },
          "name": {
            "type": "string",
            "description": "\"To do\"."
          },
          "reason": {
            "type": "string",
            "description": "\"Here because: Sam wrote to you and you've written to them (rule).\""
          },
          "tag": {
            "type": [
              "string",
              "null"
            ],
            "description": "The reason in one word, for a one-line arrival: \"person\",\n\"automated\", \"newsletter\", \"copied\", \"task\", \"record\"."
          },
          "todo_ids": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "To do: the open rows holding the thread."
          }
        }
      },
      "ModelChoiceData": {
        "type": "object",
        "description": "One model a client can choose.",
        "required": [
          "id",
          "label",
          "cloud",
          "available"
        ],
        "properties": {
          "available": {
            "type": "boolean",
            "description": "Whether it can be picked now."
          },
          "cloud": {
            "type": "boolean",
            "description": "True when conversations with it go to a provider off this machine."
          },
          "id": {
            "type": "string",
            "description": "The model id, as `set` takes it."
          },
          "label": {
            "type": "string",
            "description": "What a person calls it (\"Claude Haiku 5.5\")."
          },
          "sees": {
            "type": "string",
            "description": "The context sent with this choice: the current conversation alone, or\nthe conversation and the user's past mail."
          },
          "unavailable_reason": {
            "type": [
              "string",
              "null"
            ],
            "description": "Why it can't be picked, with the command that fixes it when there is\none. Set exactly when `available` is false."
          }
        }
      },
      "MoveBody": {
        "type": "object",
        "description": "Body of `POST /api/v1/mail/messages/{message_id}/move`.",
        "required": [
          "mode"
        ],
        "properties": {
          "dry_run": {
            "type": "boolean"
          },
          "mode": {
            "type": "string",
            "description": "messages, todo, updates, reading or archive."
          },
          "sender": {
            "type": "boolean",
            "description": "Set the sender's mode for all their mail (`K`)."
          },
          "source": {
            "type": [
              "string",
              "null"
            ],
            "description": "`not_sure` when answering Now's question."
          }
        }
      },
      "MoveChoiceData": {
        "type": "object",
        "description": "One destination of a move, with its key in the picker.",
        "required": [
          "mode",
          "label",
          "key"
        ],
        "properties": {
          "key": {
            "type": "string",
            "description": "\"m\", \"x\", \"u\", \"r\", \"e\": the mode's jump letter."
          },
          "label": {
            "type": "string"
          },
          "mode": {
            "$ref": "#/components/schemas/ModeKindData"
          }
        }
      },
      "MoveOutcomeData": {
        "type": "object",
        "description": "What a move did, or with `dry_run` would do.",
        "required": [
          "account_id",
          "message_id",
          "thread_id",
          "sender_email",
          "from",
          "to",
          "sender",
          "dry_run",
          "copy"
        ],
        "properties": {
          "account_id": {
            "$ref": "#/components/schemas/AccountId"
          },
          "ask_sender": {
            "type": [
              "string",
              "null"
            ],
            "description": "\"Always for this sender? (P)\": asked once after a per-email move to\nMessages, Updates or Reading."
          },
          "aspect_id": {
            "type": [
              "string",
              "null"
            ],
            "description": "To do and Archive add the email there: the to-do or record made."
          },
          "copy": {
            "type": "string",
            "description": "\"Moved to Reading.\" / \"All mail from maya@example.com goes to\nReading.\" / \"Would move to Reading.\""
          },
          "correction_id": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64",
            "description": "Undo with `Request::UndoMove`. Absent for a dry run or a move that\nchanged nothing."
          },
          "dry_run": {
            "type": "boolean"
          },
          "from": {
            "$ref": "#/components/schemas/ArrivalBucketData"
          },
          "hint": {
            "type": [
              "string",
              "null"
            ],
            "description": "The hint the first move's toast carries until the user has seen it."
          },
          "message_id": {
            "$ref": "#/components/schemas/MessageId"
          },
          "sender": {
            "type": "boolean",
            "description": "The sender's mode was set, for this and all their mail."
          },
          "sender_email": {
            "type": "string"
          },
          "thread_id": {
            "$ref": "#/components/schemas/ThreadId"
          },
          "to": {
            "$ref": "#/components/schemas/ModeKindData"
          }
        }
      },
      "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."
          }
        }
      },
      "NotSureData": {
        "type": "object",
        "description": "An email Now asks about: two placement rules disagreed (D119's U1:\nsomeone you've written to only copied you).",
        "required": [
          "account_id",
          "message_id",
          "thread_id",
          "sender_email",
          "subject",
          "mode",
          "line",
          "choices"
        ],
        "properties": {
          "account_id": {
            "$ref": "#/components/schemas/AccountId"
          },
          "choices": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/MoveChoiceData"
            },
            "description": "The answers, one key each: Messages, To do, Updates, Reading,\nArchive."
          },
          "line": {
            "type": "string",
            "description": "\"Maya Ortiz copied you on \"Q4 plan\". Updates for now.\""
          },
          "message_id": {
            "$ref": "#/components/schemas/MessageId"
          },
          "mode": {
            "$ref": "#/components/schemas/ModeKindData",
            "description": "Where it is for now."
          },
          "sender_email": {
            "type": "string"
          },
          "sender_name": {
            "type": [
              "string",
              "null"
            ]
          },
          "subject": {
            "type": "string"
          },
          "thread_id": {
            "$ref": "#/components/schemas/ThreadId"
          }
        }
      },
      "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"
          }
        }
      },
      "NotificationChimesPatchData": {
        "type": "object",
        "description": "Fields of [`NotificationChimesData`] to change; `None` keeps the current value.",
        "properties": {
          "archived": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/NotificationChimeSoundData"
              },
              {
                "type": "null"
              }
            ],
            "default": null
          },
          "enabled": {
            "type": [
              "boolean",
              "null"
            ],
            "default": null
          },
          "error": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/NotificationChimeSoundData"
              },
              {
                "type": "null"
              }
            ],
            "default": null
          },
          "new_mail": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/NotificationChimeSoundData"
              },
              {
                "type": "null"
              }
            ],
            "default": null
          },
          "reminder": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/NotificationChimeSoundData"
              },
              {
                "type": "null"
              }
            ],
            "default": null
          },
          "sent": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/NotificationChimeSoundData"
              },
              {
                "type": "null"
              }
            ],
            "default": null
          },
          "snoozed": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/NotificationChimeSoundData"
              },
              {
                "type": "null"
              }
            ],
            "default": null
          },
          "spam": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/NotificationChimeSoundData"
              },
              {
                "type": "null"
              }
            ],
            "default": null
          },
          "trashed": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/NotificationChimeSoundData"
              },
              {
                "type": "null"
              }
            ],
            "default": null
          },
          "unsnoozed": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/NotificationChimeSoundData"
              },
              {
                "type": "null"
              }
            ],
            "default": null
          },
          "volume": {
            "type": [
              "number",
              "null"
            ],
            "format": "float",
            "default": null
          }
        }
      },
      "NowData": {
        "type": "object",
        "description": "Returned by `Request::GetNow`.",
        "required": [
          "generated_at",
          "header",
          "headline",
          "people",
          "due_soon",
          "item_count",
          "first_run"
        ],
        "properties": {
          "coming_up": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RecordMomentData"
            },
            "description": "Archive records with a moment soon (a trip in 72 hours, a ticket\ntoday, a return window closing, a warranty ending), soonest first,\nat most three. One line on Now, never a badge."
          },
          "due_soon": {
            "$ref": "#/components/schemas/NowDueData"
          },
          "empty_state": {
            "type": [
              "string",
              "null"
            ],
            "description": "Set when every section is empty: \"Clear. The next to-do surfaces\nMon 19 Oct 09:00.\" or the never-had-any line."
          },
          "first_run": {
            "$ref": "#/components/schemas/TodoFirstRunData",
            "description": "The newest-first first run, for \"Sorting your mail\" while it runs."
          },
          "generated_at": {
            "type": "string",
            "format": "date-time"
          },
          "header": {
            "type": "string",
            "description": "`now_copy::HEADER`."
          },
          "headline": {
            "type": "string",
            "description": "\"Friday afternoon. 3 people, 2 things to act on.\""
          },
          "item_count": {
            "type": "integer",
            "format": "int32",
            "description": "Items shown across all sections: never more than ten.",
            "minimum": 0
          },
          "next_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "When the next to-do surfaces, for the low tide scene."
          },
          "not_now": {
            "type": [
              "string",
              "null"
            ],
            "description": "\"Not now: Reading 6 this week\", while the pick isn't showing."
          },
          "people": {
            "$ref": "#/components/schemas/NowPeopleData",
            "description": "The sections, in their fixed order. An empty one is omitted by\nclients; its total says so."
          },
          "reading": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/NowReadingPickData",
                "description": "From 17:00 local time only."
              },
              {
                "type": "null"
              }
            ]
          },
          "updates": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/NowUpdatesCardData"
              },
              {
                "type": "null"
              }
            ]
          }
        }
      },
      "NowDueData": {
        "type": "object",
        "description": "Due soon: To do's Now band, by act-by.",
        "required": [
          "todos",
          "total"
        ],
        "properties": {
          "more_line": {
            "type": [
              "string",
              "null"
            ]
          },
          "todos": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/NowTodoData"
            }
          },
          "total": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          }
        }
      },
      "NowPeopleData": {
        "type": "object",
        "description": "People: whose turn it is, from Messages.",
        "required": [
          "rows",
          "total"
        ],
        "properties": {
          "more_line": {
            "type": [
              "string",
              "null"
            ],
            "description": "\"and 8 more in Messages\", when there are more."
          },
          "overload_line": {
            "type": [
              "string",
              "null"
            ],
            "description": "When You owe runs long: \"11 people are waiting on you. The three\nbelow have waited longest past your usual pace.\""
          },
          "rows": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/NowPersonData"
            },
            "description": "At most three people, each once at their most pressing\nconversation: You owe first, then New from people, then Waiting on."
          },
          "split": {
            "$ref": "#/components/schemas/PeopleSplitData",
            "description": "`total` split into people you write with and others who wrote to\nyou. `write_with + others == total`."
          },
          "total": {
            "type": "integer",
            "format": "int32",
            "description": "Every person in Messages, shown or not.",
            "minimum": 0
          }
        }
      },
      "NowPersonData": {
        "type": "object",
        "description": "A person row: a desk row from You owe, New from people or Waiting on.",
        "required": [
          "row",
          "why"
        ],
        "properties": {
          "new_sender": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/ScreenerQuestionData",
                "description": "A first-time sender: the one question, on the row (D117)."
              },
              {
                "type": "null"
              }
            ]
          },
          "row": {
            "$ref": "#/components/schemas/DeskRowData"
          },
          "why": {
            "type": "string",
            "description": "\"your turn since Wednesday\""
          }
        }
      },
      "NowReadingPickData": {
        "type": "object",
        "description": "The evening's one thing to read.",
        "required": [
          "account_id",
          "message_id",
          "thread_id",
          "sender_email",
          "subject",
          "date",
          "why"
        ],
        "properties": {
          "account_id": {
            "$ref": "#/components/schemas/AccountId"
          },
          "date": {
            "type": "string",
            "format": "date-time"
          },
          "message_id": {
            "$ref": "#/components/schemas/MessageId"
          },
          "sender_email": {
            "type": "string"
          },
          "sender_name": {
            "type": [
              "string",
              "null"
            ]
          },
          "subject": {
            "type": "string"
          },
          "thread_id": {
            "$ref": "#/components/schemas/ThreadId"
          },
          "why": {
            "type": "string",
            "description": "\"you've read 9 of the 10 from Long Reads in your inbox\""
          }
        }
      },
      "NowTodoData": {
        "type": "object",
        "description": "A to-do on Now.",
        "required": [
          "todo",
          "why"
        ],
        "properties": {
          "todo": {
            "$ref": "#/components/schemas/TodoData"
          },
          "why": {
            "type": "string",
            "description": "\"act by Wed 7 Oct · due Fri 9 Oct\""
          }
        }
      },
      "NowUpdateSourceData": {
        "type": "object",
        "description": "One source on the Updates card.",
        "required": [
          "sender_email",
          "count"
        ],
        "properties": {
          "count": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "sender_email": {
            "type": "string"
          },
          "sender_name": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "NowUpdatesCardData": {
        "type": "object",
        "description": "The Updates card: the latest digest as one item, whatever the count:\nits headline, up to three lines that need a look or changed, and how\nmuch routine waits behind them.",
        "required": [
          "message_count",
          "source_count",
          "top_sources",
          "line",
          "since",
          "thread_ids",
          "early"
        ],
        "properties": {
          "cut_label": {
            "type": "string",
            "description": "\"08:00\"."
          },
          "early": {
            "type": "boolean"
          },
          "headline": {
            "type": "string",
            "description": "\"1 needs a look, 2 changed. 23 routine from 9 sources.\""
          },
          "let_go_line": {
            "type": [
              "string",
              "null"
            ],
            "description": "\"Let go of 31 updates from 12 sources; 2 also in To do stay there.\""
          },
          "line": {
            "type": "string",
            "description": "\"23 updates from 9 sources. Most from GitHub, Vercel and Stripe.\""
          },
          "lines": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/UpdateLineData"
            },
            "description": "Up to three lines: Needs a look first, then Changed."
          },
          "message_count": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "more_line": {
            "type": [
              "string",
              "null"
            ],
            "description": "\"+23 routine\", when routine or further lines wait in Updates."
          },
          "selection_token": {
            "type": "string",
            "description": "Pass to `LetGoDigest` so the card lets go of what it showed."
          },
          "since": {
            "type": "string",
            "format": "date-time",
            "description": "The digest's cut: the card holds what arrived by then."
          },
          "source_count": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "thread_ids": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ThreadId"
            },
            "description": "The card's threads, newest first. Letting go of the digest is\n`LetGoDigest` with `selection_token`."
          },
          "title": {
            "type": "string",
            "description": "\"This morning's digest\"."
          },
          "top_sources": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/NowUpdateSourceData"
            },
            "description": "The busiest three sources."
          }
        }
      },
      "OneTimeCodeData": {
        "type": "object",
        "description": "A one-time code a message gave, for `Request::ListOneTimeCodes`.",
        "required": [
          "code",
          "current",
          "expires_at",
          "received_at",
          "sender_name",
          "sender_host",
          "sender_email",
          "subject",
          "account_id",
          "message_id",
          "thread_id"
        ],
        "properties": {
          "account_id": {
            "$ref": "#/components/schemas/AccountId"
          },
          "code": {
            "type": "string",
            "description": "As the message wrote it: \"482913\", \"G-123456\", \"739 204\"."
          },
          "current": {
            "type": "boolean",
            "description": "Whether it is still in its window: the lifetime the message states,\nelse ten minutes."
          },
          "expires_at": {
            "type": "string",
            "format": "date-time"
          },
          "message_id": {
            "$ref": "#/components/schemas/MessageId"
          },
          "received_at": {
            "type": "string",
            "format": "date-time"
          },
          "sender_email": {
            "type": "string"
          },
          "sender_host": {
            "type": "string",
            "description": "\"accounts.acme.example\", from the address."
          },
          "sender_name": {
            "type": "string",
            "description": "\"Acme\", as Updates names the source. Shown with `sender_host`: the\nname is the sender's choice, the host is where the mail came from."
          },
          "subject": {
            "type": "string"
          },
          "thread_id": {
            "$ref": "#/components/schemas/ThreadId"
          }
        }
      },
      "OwedReplyHereData": {
        "type": "object",
        "required": [
          "message_id",
          "since"
        ],
        "properties": {
          "message_id": {
            "$ref": "#/components/schemas/MessageId"
          },
          "since": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "OwedReplyRowData": {
        "type": "object",
        "required": [
          "thread_id",
          "latest_inbound_msg_id",
          "from_email",
          "subject",
          "latest_inbound_at",
          "waiting_days",
          "expected_days",
          "overdue_score"
        ],
        "properties": {
          "account_id": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/AccountId",
                "description": "The account the reply is owed from. Absent from older daemons."
              },
              {
                "type": "null"
              }
            ]
          },
          "expected_days": {
            "type": "number",
            "format": "double",
            "description": "The pace `overdue_score` is measured against, in days."
          },
          "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"
          },
          "usual_seconds": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64",
            "description": "How long you usually take to reply to this person, when at least\ntwo past replies say so. Only the default (desk) list sets it;\n`expected_days` falls back to a day without it."
          },
          "waiting_days": {
            "type": "number",
            "format": "double"
          }
        }
      },
      "PendingPairing": {
        "type": "object",
        "required": [
          "capabilities",
          "request_id",
          "name",
          "challenge",
          "expires_at",
          "approved",
          "failed_attempts"
        ],
        "properties": {
          "approved": {
            "type": "boolean"
          },
          "capabilities": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RemoteCapability"
            }
          },
          "challenge": {
            "type": "string",
            "description": "Both screens must display this exact verifier-bound challenge."
          },
          "expires_at": {
            "type": "integer",
            "format": "int64"
          },
          "failed_attempts": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "name": {
            "type": "string"
          },
          "request_id": {
            "type": "string"
          }
        }
      },
      "PeopleSplitData": {
        "type": "object",
        "description": "Who is waiting on you, split the one way every surface agrees on:\npeople you write with (the You owe lane) and others who wrote to you\n(all of New from people, first-time or repeat). One unit is one row as\nMessages lists it: a person once, a group thread once.",
        "required": [
          "write_with",
          "others"
        ],
        "properties": {
          "others": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "write_with": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          }
        }
      },
      "PersonMergeData": {
        "type": "object",
        "description": "Returned by `Request::MergePeople` and `Request::SplitPerson`.",
        "required": [
          "account_id",
          "person",
          "changed",
          "thread_count",
          "dry_run",
          "summary"
        ],
        "properties": {
          "account_id": {
            "$ref": "#/components/schemas/AccountId"
          },
          "changed": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Addresses the change moves."
          },
          "dry_run": {
            "type": "boolean"
          },
          "person": {
            "$ref": "#/components/schemas/PersonRefData",
            "description": "The person after the change."
          },
          "summary": {
            "type": "string",
            "description": "\"Samir Patel is now one person with 2 addresses.\""
          },
          "thread_count": {
            "type": "integer",
            "format": "int32",
            "description": "Conversations that now show under this person.",
            "minimum": 0
          }
        }
      },
      "PersonPageData": {
        "type": "object",
        "description": "Returned by `Request::GetPerson`.",
        "required": [
          "row",
          "relationship_line",
          "header_line",
          "topics"
        ],
        "properties": {
          "conversation": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/ConversationData"
              },
              {
                "type": "null"
              }
            ]
          },
          "header_line": {
            "type": "string",
            "description": "\"close · usually 47m\"."
          },
          "merge_suggestions": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/MergeSuggestionData"
            },
            "description": "Merges suggested for this person."
          },
          "relationship_line": {
            "type": "string",
            "description": "\"You've written 48 times since 2023. Last: Tuesday.\""
          },
          "row": {
            "$ref": "#/components/schemas/MessagesRowData"
          },
          "topics": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/MessagesTopicData"
            },
            "description": "Every topic with them: one-to-one, then groups (\"with Ruth\")."
          }
        }
      },
      "PersonRefData": {
        "type": "object",
        "description": "Someone on a row or a message.",
        "required": [
          "id",
          "addresses"
        ],
        "properties": {
          "addresses": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Every address that is this person, primary first."
          },
          "id": {
            "type": "string",
            "description": "The person's id: their primary address, lowercased."
          },
          "name": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "PersonalCategory": {
        "type": "object",
        "description": "A profile-local category used to group messages without changing provider state.",
        "required": [
          "id",
          "name",
          "unread_count",
          "total_count"
        ],
        "properties": {
          "id": {
            "$ref": "#/components/schemas/CategoryId"
          },
          "name": {
            "type": "string"
          },
          "total_count": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "unread_count": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          }
        }
      },
      "PinMessagesBody": {
        "type": "object",
        "description": "Body of `POST /api/v1/mail/messages/pin`.",
        "required": [
          "message_ids",
          "pinned"
        ],
        "properties": {
          "message_ids": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "pinned": {
            "type": "boolean"
          }
        }
      },
      "PlaceBundleData": {
        "type": "object",
        "description": "One sender's mail in a place.",
        "required": [
          "account_id",
          "sender_email",
          "kind",
          "message_count",
          "unread_count",
          "pinned_count",
          "newest_at",
          "newest_subject",
          "messages"
        ],
        "properties": {
          "account_id": {
            "$ref": "#/components/schemas/AccountId"
          },
          "kind": {
            "$ref": "#/components/schemas/MailKindData",
            "description": "Why this sender's mail is here: the newest message's kind."
          },
          "message_count": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "messages": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PlaceMessageData"
            },
            "description": "Pinned first, then newest: the page the request's `message_offset`\nand `messages_per_bundle` ask for. `message_count` covers them all."
          },
          "newest_at": {
            "type": "string",
            "format": "date-time"
          },
          "newest_subject": {
            "type": "string"
          },
          "pinned_count": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "sender_email": {
            "type": "string"
          },
          "sender_name": {
            "type": [
              "string",
              "null"
            ]
          },
          "unread_count": {
            "type": "integer",
            "format": "int32",
            "description": "Unread messages in the bundle. Never a badge; shown only as a fact.",
            "minimum": 0
          }
        }
      },
      "PlaceMessageData": {
        "type": "object",
        "description": "One message inside a bundle.",
        "required": [
          "message_id",
          "thread_id",
          "subject",
          "snippet",
          "date",
          "unread",
          "pinned",
          "starred"
        ],
        "properties": {
          "date": {
            "type": "string",
            "format": "date-time"
          },
          "message_id": {
            "$ref": "#/components/schemas/MessageId"
          },
          "pinned": {
            "type": "boolean"
          },
          "snippet": {
            "type": "string"
          },
          "starred": {
            "type": "boolean"
          },
          "subject": {
            "type": "string"
          },
          "thread_id": {
            "$ref": "#/components/schemas/ThreadId"
          },
          "unread": {
            "type": "boolean",
            "description": "Shown for reference only: nothing in a place counts as unread."
          }
        }
      },
      "PromiseDetectionData": {
        "type": "object",
        "description": "Returned by `Request::DetectPromises`.",
        "required": [
          "status",
          "promises"
        ],
        "properties": {
          "message": {
            "type": [
              "string",
              "null"
            ],
            "description": "Why there is no answer, for statuses other than `ready`."
          },
          "promises": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/DetectedPromiseData"
            },
            "description": "Promises the sender makes, in the order they appear."
          },
          "provenance": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/AiProvenanceData",
                "description": "Set when a model was asked."
              },
              {
                "type": "null"
              }
            ]
          },
          "status": {
            "$ref": "#/components/schemas/PromiseDetectionStatusData"
          }
        }
      },
      "PromiseDetectionStatusData": {
        "type": "string",
        "description": "A detection that can't run is a normal answer: sending never waits on it.",
        "enum": [
          "ready",
          "disabled",
          "blocked",
          "failed",
          "timed_out"
        ]
      },
      "PromiseSourceData": {
        "oneOf": [
          {
            "type": "object",
            "description": "An outgoing draft, checked while it sends (the web undo window).",
            "required": [
              "draft",
              "kind"
            ],
            "properties": {
              "draft": {
                "$ref": "#/components/schemas/Draft"
              },
              "kind": {
                "type": "string",
                "enum": [
                  "draft"
                ]
              }
            }
          },
          {
            "type": "object",
            "description": "A message you already sent (TUI and CLI check after the send).",
            "required": [
              "message_id",
              "kind"
            ],
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "sent_message"
                ]
              },
              "message_id": {
                "$ref": "#/components/schemas/MessageId"
              }
            }
          }
        ],
        "description": "Where `DetectPromises` looks."
      },
      "RailData": {
        "type": "object",
        "description": "Returned by `Request::GetRail`.",
        "required": [
          "generated_at",
          "entries",
          "more"
        ],
        "properties": {
          "entries": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RailEntryData"
            },
            "description": "Now, the five modes, then Inbox."
          },
          "generated_at": {
            "type": "string",
            "format": "date-time"
          },
          "more": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RailLinkData"
            },
            "description": "Under More: the Screener (off the rail, D117) and the rest."
          }
        }
      },
      "RailEntryData": {
        "type": "object",
        "description": "One rail entry: Now, a mode, or Inbox.",
        "required": [
          "id",
          "name",
          "key",
          "group",
          "status"
        ],
        "properties": {
          "badge": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int32",
            "description": "A badge counts work only, so only Now has one.",
            "minimum": 0
          },
          "count": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int32",
            "description": "What the entry holds now, for a quiet count. Absent where a count\nmeans nothing (Archive, Inbox).",
            "minimum": 0
          },
          "early_note": {
            "type": [
              "string",
              "null"
            ],
            "description": "For an early version: what it is built on, for the clients' \"early\nversion\" note."
          },
          "group": {
            "type": "string",
            "description": "`home` (Now), `modes`, or `lens` (Inbox): the rail's three groups."
          },
          "header": {
            "type": [
              "string",
              "null"
            ],
            "description": "The line under the name, from the mode's guide where the mode is\nbuilt."
          },
          "id": {
            "type": "string",
            "description": "\"now\", \"messages\", \"todo\", \"updates\", \"reading\", \"archive\", \"inbox\"."
          },
          "key": {
            "type": "string",
            "description": "\"g h\"."
          },
          "name": {
            "type": "string"
          },
          "quiet": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int32",
            "description": "Messages: person mail in the inbox no lane holds, kept until done\nthere. Not in `count`, which counts people.",
            "minimum": 0
          },
          "status": {
            "$ref": "#/components/schemas/RailStatusData"
          }
        }
      },
      "RailLinkData": {
        "type": "object",
        "description": "A page under More.",
        "required": [
          "id",
          "name"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "key": {
            "type": [
              "string",
              "null"
            ]
          },
          "name": {
            "type": "string"
          },
          "note": {
            "type": [
              "string",
              "null"
            ],
            "description": "\"Every sender you've decided on, and new ones to decide.\""
          }
        }
      },
      "RailStatusData": {
        "type": "string",
        "description": "Built in its researched shape, or an early version on an existing view.",
        "enum": [
          "built",
          "early"
        ]
      },
      "ReadingArticleBody": {
        "type": "object",
        "description": "Body of `POST /api/v1/mail/reading/items/{item_key}/article`.",
        "properties": {
          "refresh": {
            "type": "boolean",
            "description": "Fetch again even when a copy is saved."
          }
        }
      },
      "ReadingArticleData": {
        "type": "object",
        "description": "A fetched article, as cached.",
        "required": [
          "title",
          "final_url",
          "contacted",
          "fetched_at",
          "words",
          "minutes",
          "paragraphs",
          "html"
        ],
        "properties": {
          "byline": {
            "type": [
              "string",
              "null"
            ]
          },
          "contacted": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Every site contacted to fetch it, in order."
          },
          "fetched_at": {
            "type": "string",
            "format": "date-time"
          },
          "final_url": {
            "type": "string",
            "description": "Where the page was in the end."
          },
          "html": {
            "type": "string",
            "description": "Cleaned article HTML; untrusted, so clients sanitize it."
          },
          "minutes": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "paragraphs": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ReadingParagraphData"
            }
          },
          "site_name": {
            "type": [
              "string",
              "null"
            ]
          },
          "title": {
            "type": "string"
          },
          "words": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          }
        }
      },
      "ReadingBandData": {
        "type": "string",
        "description": "The edition's three time bands.",
        "enum": [
          "since_last_visit",
          "earlier",
          "fading"
        ]
      },
      "ReadingBandGroupData": {
        "type": "object",
        "description": "One band of the edition.",
        "required": [
          "band",
          "label",
          "items"
        ],
        "properties": {
          "band": {
            "$ref": "#/components/schemas/ReadingBandData"
          },
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ReadingItemData"
            }
          },
          "label": {
            "type": "string",
            "description": "\"Since you were last here\"."
          },
          "note": {
            "type": [
              "string",
              "null"
            ],
            "description": "Fading: \"Goes within a day, unless you keep it.\""
          }
        }
      },
      "ReadingEditionData": {
        "type": "object",
        "description": "Returned by `Request::GetReadingEdition`.",
        "required": [
          "generated_at",
          "header",
          "bands",
          "left_off_here",
          "later",
          "later_count",
          "sources",
          "pace_wpm",
          "pace_measured",
          "expired_now"
        ],
        "properties": {
          "bands": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ReadingBandGroupData"
            },
            "description": "Only bands with items, in order."
          },
          "empty": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/ReadingEmptyData"
              },
              {
                "type": "null"
              }
            ]
          },
          "expired_now": {
            "type": "integer",
            "format": "int32",
            "description": "Items that expired since the last edition: done in Reading, never\narchived at the provider.",
            "minimum": 0
          },
          "generated_at": {
            "type": "string",
            "format": "date-time"
          },
          "header": {
            "type": "string"
          },
          "last_visit_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "Your previous visit ended here: \"You left off here\" goes after the\nfirst band when this is set and later bands have items."
          },
          "later": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ReadingItemData"
            },
            "description": "The shelf, newest first. Its count is the only one Reading shows."
          },
          "later_count": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "left_off_here": {
            "type": "boolean"
          },
          "pace_measured": {
            "type": "boolean"
          },
          "pace_wpm": {
            "type": "integer",
            "format": "int32",
            "description": "Your reading pace in words a minute, and whether it was measured\nfrom issues you finished (else 230).",
            "minimum": 0
          },
          "sources": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ReadingSourceData"
            },
            "description": "Every source in the edition or on Later, best read first."
          }
        }
      },
      "ReadingEmptyData": {
        "type": "object",
        "description": "The empty state, when the first band has nothing.",
        "required": [
          "never_had_any",
          "line"
        ],
        "properties": {
          "line": {
            "type": "string",
            "description": "\"Nothing new since Tuesday. Later has 4 things saved.\""
          },
          "never_had_any": {
            "type": "boolean",
            "description": "Nothing has ever landed in Reading."
          }
        }
      },
      "ReadingEngagementBody": {
        "type": "object",
        "description": "Body of `POST /api/v1/mail/reading/engagement`.",
        "required": [
          "item_key"
        ],
        "properties": {
          "dwell_ms": {
            "type": "integer",
            "format": "int64",
            "description": "Time read since the last report, in milliseconds.",
            "minimum": 0
          },
          "item_key": {
            "type": "string"
          },
          "opened": {
            "type": "boolean"
          },
          "progress": {
            "type": "number",
            "format": "double",
            "description": "How far down, 0 to 1."
          }
        }
      },
      "ReadingFetchData": {
        "type": "object",
        "description": "What `FetchArticle` did.",
        "required": [
          "item_key",
          "domain",
          "cached"
        ],
        "properties": {
          "article": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/ReadingArticleData"
              },
              {
                "type": "null"
              }
            ]
          },
          "cached": {
            "type": "boolean",
            "description": "Served from the saved copy; nothing was contacted."
          },
          "domain": {
            "type": "string",
            "description": "The site named before fetching: the link's own domain."
          },
          "error": {
            "type": [
              "string",
              "null"
            ],
            "description": "Why it failed: a paywall, a private address, a page too large."
          },
          "item_key": {
            "type": "string"
          }
        }
      },
      "ReadingHighlightBody": {
        "type": "object",
        "description": "Body of `POST /api/v1/mail/reading/highlights`.",
        "required": [
          "item_key",
          "quote"
        ],
        "properties": {
          "item_key": {
            "type": "string"
          },
          "note": {
            "type": [
              "string",
              "null"
            ]
          },
          "paragraph": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int32",
            "description": "The paragraph (from 0) it was selected in; absent marks the first match.",
            "minimum": 0
          },
          "quote": {
            "type": "string"
          },
          "view": {
            "type": [
              "string",
              "null"
            ],
            "description": "`issue` (default) or `article`."
          }
        }
      },
      "ReadingHighlightChangeData": {
        "type": "object",
        "description": "What `UpdateHighlight` or `RemoveHighlight` did to one highlight, or\nwould do.",
        "required": [
          "action",
          "highlight",
          "dry_run"
        ],
        "properties": {
          "action": {
            "type": "string",
            "description": "`note` or `remove`."
          },
          "dry_run": {
            "type": "boolean"
          },
          "highlight": {
            "$ref": "#/components/schemas/ReadingHighlightData",
            "description": "The highlight as it is after the change (a removed one, as it was)."
          },
          "mutation_id": {
            "type": [
              "string",
              "null"
            ],
            "description": "For `UndoMutation`; absent on a dry run."
          },
          "previous_note": {
            "type": [
              "string",
              "null"
            ],
            "description": "The note before a `note` change."
          },
          "undo_unavailable": {
            "type": "boolean",
            "description": "It changed but its undo could not be saved."
          }
        }
      },
      "ReadingHighlightData": {
        "type": "object",
        "description": "A saved passage.",
        "required": [
          "id",
          "item_key",
          "account_id",
          "message_id",
          "view",
          "quote",
          "title",
          "source",
          "created_at"
        ],
        "properties": {
          "account_id": {
            "$ref": "#/components/schemas/AccountId"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "id": {
            "type": "string"
          },
          "item_key": {
            "type": "string"
          },
          "message_id": {
            "$ref": "#/components/schemas/MessageId"
          },
          "note": {
            "type": [
              "string",
              "null"
            ]
          },
          "origin": {
            "type": "string",
            "description": "`mxr`, or `marginalia` for one made there and read back."
          },
          "paragraph": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int32",
            "description": "The paragraph it was made in; absent for older highlights, which\nmark the first match.",
            "minimum": 0
          },
          "quote": {
            "type": "string"
          },
          "source": {
            "type": "string"
          },
          "title": {
            "type": "string",
            "description": "The item's title and source, as of saving."
          },
          "url": {
            "type": [
              "string",
              "null"
            ]
          },
          "view": {
            "type": "string",
            "description": "`issue` or `article`: which text it was taken from."
          }
        }
      },
      "ReadingHighlightNoteBody": {
        "type": "object",
        "description": "Body of `POST /api/v1/mail/reading/highlights/{id}/note`.",
        "required": [
          "note"
        ],
        "properties": {
          "dry_run": {
            "type": "boolean",
            "description": "Name the highlight it would change without changing it."
          },
          "note": {
            "type": "string",
            "description": "The whole note. Required: an empty or blank string clears it, and\n`null` or a missing field is refused rather than read as a clear."
          }
        }
      },
      "ReadingHighlightRemoveBody": {
        "type": "object",
        "description": "Body of `POST /api/v1/mail/reading/highlights/{id}/remove`.",
        "properties": {
          "dry_run": {
            "type": "boolean",
            "description": "Name the highlight it would remove without removing it."
          }
        }
      },
      "ReadingItemData": {
        "type": "object",
        "description": "One readable item in the edition or on Later.",
        "required": [
          "item_key",
          "account_id",
          "message_id",
          "thread_id",
          "kind",
          "shape",
          "title",
          "source",
          "sender_email",
          "words",
          "minutes",
          "arrived_at",
          "why",
          "on_later",
          "progress",
          "opened",
          "finished",
          "article_cached"
        ],
        "properties": {
          "account_id": {
            "$ref": "#/components/schemas/AccountId"
          },
          "arrived_at": {
            "type": "string",
            "format": "date-time"
          },
          "article_cached": {
            "type": "boolean"
          },
          "domain": {
            "type": [
              "string",
              "null"
            ]
          },
          "engagement": {
            "type": [
              "string",
              "null"
            ],
            "description": "\"you read 9 of 10\""
          },
          "expires_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "When it leaves the edition. Absent on Later, which never expires."
          },
          "fades": {
            "type": [
              "string",
              "null"
            ],
            "description": "\"Fades Sunday unless you keep it.\"; absent on Later."
          },
          "finished": {
            "type": "boolean"
          },
          "item_key": {
            "type": "string",
            "description": "`<message id>:<index>`; index 0 is the issue."
          },
          "kind": {
            "$ref": "#/components/schemas/ReadingItemKindData"
          },
          "later_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "lead": {
            "type": "boolean",
            "description": "One of the top items, from a source you read most or a new one."
          },
          "links": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ReadingLinkData"
            },
            "description": "A digest's links, in order."
          },
          "message_id": {
            "$ref": "#/components/schemas/MessageId"
          },
          "minutes": {
            "type": "integer",
            "format": "int32",
            "description": "Minutes at your pace.",
            "minimum": 0
          },
          "on_later": {
            "type": "boolean"
          },
          "opened": {
            "type": "boolean"
          },
          "progress": {
            "type": "number",
            "format": "double",
            "description": "How far you got, 0 to 1."
          },
          "sender_email": {
            "type": "string"
          },
          "shape": {
            "$ref": "#/components/schemas/ReadingShapeData",
            "description": "The issue's shape (a link carries its issue's)."
          },
          "source": {
            "type": "string"
          },
          "source_filed_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "The source email left the inbox outside mxr; this item stays in Reading."
          },
          "standfirst": {
            "type": [
              "string",
              "null"
            ],
            "description": "The issue's first real paragraph, or the link's blurb."
          },
          "still_want_it": {
            "type": "boolean",
            "description": "On Later for over 30 days and not yet asked: \"Still want it?\""
          },
          "thread_id": {
            "$ref": "#/components/schemas/ThreadId"
          },
          "title": {
            "type": "string",
            "description": "The cleaned headline, or the link's title."
          },
          "tracked": {
            "type": "boolean"
          },
          "unsubscribe_offer": {
            "type": [
              "string",
              "null"
            ],
            "description": "The source's evidence when it suggests unsubscribing."
          },
          "url": {
            "type": [
              "string",
              "null"
            ],
            "description": "The article this item points at: a teaser's main link, a digest\nlink's page."
          },
          "why": {
            "type": "string",
            "description": "\"Here because: you subscribed, and it has an unsubscribe link\n(rule). Fades Sunday unless you keep it.\""
          },
          "words": {
            "type": "integer",
            "format": "int32",
            "description": "Words in the issue's body; 0 for a link until its article is saved.",
            "minimum": 0
          }
        }
      },
      "ReadingItemDetailData": {
        "type": "object",
        "description": "Returned by `Request::GetReadingItem`: the reader's page.",
        "required": [
          "item",
          "source_data",
          "paragraphs",
          "highlights",
          "minutes_left",
          "pace_wpm"
        ],
        "properties": {
          "article": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/ReadingArticleData",
                "description": "The saved article, when there is one."
              },
              {
                "type": "null"
              }
            ]
          },
          "article_error": {
            "type": [
              "string",
              "null"
            ],
            "description": "Why the last fetch failed, kept so the reader can offer the browser."
          },
          "highlights": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ReadingHighlightData"
            }
          },
          "html": {
            "type": [
              "string",
              "null"
            ],
            "description": "The issue as cleaned HTML when the cleaner kept most of it;\nuntrusted, so clients sanitize it."
          },
          "item": {
            "$ref": "#/components/schemas/ReadingItemData"
          },
          "marginalia": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/ReadingMarginaliaData",
                "description": "The Marginalia article it became, when it was sent there."
              },
              {
                "type": "null"
              }
            ]
          },
          "minutes_left": {
            "type": "integer",
            "format": "int32",
            "description": "Minutes left at your pace, from your progress.",
            "minimum": 0
          },
          "pace_wpm": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "paragraphs": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ReadingParagraphData"
            },
            "description": "The issue as reader text, masthead and footer removed."
          },
          "source_data": {
            "$ref": "#/components/schemas/ReadingSourceData"
          }
        }
      },
      "ReadingItemKindData": {
        "type": "string",
        "description": "An issue, or one link inside a digest.",
        "enum": [
          "issue",
          "link"
        ]
      },
      "ReadingLaterBody": {
        "type": "object",
        "description": "Body of `POST /api/v1/mail/reading/later`.",
        "required": [
          "item_keys"
        ],
        "properties": {
          "dry_run": {
            "type": "boolean"
          },
          "item_keys": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "`<message id>:<index>` keys."
          },
          "later": {
            "type": "boolean",
            "description": "True puts them on Later (or keeps them); false takes them off."
          }
        }
      },
      "ReadingLaterOutcomeData": {
        "type": "object",
        "description": "What `SetReadingLater` did to one item, or would do.",
        "required": [
          "item_key",
          "on_later",
          "changed"
        ],
        "properties": {
          "changed": {
            "type": "boolean",
            "description": "Whether this request changed it."
          },
          "error": {
            "type": [
              "string",
              "null"
            ]
          },
          "item_key": {
            "type": "string"
          },
          "on_later": {
            "type": "boolean"
          },
          "title": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "ReadingLinkData": {
        "type": "object",
        "description": "A link inside a digest, shown under its issue.",
        "required": [
          "item_key",
          "title",
          "url",
          "domain",
          "tracked",
          "on_later",
          "article_cached"
        ],
        "properties": {
          "article_cached": {
            "type": "boolean",
            "description": "Its article is saved, so it reads offline."
          },
          "blurb": {
            "type": [
              "string",
              "null"
            ]
          },
          "domain": {
            "type": "string",
            "description": "`sqlite.org`, or the click tracker's domain when `tracked`."
          },
          "item_key": {
            "type": "string"
          },
          "on_later": {
            "type": "boolean"
          },
          "title": {
            "type": "string"
          },
          "tracked": {
            "type": "boolean",
            "description": "The link goes through a click tracker: the article's own site is\nonly known once it is fetched."
          },
          "url": {
            "type": "string"
          }
        }
      },
      "ReadingMarginaliaData": {
        "type": "object",
        "description": "The Marginalia article an item became.",
        "required": [
          "article_id",
          "read_url",
          "sent_at"
        ],
        "properties": {
          "article_id": {
            "type": "string"
          },
          "highlights_synced_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "When its highlights were last read back."
          },
          "read_url": {
            "type": "string",
            "description": "Where it opens in Marginalia."
          },
          "sent_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "ReadingParagraphData": {
        "type": "object",
        "description": "One paragraph of reader text.",
        "required": [
          "kind",
          "text"
        ],
        "properties": {
          "kind": {
            "type": "string",
            "description": "`heading`, `text`, `list_item` or `quote`."
          },
          "text": {
            "type": "string"
          }
        }
      },
      "ReadingShapeData": {
        "type": "string",
        "description": "What an issue is, by the extractor's rules.",
        "enum": [
          "single",
          "digest",
          "teaser",
          "notice"
        ]
      },
      "ReadingSourceBody": {
        "type": "object",
        "description": "Body of `POST /api/v1/mail/reading/sources`.",
        "required": [
          "account_id",
          "sender_email"
        ],
        "properties": {
          "account_id": {
            "type": "string"
          },
          "dismiss_unsubscribe_offer": {
            "type": "boolean",
            "description": "Stop offering to unsubscribe from this source."
          },
          "original_layout": {
            "type": [
              "boolean",
              "null"
            ],
            "description": "Show the sender's own layout for this source."
          },
          "sender_email": {
            "type": "string"
          }
        }
      },
      "ReadingSourceData": {
        "type": "object",
        "description": "Where an item came from, and how you read it.",
        "required": [
          "account_id",
          "sender_email",
          "name",
          "issues",
          "opened",
          "finished",
          "evidence",
          "affinity",
          "window_days",
          "new_source",
          "original_layout",
          "unsubscribe",
          "suggest_unsubscribe"
        ],
        "properties": {
          "account_id": {
            "$ref": "#/components/schemas/AccountId"
          },
          "affinity": {
            "type": "number",
            "format": "double",
            "description": "Finished issues count three times an open, over issues sent."
          },
          "evidence": {
            "type": "string",
            "description": "\"You opened 0 of the last 11 issues.\""
          },
          "finished": {
            "type": "integer",
            "format": "int32",
            "description": "Of those, read to the end in mxr.",
            "minimum": 0
          },
          "issues": {
            "type": "integer",
            "format": "int32",
            "description": "Recent issues the counts below cover (at most the last 20, 90 days).",
            "minimum": 0
          },
          "median_gap_days": {
            "type": [
              "number",
              "null"
            ],
            "format": "double",
            "description": "Its usual gap between issues, when it has sent two or more."
          },
          "name": {
            "type": "string",
            "description": "The publication's name: the sender's display name, else the address."
          },
          "new_source": {
            "type": "boolean",
            "description": "Three issues or fewer: it gets a lead slot."
          },
          "opened": {
            "type": "integer",
            "format": "int32",
            "description": "Of those, opened in mxr or read elsewhere.",
            "minimum": 0
          },
          "original_layout": {
            "type": "boolean",
            "description": "You chose the sender's own layout for this source (`R`)."
          },
          "sender_email": {
            "type": "string"
          },
          "suggest_unsubscribe": {
            "type": "boolean",
            "description": "Eight or more recent issues and none opened: offer to unsubscribe."
          },
          "unsubscribe": {
            "$ref": "#/components/schemas/ReadingUnsubscribeData"
          },
          "window_days": {
            "type": "number",
            "format": "double",
            "description": "How long its items stay: twice its usual gap, 2 to 14 days."
          }
        }
      },
      "ReadingUnsubscribeData": {
        "type": "string",
        "description": "How a source can be left: told directly, or a page to open.",
        "enum": [
          "one_click",
          "link",
          "mailto",
          "none"
        ]
      },
      "RebuildRelationshipsRequest": {
        "type": "object",
        "description": "Rebuild every contact with mail in the window, or count them on a dry run.",
        "properties": {
          "account_id": {
            "type": [
              "string",
              "null"
            ],
            "description": "One account; all accounts when absent."
          },
          "dry_run": {
            "type": "boolean",
            "description": "Count contacts and model calls without writing or calling the model."
          },
          "since_days": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int32",
            "description": "Window in days; 30 when absent.",
            "minimum": 0
          }
        }
      },
      "RebuildRelationshipsResponse": {
        "type": "object",
        "required": [
          "summary"
        ],
        "properties": {
          "summary": {
            "$ref": "#/components/schemas/RelationshipRebuildSummary"
          }
        }
      },
      "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
          }
        }
      },
      "RecordAmountData": {
        "type": "object",
        "required": [
          "minor",
          "currency",
          "display"
        ],
        "properties": {
          "currency": {
            "type": "string",
            "description": "ISO 4217."
          },
          "display": {
            "type": "string",
            "description": "\"£1,249.00\"."
          },
          "minor": {
            "type": "integer",
            "format": "int64",
            "description": "In the currency's minor unit."
          }
        }
      },
      "RecordAnswerCardData": {
        "type": "object",
        "description": "The field the answer box returns.",
        "required": [
          "record",
          "field",
          "label",
          "value",
          "copy"
        ],
        "properties": {
          "copy": {
            "type": "string",
            "description": "What `y` copies."
          },
          "field": {
            "type": "string",
            "description": "reference | amount | issued_at | document"
          },
          "label": {
            "type": "string",
            "description": "\"Booking ref\"."
          },
          "provenance": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/RecordFieldData"
              },
              {
                "type": "null"
              }
            ]
          },
          "record": {
            "$ref": "#/components/schemas/RecordData"
          },
          "value": {
            "type": "string",
            "description": "\"K7QX2M\"."
          }
        }
      },
      "RecordAnswerData": {
        "type": "object",
        "description": "Returned in `ResponseData::RecordAnswer`.",
        "required": [
          "query",
          "asked"
        ],
        "properties": {
          "also": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RecordData"
            },
            "description": "Other records that matched, best first: \"Also matching\"."
          },
          "answer": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/RecordAnswerCardData",
                "description": "The best match's card. In list mode it is the record the list\nhighlights."
              },
              {
                "type": "null"
              }
            ]
          },
          "asked": {
            "type": "string",
            "description": "reference | amount | date | document | any"
          },
          "fallback": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/RecordFallbackData"
              },
              {
                "type": "null"
              }
            ]
          },
          "list": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/RecordAnswerListData",
                "description": "Every match, in list mode. Boxed so the answer stays small next to\nthe other `ResponseData` variants."
              },
              {
                "type": "null"
              }
            ]
          },
          "matching": {
            "type": "integer",
            "format": "int32",
            "description": "How many records matched in all: \"Show all 23 matches\".",
            "minimum": 0
          },
          "mode": {
            "$ref": "#/components/schemas/RecordAnswerModeData"
          },
          "query": {
            "type": "string"
          }
        }
      },
      "RecordAnswerListData": {
        "type": "object",
        "description": "Every record a list-mode query matched, shaped like the ledger.",
        "required": [
          "header",
          "count",
          "offset",
          "records",
          "months",
          "totals",
          "top_record_id"
        ],
        "properties": {
          "count": {
            "type": "integer",
            "format": "int32",
            "description": "Every match, not just this page.",
            "minimum": 0
          },
          "first": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "The oldest and newest match."
          },
          "header": {
            "type": "string",
            "description": "\"Anthropic · 23 records · £412.60\"."
          },
          "issuer": {
            "type": [
              "string",
              "null"
            ],
            "description": "Set when every match has this one issuer: its issuer page."
          },
          "last": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "months": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RecordMonthData"
            },
            "description": "Every month of the matches, newest first, with counts and totals\nover all of them."
          },
          "offset": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "records": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RecordData"
            },
            "description": "This page of the matches, newest first, as the ledger orders them."
          },
          "top_record_id": {
            "type": "string",
            "description": "The best match, which the list highlights."
          },
          "totals": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RecordAmountData"
            },
            "description": "One total per currency over every match, largest first; never\nconverted."
          }
        }
      },
      "RecordAnswerModeData": {
        "type": "string",
        "description": "How the answer box shows what matched.",
        "enum": [
          "answer",
          "list"
        ]
      },
      "RecordChangeData": {
        "type": "object",
        "description": "Returned in `ResponseData::RecordChange`.",
        "required": [
          "dry_run",
          "action",
          "records",
          "message"
        ],
        "properties": {
          "action": {
            "type": "string",
            "description": "file | dismiss | restore | set_field | sender"
          },
          "dry_run": {
            "type": "boolean"
          },
          "message": {
            "type": "string",
            "description": "The toast: \"Filed in Archive.\", never \"Archived\"."
          },
          "records": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RecordData"
            },
            "description": "The records changed, or that would change, as they are (or would\nbe) after."
          },
          "undo": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/RecordUndoData"
              },
              {
                "type": "null"
              }
            ]
          }
        }
      },
      "RecordData": {
        "type": "object",
        "description": "One record: a ledger row, and with `GetRecord` the whole card.",
        "required": [
          "id",
          "account_id",
          "kind",
          "kind_label",
          "reference_label",
          "checked",
          "document_count",
          "source_count",
          "why",
          "origin"
        ],
        "properties": {
          "account_id": {
            "$ref": "#/components/schemas/AccountId"
          },
          "amount": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/RecordAmountData"
              },
              {
                "type": "null"
              }
            ]
          },
          "checked": {
            "type": "boolean",
            "description": "Every money and date field came from schema.org or you."
          },
          "date": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "The ledger date: the transaction's, else the newest email's."
          },
          "delivered_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "detail_line": {
            "type": [
              "string",
              "null"
            ],
            "description": "\"Return by 2 Apr (passed) · Warranty to 3 Mar 2027\"."
          },
          "dismissed": {
            "type": "boolean"
          },
          "document_count": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "documents": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RecordDocumentData"
            },
            "description": "The card only (`GetRecord`): every file and every source email."
          },
          "fields": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RecordFieldData"
            },
            "description": "Every field with its provenance."
          },
          "group": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/RecordGroupData"
              },
              {
                "type": "null"
              }
            ]
          },
          "id": {
            "type": "string"
          },
          "issuer": {
            "type": [
              "string",
              "null"
            ]
          },
          "issuer_records": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int32",
            "description": "The card only: how many other records this issuer has.",
            "minimum": 0
          },
          "kind": {
            "$ref": "#/components/schemas/RecordKindData"
          },
          "kind_label": {
            "type": "string",
            "description": "\"Order\", \"Booking\"."
          },
          "message_id": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/MessageId",
                "description": "The newest source email."
              },
              {
                "type": "null"
              }
            ]
          },
          "origin": {
            "type": "string",
            "description": "schema | rule | delivery | todo | manual | sender"
          },
          "pdf": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/RecordDocumentData",
                "description": "The record's best document, a PDF first."
              },
              {
                "type": "null"
              }
            ]
          },
          "place": {
            "type": [
              "string",
              "null"
            ]
          },
          "reference": {
            "type": [
              "string",
              "null"
            ]
          },
          "reference_label": {
            "type": "string",
            "description": "\"Order\", \"Booking ref\": what the reference is called on this kind."
          },
          "return_by": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "source_count": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "sources": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RecordSourceData"
            }
          },
          "span_end": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "span_start": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "stage_line": {
            "type": [
              "string",
              "null"
            ],
            "description": "An order's stages in one line: \"ordered · shipped · delivered 7 Mar\"."
          },
          "thread_id": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/ThreadId",
                "description": "The newest source email's thread, for \"open the email\"."
              },
              {
                "type": "null"
              }
            ]
          },
          "title": {
            "type": [
              "string",
              "null"
            ],
            "description": "What it is: \"XPS 14 laptop\", \"LHR -> LIS TP1357\". Never the subject\nline when better is known."
          },
          "unchecked_fields": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "The money and date fields still to confirm."
          },
          "valid_until": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "warranty_until": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "why": {
            "type": "string",
            "description": "\"Here because: order confirmation with schema.org markup (checked).\""
          }
        }
      },
      "RecordDismissBody": {
        "type": "object",
        "description": "Body of `POST /api/v1/mail/records/dismiss`.",
        "required": [
          "record_ids"
        ],
        "properties": {
          "dry_run": {
            "type": "boolean"
          },
          "record_ids": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "restore": {
            "type": "boolean",
            "description": "Bring dismissed records back."
          }
        }
      },
      "RecordDocumentData": {
        "type": "object",
        "description": "A file attached to one of the record's emails.",
        "required": [
          "message_id",
          "attachment_id",
          "filename",
          "mime_type",
          "size_bytes",
          "is_pdf",
          "on_disk"
        ],
        "properties": {
          "attachment_id": {
            "type": "string"
          },
          "filename": {
            "type": "string"
          },
          "is_pdf": {
            "type": "boolean"
          },
          "message_id": {
            "$ref": "#/components/schemas/MessageId"
          },
          "mime_type": {
            "type": "string"
          },
          "on_disk": {
            "type": "boolean",
            "description": "Already downloaded, so it opens offline."
          },
          "size_bytes": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          }
        }
      },
      "RecordEditData": {
        "oneOf": [
          {
            "type": "object",
            "description": "Your value for a field: text, an amount (\"£12.50\", \"12.50 EUR\") or a\ndate (\"3 March 2025\", \"2025-03-03\"). It wins over every extracted\nvalue, now and on every re-run.",
            "required": [
              "field",
              "value",
              "op"
            ],
            "properties": {
              "field": {
                "type": "string"
              },
              "op": {
                "type": "string",
                "enum": [
                  "set"
                ]
              },
              "value": {
                "type": "string"
              }
            }
          },
          {
            "type": "object",
            "description": "The extracted value is right: it becomes yours, checked.",
            "required": [
              "field",
              "op"
            ],
            "properties": {
              "field": {
                "type": "string"
              },
              "op": {
                "type": "string",
                "enum": [
                  "confirm"
                ]
              }
            }
          },
          {
            "type": "object",
            "description": "Confirm every unchecked money and date field: the card is checked.",
            "required": [
              "op"
            ],
            "properties": {
              "op": {
                "type": "string",
                "enum": [
                  "confirm_all"
                ]
              }
            }
          },
          {
            "type": "object",
            "description": "Drop your value, so the extracted one shows again.",
            "required": [
              "field",
              "op"
            ],
            "properties": {
              "field": {
                "type": "string"
              },
              "op": {
                "type": "string",
                "enum": [
                  "clear"
                ]
              }
            }
          }
        ],
        "description": "A correction to a record."
      },
      "RecordExportBody": {
        "type": "object",
        "description": "Body of `POST /api/v1/mail/records/export`.",
        "properties": {
          "account_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "attachments_dir": {
            "type": [
              "string",
              "null"
            ],
            "description": "An absolute folder to copy each record's PDF into."
          },
          "dry_run": {
            "type": "boolean"
          },
          "filter": {
            "$ref": "#/components/schemas/RecordFilterData"
          }
        }
      },
      "RecordExportData": {
        "type": "object",
        "description": "Returned in `ResponseData::RecordExport`. The dry run and the export\nread the same rows.",
        "required": [
          "dry_run",
          "rows",
          "totals",
          "unchecked",
          "missing_pdfs",
          "by_kind",
          "summary"
        ],
        "properties": {
          "attachments_dir": {
            "type": [
              "string",
              "null"
            ],
            "description": "Where PDFs were copied, when asked."
          },
          "by_kind": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RecordFacetCountData"
            }
          },
          "csv": {
            "type": [
              "string",
              "null"
            ],
            "description": "The CSV, header first. Only on a real export."
          },
          "dry_run": {
            "type": "boolean"
          },
          "missing_pdfs": {
            "type": "integer",
            "format": "int32",
            "description": "Rows with no PDF.",
            "minimum": 0
          },
          "pdf_errors": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "PDFs that could not be fetched or copied, by filename."
          },
          "pdfs_copied": {
            "type": "integer",
            "format": "int32",
            "description": "PDFs copied there.",
            "minimum": 0
          },
          "rows": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "summary": {
            "type": "string",
            "description": "\"142 records, £18,204.11 and €612.00. 9 have an unchecked amount or\ndate; 31 have no PDF.\""
          },
          "totals": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RecordAmountData"
            },
            "description": "One total per currency, largest first."
          },
          "unchecked": {
            "type": "integer",
            "format": "int32",
            "description": "Rows with an amount or date nobody has confirmed.",
            "minimum": 0
          }
        }
      },
      "RecordFacetCountData": {
        "type": "object",
        "required": [
          "value",
          "label",
          "count"
        ],
        "properties": {
          "count": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "label": {
            "type": "string"
          },
          "value": {
            "type": "string",
            "description": "What to filter by: \"order\", \"dell\", \"2025\"."
          }
        }
      },
      "RecordFacetsData": {
        "type": "object",
        "description": "Counts for each filter value over the matching records.",
        "required": [
          "kinds",
          "issuers",
          "years",
          "has_pdf",
          "checked",
          "unchecked"
        ],
        "properties": {
          "checked": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "has_pdf": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "issuers": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RecordFacetCountData"
            },
            "description": "The thirty issuers with most records."
          },
          "kinds": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RecordFacetCountData"
            }
          },
          "unchecked": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "years": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RecordFacetCountData"
            },
            "description": "Newest first."
          }
        }
      },
      "RecordFallbackData": {
        "type": "object",
        "description": "What the answer box fell back to when no record matched.",
        "required": [
          "note"
        ],
        "properties": {
          "answer": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/ArchiveAnswerData",
                "description": "`mxr ask`'s citation-checked answer, or the retrieved emails when no\nmodel is set up."
              },
              {
                "type": "null"
              }
            ]
          },
          "error": {
            "type": [
              "string",
              "null"
            ],
            "description": "Why the fallback has no answer, when it failed."
          },
          "note": {
            "type": "string",
            "description": "\"No record matches \"warranty dell\". Searching all mail instead.\""
          }
        }
      },
      "RecordFieldBody": {
        "type": "object",
        "description": "Body of `POST /api/v1/mail/records/{record_id}/field`.",
        "required": [
          "edit"
        ],
        "properties": {
          "apply_to_sender": {
            "type": "boolean",
            "description": "With an issuer name: rename this sender's issuer on every record."
          },
          "dry_run": {
            "type": "boolean"
          },
          "edit": {
            "$ref": "#/components/schemas/RecordEditData"
          }
        }
      },
      "RecordFieldData": {
        "type": "object",
        "description": "One field of a record and where its value came from.",
        "required": [
          "field",
          "label",
          "value",
          "copy",
          "source",
          "source_label",
          "checked"
        ],
        "properties": {
          "checked": {
            "type": "boolean",
            "description": "False for money or a date nobody has confirmed. Shown with an open\ndot."
          },
          "copy": {
            "type": "string",
            "description": "What `y` copies: the reference as written, or the amount as a plain\nnumber (\"1249.00\")."
          },
          "evidence": {
            "type": [
              "string",
              "null"
            ],
            "description": "The words it was read from, verbatim, or how it was worked out."
          },
          "field": {
            "type": "string",
            "description": "issuer, title, reference, amount, issued_at, span_start, span_end,\nplace, delivered_at, return_by, warranty_until, valid_until, kind"
          },
          "label": {
            "type": "string",
            "description": "\"Booking ref\", \"Paid\", \"Date\"."
          },
          "message_id": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/MessageId",
                "description": "The email it was read from."
              },
              {
                "type": "null"
              }
            ]
          },
          "source": {
            "type": "string",
            "description": "schema | rule | delivery | todo | user"
          },
          "source_label": {
            "type": "string",
            "description": "\"schema.org markup\", \"a pattern in the email\", \"you\"."
          },
          "value": {
            "type": "string",
            "description": "As shown: \"£1,249.00\", \"3 Mar 2025\", \"K7QX2M\"."
          }
        }
      },
      "RecordFileBody": {
        "type": "object",
        "description": "Body of `POST /api/v1/mail/records/file`.",
        "required": [
          "message_id"
        ],
        "properties": {
          "dry_run": {
            "type": "boolean"
          },
          "kind": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/RecordKindData"
              },
              {
                "type": "null"
              }
            ]
          },
          "message_id": {
            "type": "string"
          }
        }
      },
      "RecordFilterData": {
        "type": "object",
        "description": "Which records a list or an export covers. Every condition is optional.",
        "properties": {
          "checked": {
            "type": [
              "boolean",
              "null"
            ]
          },
          "group_id": {
            "type": [
              "string",
              "null"
            ],
            "description": "A trip or series."
          },
          "has_pdf": {
            "type": [
              "boolean",
              "null"
            ]
          },
          "issuer": {
            "type": [
              "string",
              "null"
            ],
            "description": "An issuer name, matched without case: the issuer page."
          },
          "kinds": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RecordKindData"
            }
          },
          "max_amount_minor": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64"
          },
          "min_amount_minor": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64",
            "description": "In minor units."
          },
          "year": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int32"
          }
        }
      },
      "RecordFirstRunData": {
        "type": "object",
        "description": "Where filing history has got to.",
        "required": [
          "complete",
          "scanned",
          "line"
        ],
        "properties": {
          "complete": {
            "type": "boolean"
          },
          "line": {
            "type": "string",
            "description": "\"Filing your records. 418 found so far, back to March 2023.\""
          },
          "reached": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "The oldest email read so far."
          },
          "scanned": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          }
        }
      },
      "RecordGroupData": {
        "type": "object",
        "description": "The trip or series a record belongs to.",
        "required": [
          "id",
          "kind",
          "title",
          "count"
        ],
        "properties": {
          "count": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "id": {
            "type": "string"
          },
          "kind": {
            "type": "string",
            "description": "trip | series"
          },
          "span_end": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "span_start": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "title": {
            "type": "string",
            "description": "\"Lisbon, June 2025\", \"Octopus Energy bills\"."
          }
        }
      },
      "RecordIssuerData": {
        "type": "object",
        "description": "The issuer page: every record from one issuer.",
        "required": [
          "name",
          "count",
          "totals"
        ],
        "properties": {
          "count": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "first": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "last": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "name": {
            "type": "string"
          },
          "totals": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RecordAmountData"
            }
          }
        }
      },
      "RecordKindData": {
        "type": "string",
        "enum": [
          "receipt",
          "order",
          "booking",
          "invoice",
          "statement",
          "ticket",
          "contract",
          "warranty",
          "account"
        ]
      },
      "RecordLedgerData": {
        "type": "object",
        "description": "Returned in `ResponseData::RecordLedger`.",
        "required": [
          "header",
          "total",
          "matching",
          "records",
          "months",
          "facets",
          "coming_up",
          "filter"
        ],
        "properties": {
          "coming_up": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RecordMomentData"
            },
            "description": "Trips, tickets, return windows and warranties with a moment soon."
          },
          "empty_state": {
            "type": [
              "string",
              "null"
            ],
            "description": "Set when there is nothing to show: the never-had-any copy, or what\nthe filter excluded."
          },
          "facets": {
            "$ref": "#/components/schemas/RecordFacetsData"
          },
          "filter": {
            "$ref": "#/components/schemas/RecordFilterData"
          },
          "first_run": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/RecordFirstRunData"
              },
              {
                "type": "null"
              }
            ]
          },
          "header": {
            "type": "string"
          },
          "issuer": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/RecordIssuerData"
              },
              {
                "type": "null"
              }
            ]
          },
          "matching": {
            "type": "integer",
            "format": "int32",
            "description": "Records the filter matches.",
            "minimum": 0
          },
          "months": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RecordMonthData"
            },
            "description": "Every month of the matching records, newest first, with counts and\ntotals over all of them, not just this page."
          },
          "records": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RecordData"
            },
            "description": "This page of the matching records, newest first."
          },
          "total": {
            "type": "integer",
            "format": "int32",
            "description": "Every record, whatever the filter.",
            "minimum": 0
          }
        }
      },
      "RecordMomentData": {
        "type": "object",
        "description": "A record with a moment coming up.",
        "required": [
          "kind",
          "record_id",
          "at",
          "label"
        ],
        "properties": {
          "at": {
            "type": "string",
            "format": "date-time"
          },
          "group_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "kind": {
            "type": "string",
            "description": "trip | booking | ticket | return_window | warranty, or a\nsubscription's price_change | missed_charge | renewal_approaching\n(then `group_id` is the subscription's id and `record_id` its\nnewest charge)."
          },
          "label": {
            "type": "string",
            "description": "\"Lisbon, June 2025 · in 3 days\", \"Return XPS 14 laptop by Wed\"."
          },
          "record_id": {
            "type": "string"
          }
        }
      },
      "RecordMonthData": {
        "type": "object",
        "description": "One month of the ledger, with its count and totals.",
        "required": [
          "month",
          "label",
          "count",
          "totals"
        ],
        "properties": {
          "count": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "label": {
            "type": "string",
            "description": "\"2025 · March\"."
          },
          "month": {
            "type": "string",
            "description": "\"2025-03\"."
          },
          "totals": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RecordAmountData"
            },
            "description": "One total per currency, largest first. Never converted."
          }
        }
      },
      "RecordPriceChangeData": {
        "type": "object",
        "required": [
          "date",
          "record_id",
          "from",
          "to",
          "label"
        ],
        "properties": {
          "date": {
            "type": "string",
            "format": "date-time",
            "description": "The first charge at the new price."
          },
          "from": {
            "$ref": "#/components/schemas/RecordAmountData"
          },
          "label": {
            "type": "string",
            "description": "\"£10.99 to £12.99 on 10 May 2025\"."
          },
          "record_id": {
            "type": "string"
          },
          "to": {
            "$ref": "#/components/schemas/RecordAmountData"
          }
        }
      },
      "RecordPromiseRequest": {
        "type": "object",
        "required": [
          "message_id",
          "what",
          "due_at"
        ],
        "properties": {
          "dry_run": {
            "type": "boolean",
            "description": "Return what would be stored without writing it."
          },
          "due_at": {
            "type": "string",
            "format": "date-time",
            "description": "The chosen time, exactly as the time preview returned it."
          },
          "message_id": {
            "type": "string",
            "description": "The sent message the promise is in."
          },
          "what": {
            "type": "string",
            "description": "What was promised, such as \"send the deck\"."
          }
        }
      },
      "RecordSenderBody": {
        "type": "object",
        "description": "Body of `POST /api/v1/mail/records/sender`.",
        "required": [
          "message_id"
        ],
        "properties": {
          "dry_run": {
            "type": "boolean"
          },
          "kind": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/RecordKindData"
              },
              {
                "type": "null"
              }
            ]
          },
          "message_id": {
            "type": "string"
          },
          "verdict": {
            "type": [
              "string",
              "null"
            ],
            "description": "`always` or `never`; omitted lets the rules decide again."
          }
        }
      },
      "RecordSourceData": {
        "type": "object",
        "description": "One email a record was built from.",
        "required": [
          "message_id",
          "stage",
          "date",
          "subject",
          "filed_by"
        ],
        "properties": {
          "date": {
            "type": "string",
            "format": "date-time"
          },
          "filed_by": {
            "type": "string",
            "description": "detector | delivery | todo | manual | sender"
          },
          "message_id": {
            "$ref": "#/components/schemas/MessageId"
          },
          "stage": {
            "type": "string",
            "description": "confirmation | shipped | delivered | return | refund | invoice |\nstatement | booking | change | cancellation | receipt | other"
          },
          "subject": {
            "type": "string"
          },
          "thread_id": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/ThreadId"
              },
              {
                "type": "null"
              }
            ]
          }
        }
      },
      "RecordSubscriptionChargeData": {
        "type": "object",
        "description": "One charge of a subscription: a record, or a receipt and an invoice\nfor the same payment.",
        "required": [
          "record_ids",
          "date",
          "checked"
        ],
        "properties": {
          "amount": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/RecordAmountData"
              },
              {
                "type": "null"
              }
            ]
          },
          "checked": {
            "type": "boolean",
            "description": "Its amount and date came from schema.org or you."
          },
          "date": {
            "type": "string",
            "format": "date-time"
          },
          "record_ids": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "RecordSubscriptionData": {
        "type": "object",
        "description": "One subscription: the row and, with its history, the card.",
        "required": [
          "id",
          "account_id",
          "issuer",
          "title",
          "cadence",
          "cadence_label",
          "start",
          "last_charge",
          "status",
          "status_reason",
          "confirmed",
          "charge_count",
          "charges",
          "fields",
          "one_offs",
          "record_id",
          "why"
        ],
        "properties": {
          "account_id": {
            "$ref": "#/components/schemas/AccountId"
          },
          "amount": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/RecordAmountData",
                "description": "The newest charge's amount."
              },
              {
                "type": "null"
              }
            ]
          },
          "cadence": {
            "type": "string",
            "description": "weekly | monthly | quarterly | yearly"
          },
          "cadence_label": {
            "type": "string",
            "description": "\"Monthly\"."
          },
          "charge_count": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "charges": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RecordSubscriptionChargeData"
            },
            "description": "Oldest first."
          },
          "confirmed": {
            "type": "boolean",
            "description": "Three charges or more. A yearly one seen twice is not yet."
          },
          "fields": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RecordFieldData"
            },
            "description": "Every field with where it came from: issuer, product, cadence,\namount, yearly_cost, start, last_charge, next_expected, status."
          },
          "id": {
            "type": "string",
            "description": "`sub_…`: stable while its first charge stays."
          },
          "issuer": {
            "type": "string"
          },
          "last_charge": {
            "type": "string",
            "format": "date-time"
          },
          "message_id": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/MessageId",
                "description": "The newest charge's newest email."
              },
              {
                "type": "null"
              }
            ]
          },
          "next_expected": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "Not set once it has ended."
          },
          "one_offs": {
            "type": "integer",
            "format": "int32",
            "description": "The issuer's receipts and invoices that are not part of any\nsubscription.",
            "minimum": 0
          },
          "price_changes": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RecordPriceChangeData"
            },
            "description": "Oldest first."
          },
          "product": {
            "type": [
              "string",
              "null"
            ],
            "description": "\"Premium\", when the receipts name it."
          },
          "record_id": {
            "type": "string",
            "description": "The newest charge's record, for \"open the record\"."
          },
          "start": {
            "type": "string",
            "format": "date-time"
          },
          "status": {
            "type": "string",
            "description": "active | overdue | ended"
          },
          "status_reason": {
            "type": "string",
            "description": "\"6 charges about a month apart since Jan 2025\", \"Expected around\n3 May 2025; no charge since 3 Apr 2025\", \"Cancellation email on\n20 Mar 2025\"."
          },
          "thread_id": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/ThreadId",
                "description": "The newest charge's thread, for \"open the email\"."
              },
              {
                "type": "null"
              }
            ]
          },
          "title": {
            "type": "string",
            "description": "\"Spotify Premium\", or the issuer alone."
          },
          "why": {
            "type": "string",
            "description": "\"Here because: 6 receipts from Spotify about a month apart\n(worked out from your records).\""
          },
          "yearly_cost": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/RecordAmountData",
                "description": "The amount times the charges in a year."
              },
              {
                "type": "null"
              }
            ]
          }
        }
      },
      "RecordSubscriptionSignalData": {
        "type": "object",
        "description": "Something about a subscription worth a look: a price change on the\nnewest charge, an expected charge that didn't come, or a yearly\nsubscription's next charge within its lead time. A suggestion only;\nnothing here is ever filed as a to-do.",
        "required": [
          "kind",
          "subscription_id",
          "record_id",
          "at",
          "label"
        ],
        "properties": {
          "at": {
            "type": "string",
            "format": "date-time"
          },
          "kind": {
            "type": "string",
            "description": "price_change | missed_charge | renewal_approaching"
          },
          "label": {
            "type": "string",
            "description": "\"Netflix went up from £10.99 to £12.99 on 10 May\",\n\"No Spotify Premium charge since 3 Apr; expected around 3 May\",\n\"Admiral renews around 24 Oct\"."
          },
          "record_id": {
            "type": "string",
            "description": "The newest charge's record."
          },
          "subscription_id": {
            "type": "string"
          }
        }
      },
      "RecordSubscriptionTotalData": {
        "type": "object",
        "description": "What the live subscriptions cost in one currency. Never converted.",
        "required": [
          "currency",
          "per_month",
          "per_year"
        ],
        "properties": {
          "currency": {
            "type": "string"
          },
          "per_month": {
            "$ref": "#/components/schemas/RecordAmountData",
            "description": "The year over twelve."
          },
          "per_year": {
            "$ref": "#/components/schemas/RecordAmountData"
          }
        }
      },
      "RecordSubscriptionsData": {
        "type": "object",
        "description": "Returned in `ResponseData::RecordSubscriptions`.",
        "required": [
          "header",
          "subscriptions",
          "totals",
          "live",
          "ended"
        ],
        "properties": {
          "empty_state": {
            "type": [
              "string",
              "null"
            ]
          },
          "ended": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "header": {
            "type": "string"
          },
          "live": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "signals": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RecordSubscriptionSignalData"
            }
          },
          "subscriptions": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RecordSubscriptionData"
            },
            "description": "Live ones first (active and overdue), then ended, each by issuer."
          },
          "totals": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RecordSubscriptionTotalData"
            },
            "description": "Over the live ones, per currency, largest first."
          }
        }
      },
      "RecordUndoData": {
        "type": "object",
        "description": "How `u` reverses a record change.",
        "required": [
          "kind",
          "record_ids"
        ],
        "properties": {
          "fields": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "kind": {
            "type": "string",
            "description": "restore | dismiss | clear_fields | sender"
          },
          "record_ids": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "RecoverSendBody": {
        "type": "object",
        "required": [
          "dry_run"
        ],
        "properties": {
          "dry_run": {
            "type": "boolean"
          },
          "expected_evidence_sha256": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "RecoveredComposeSession": {
        "type": "object",
        "required": [
          "draft_path",
          "draft_id",
          "attachment_paths"
        ],
        "properties": {
          "attachment_paths": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Confirmed recovery paths in submitted attachment order."
          },
          "draft_id": {
            "$ref": "#/components/schemas/DraftId"
          },
          "draft_path": {
            "type": "string"
          },
          "revision": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64"
          }
        }
      },
      "RecoveredDraftData": {
        "type": "object",
        "required": [
          "draft_id",
          "account_id",
          "revision",
          "subject"
        ],
        "properties": {
          "account_id": {
            "$ref": "#/components/schemas/AccountId"
          },
          "draft_id": {
            "$ref": "#/components/schemas/DraftId"
          },
          "prepared_draft_id": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/DraftId"
              },
              {
                "type": "null"
              }
            ]
          },
          "revision": {
            "type": "integer",
            "format": "int64"
          },
          "subject": {
            "type": "string"
          }
        }
      },
      "RecoveryActionData": {
        "type": "object",
        "required": [
          "status",
          "dry_run"
        ],
        "properties": {
          "dry_run": {
            "type": "boolean"
          },
          "prepared_draft": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/Draft"
              },
              {
                "type": "null"
              }
            ]
          },
          "status": {
            "$ref": "#/components/schemas/RecoveryStatusData"
          }
        }
      },
      "RecoveryActivateBody": {
        "type": "object",
        "required": [
          "expected_workspace",
          "source_owner_stopped",
          "confirm"
        ],
        "properties": {
          "confirm": {
            "type": "boolean"
          },
          "expected_workspace": {
            "$ref": "#/components/schemas/ArchiveWorkspaceData"
          },
          "source_owner_stopped": {
            "type": "boolean"
          }
        }
      },
      "RecoveryPrepareBody": {
        "type": "object",
        "required": [
          "expected_workspace",
          "draft_id",
          "expected_revision",
          "confirm"
        ],
        "properties": {
          "confirm": {
            "type": "boolean"
          },
          "draft_id": {
            "type": "string"
          },
          "expected_revision": {
            "type": "integer",
            "format": "int64"
          },
          "expected_workspace": {
            "$ref": "#/components/schemas/ArchiveWorkspaceData"
          }
        }
      },
      "RecoveryStatusData": {
        "type": "object",
        "required": [
          "workspace_id",
          "recovery_generation",
          "restore_pending",
          "source_owner_stopped",
          "retired_intentions",
          "retained_intentions",
          "held_drafts"
        ],
        "properties": {
          "held_drafts": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RecoveredDraftData"
            }
          },
          "recovery_generation": {
            "type": "string"
          },
          "restore_pending": {
            "type": "boolean"
          },
          "retained_intentions": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RetainedIntentData"
            }
          },
          "retired_intentions": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "source_owner_stopped": {
            "type": "boolean"
          },
          "workspace_id": {
            "type": "string"
          }
        }
      },
      "RecurringSyncError": {
        "type": "object",
        "description": "One normalised failure message that recurred within an account's recent\nsync history.",
        "required": [
          "message",
          "count",
          "last_seen_at"
        ],
        "properties": {
          "count": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "last_seen_at": {
            "type": "string"
          },
          "message": {
            "type": "string"
          }
        }
      },
      "RegisteredClient": {
        "type": "object",
        "required": [
          "capabilities",
          "client_id",
          "name",
          "created_at",
          "expires_at"
        ],
        "properties": {
          "capabilities": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RemoteCapability"
            }
          },
          "client_id": {
            "type": "string"
          },
          "created_at": {
            "type": "integer",
            "format": "int64"
          },
          "expires_at": {
            "type": "integer",
            "format": "int64"
          },
          "name": {
            "type": "string"
          },
          "revoked_at": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64"
          }
        }
      },
      "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": [
              {
                "$ref": "#/components/schemas/RelationshipDriftData"
              },
              {
                "type": "null"
              }
            ]
          },
          "email": {
            "type": "string"
          },
          "open_commitments": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CommitmentData"
            }
          },
          "style": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/ContactStyleData"
              },
              {
                "type": "null"
              }
            ]
          },
          "summary": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/ContactRelationshipSummaryData"
              },
              {
                "type": "null"
              }
            ]
          }
        }
      },
      "RelationshipRebuildSummary": {
        "type": "object",
        "description": "Result of a `RebuildRelationshipProfiles` run.",
        "required": [
          "contacts",
          "model_calls",
          "errors",
          "dry_run"
        ],
        "properties": {
          "contacts": {
            "type": "integer",
            "format": "int32",
            "description": "Contacts with mail in the window.",
            "minimum": 0
          },
          "dry_run": {
            "type": "boolean",
            "description": "Whether this was a preview (no writes, no model calls)."
          },
          "errors": {
            "type": "integer",
            "format": "int32",
            "description": "Contacts whose rebuild failed.",
            "minimum": 0
          },
          "model_calls": {
            "type": "integer",
            "format": "int32",
            "description": "Contacts whose mail went to the model, or on a dry run would go on a\nworking endpoint.",
            "minimum": 0
          }
        }
      },
      "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"
            ]
          }
        }
      },
      "RemoteCapability": {
        "type": "string",
        "enum": [
          "mail_read",
          "mail_send",
          "mail_triage",
          "mail_ai"
        ]
      },
      "RemotePresence": {
        "type": "object",
        "required": [
          "client_id",
          "session_id",
          "surface",
          "last_seen_at",
          "expires_at",
          "active"
        ],
        "properties": {
          "active": {
            "type": "boolean"
          },
          "client_id": {
            "type": "string"
          },
          "expires_at": {
            "type": "integer",
            "format": "int64"
          },
          "last_seen_at": {
            "type": "integer",
            "format": "int64"
          },
          "session_id": {
            "type": "string"
          },
          "surface": {
            "type": "string"
          }
        }
      },
      "RemoteRequest": {
        "oneOf": [
          {
            "type": "object",
            "description": "Authenticated lease refresh; closing a surface never deregisters its installation.",
            "required": [
              "client_id",
              "mail_secret",
              "session_id",
              "surface",
              "action"
            ],
            "properties": {
              "action": {
                "type": "string",
                "enum": [
                  "TouchSession"
                ]
              },
              "client_id": {
                "type": "string"
              },
              "mail_secret": {
                "$ref": "#/components/schemas/RemoteSecret"
              },
              "session_id": {
                "type": "string"
              },
              "surface": {
                "type": "string"
              }
            }
          },
          {
            "type": "object",
            "required": [
              "client_id",
              "mail_secret",
              "session_id",
              "action"
            ],
            "properties": {
              "action": {
                "type": "string",
                "enum": [
                  "CloseSession"
                ]
              },
              "client_id": {
                "type": "string"
              },
              "mail_secret": {
                "$ref": "#/components/schemas/RemoteSecret"
              },
              "session_id": {
                "type": "string"
              }
            }
          },
          {
            "type": "object",
            "required": [
              "action"
            ],
            "properties": {
              "action": {
                "type": "string",
                "enum": [
                  "Sessions"
                ]
              }
            }
          },
          {
            "type": "object",
            "required": [
              "dry_run",
              "deadline_seconds",
              "action"
            ],
            "properties": {
              "action": {
                "type": "string",
                "enum": [
                  "Drain"
                ]
              },
              "deadline_seconds": {
                "type": "integer",
                "format": "int32",
                "minimum": 0
              },
              "dry_run": {
                "type": "boolean"
              }
            }
          },
          {
            "type": "object",
            "required": [
              "action"
            ],
            "properties": {
              "action": {
                "type": "string",
                "enum": [
                  "ResumeHosting"
                ]
              }
            }
          },
          {
            "type": "object",
            "required": [
              "client_id",
              "mail_secret",
              "action"
            ],
            "properties": {
              "action": {
                "type": "string",
                "enum": [
                  "IssueBrowserCode"
                ]
              },
              "client_id": {
                "type": "string"
              },
              "mail_secret": {
                "$ref": "#/components/schemas/RemoteSecret"
              }
            }
          },
          {
            "type": "object",
            "required": [
              "code",
              "action"
            ],
            "properties": {
              "action": {
                "type": "string",
                "enum": [
                  "ClaimBrowserCode"
                ]
              },
              "code": {
                "$ref": "#/components/schemas/RemoteSecret"
              },
              "replace_session": {
                "type": [
                  "array",
                  "null"
                ],
                "items": false,
                "prefixItems": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "string",
                    "description": "Credential or verifier on the wire. Debug output never reveals its contents."
                  }
                ]
              }
            }
          },
          {
            "type": "object",
            "required": [
              "action"
            ],
            "properties": {
              "action": {
                "type": "string",
                "enum": [
                  "Status"
                ]
              }
            }
          },
          {
            "type": "object",
            "required": [
              "action"
            ],
            "properties": {
              "action": {
                "type": "string",
                "enum": [
                  "Pairings"
                ]
              }
            }
          },
          {
            "type": "object",
            "required": [
              "action"
            ],
            "properties": {
              "action": {
                "type": "string",
                "enum": [
                  "Clients"
                ]
              }
            }
          },
          {
            "type": "object",
            "required": [
              "name",
              "capabilities",
              "mail_verifier",
              "cleanup_verifier",
              "action"
            ],
            "properties": {
              "action": {
                "type": "string",
                "enum": [
                  "StartPairing"
                ]
              },
              "capabilities": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/RemoteCapability"
                }
              },
              "cleanup_verifier": {
                "$ref": "#/components/schemas/RemoteSecret"
              },
              "mail_verifier": {
                "$ref": "#/components/schemas/RemoteSecret"
              },
              "name": {
                "type": "string"
              }
            }
          },
          {
            "type": "object",
            "required": [
              "request_id",
              "dry_run",
              "action"
            ],
            "properties": {
              "action": {
                "type": "string",
                "enum": [
                  "ApprovePairing"
                ]
              },
              "dry_run": {
                "type": "boolean"
              },
              "request_id": {
                "type": "string"
              }
            }
          },
          {
            "type": "object",
            "required": [
              "request_id",
              "mail_secret",
              "cleanup_secret",
              "action"
            ],
            "properties": {
              "action": {
                "type": "string",
                "enum": [
                  "ClaimPairing"
                ]
              },
              "cleanup_secret": {
                "$ref": "#/components/schemas/RemoteSecret"
              },
              "mail_secret": {
                "$ref": "#/components/schemas/RemoteSecret"
              },
              "request_id": {
                "type": "string"
              }
            }
          },
          {
            "type": "object",
            "required": [
              "client_id",
              "mail_secret",
              "action"
            ],
            "properties": {
              "action": {
                "type": "string",
                "enum": [
                  "Authenticate"
                ]
              },
              "client_id": {
                "type": "string"
              },
              "mail_secret": {
                "$ref": "#/components/schemas/RemoteSecret"
              }
            }
          },
          {
            "type": "object",
            "required": [
              "client_id",
              "dry_run",
              "action"
            ],
            "properties": {
              "action": {
                "type": "string",
                "enum": [
                  "RevokeClient"
                ]
              },
              "client_id": {
                "type": "string"
              },
              "dry_run": {
                "type": "boolean"
              }
            }
          },
          {
            "type": "object",
            "required": [
              "cleanup_secret",
              "action"
            ],
            "properties": {
              "action": {
                "type": "string",
                "enum": [
                  "AbandonPairing"
                ]
              },
              "cleanup_secret": {
                "$ref": "#/components/schemas/RemoteSecret"
              }
            }
          },
          {
            "type": "object",
            "required": [
              "client_id",
              "cleanup_secret",
              "action"
            ],
            "properties": {
              "action": {
                "type": "string",
                "enum": [
                  "Cleanup"
                ]
              },
              "cleanup_secret": {
                "$ref": "#/components/schemas/RemoteSecret"
              },
              "client_id": {
                "type": "string"
              }
            }
          }
        ]
      },
      "RemoteResponse": {
        "oneOf": [
          {
            "type": "object",
            "required": [
              "status",
              "result"
            ],
            "properties": {
              "result": {
                "type": "string",
                "enum": [
                  "Sessions"
                ]
              },
              "status": {
                "$ref": "#/components/schemas/RemoteSessions"
              }
            }
          },
          {
            "type": "object",
            "required": [
              "status",
              "registered_clients",
              "scheduled_sends",
              "scheduled_snoozes",
              "scheduled_reminders",
              "active_jobs",
              "active_assistant_turns",
              "dry_run",
              "result"
            ],
            "properties": {
              "active_assistant_turns": {
                "type": "integer",
                "format": "int64",
                "minimum": 0
              },
              "active_jobs": {
                "type": "integer",
                "format": "int64",
                "minimum": 0
              },
              "dry_run": {
                "type": "boolean"
              },
              "registered_clients": {
                "type": "integer",
                "format": "int64",
                "minimum": 0
              },
              "result": {
                "type": "string",
                "enum": [
                  "Drain"
                ]
              },
              "scheduled_reminders": {
                "type": "integer",
                "format": "int64",
                "minimum": 0
              },
              "scheduled_sends": {
                "type": "integer",
                "format": "int64",
                "minimum": 0
              },
              "scheduled_snoozes": {
                "type": "integer",
                "format": "int64",
                "minimum": 0
              },
              "status": {
                "$ref": "#/components/schemas/RemoteSessions"
              }
            }
          },
          {
            "type": "object",
            "required": [
              "code",
              "expires_at",
              "result"
            ],
            "properties": {
              "code": {
                "$ref": "#/components/schemas/RemoteSecret"
              },
              "expires_at": {
                "type": "integer",
                "format": "int64"
              },
              "result": {
                "type": "string",
                "enum": [
                  "BrowserCode"
                ]
              }
            }
          },
          {
            "type": "object",
            "required": [
              "session_id",
              "mail_secret",
              "expires_at",
              "result"
            ],
            "properties": {
              "expires_at": {
                "type": "integer",
                "format": "int64"
              },
              "mail_secret": {
                "$ref": "#/components/schemas/RemoteSecret"
              },
              "result": {
                "type": "string",
                "enum": [
                  "BrowserSession"
                ]
              },
              "session_id": {
                "type": "string"
              }
            }
          },
          {
            "type": "object",
            "required": [
              "authority",
              "result"
            ],
            "properties": {
              "authority": {
                "$ref": "#/components/schemas/HostAuthority"
              },
              "result": {
                "type": "string",
                "enum": [
                  "Status"
                ]
              }
            }
          },
          {
            "type": "object",
            "required": [
              "pairings",
              "result"
            ],
            "properties": {
              "pairings": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/PendingPairing"
                }
              },
              "result": {
                "type": "string",
                "enum": [
                  "Pairings"
                ]
              }
            }
          },
          {
            "type": "object",
            "required": [
              "clients",
              "result"
            ],
            "properties": {
              "clients": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/RegisteredClient"
                }
              },
              "result": {
                "type": "string",
                "enum": [
                  "Clients"
                ]
              }
            }
          },
          {
            "type": "object",
            "required": [
              "pairing",
              "dry_run",
              "result"
            ],
            "properties": {
              "dry_run": {
                "type": "boolean"
              },
              "pairing": {
                "$ref": "#/components/schemas/PendingPairing"
              },
              "result": {
                "type": "string",
                "enum": [
                  "Pairing"
                ]
              }
            }
          },
          {
            "type": "object",
            "required": [
              "client",
              "dry_run",
              "result"
            ],
            "properties": {
              "client": {
                "$ref": "#/components/schemas/RegisteredClient"
              },
              "dry_run": {
                "type": "boolean"
              },
              "result": {
                "type": "string",
                "enum": [
                  "Client"
                ]
              }
            }
          },
          {
            "type": "object",
            "required": [
              "client_id",
              "result"
            ],
            "properties": {
              "client_id": {
                "type": "string"
              },
              "result": {
                "type": "string",
                "enum": [
                  "Cleaned"
                ]
              }
            }
          }
        ]
      },
      "RemoteSecret": {
        "type": "string",
        "description": "Credential or verifier on the wire. Debug output never reveals its contents."
      },
      "RemoteSessions": {
        "type": "object",
        "required": [
          "boot_id",
          "draining",
          "in_flight",
          "sessions"
        ],
        "properties": {
          "boot_id": {
            "type": "string"
          },
          "deadline_at": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64"
          },
          "draining": {
            "type": "boolean"
          },
          "in_flight": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "sessions": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RemotePresence"
            }
          }
        }
      },
      "RenameCategoryBody": {
        "type": "object",
        "required": [
          "category_id",
          "name"
        ],
        "properties": {
          "category_id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          }
        }
      },
      "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",
            "description": "Every forwarded operation authenticates independently; nested wrappers are denied.",
            "required": [
              "client_id",
              "mail_secret",
              "request",
              "cmd"
            ],
            "properties": {
              "client_id": {
                "type": "string"
              },
              "cmd": {
                "type": "string",
                "enum": [
                  "RemoteRead"
                ]
              },
              "expected_workspace": {
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/ArchiveWorkspaceData"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "mail_secret": {
                "$ref": "#/components/schemas/RemoteSecret"
              },
              "request": {
                "$ref": "#/components/schemas/Request"
              }
            }
          },
          {
            "type": "object",
            "required": [
              "cmd"
            ],
            "properties": {
              "cmd": {
                "type": "string",
                "enum": [
                  "GetRemoteReady"
                ]
              }
            }
          },
          {
            "type": "object",
            "description": "Portable compose preview. Declarations are unpersisted; no upload, audit or token is written.",
            "required": [
              "draft",
              "context",
              "pending_attachments",
              "cmd"
            ],
            "properties": {
              "cmd": {
                "type": "string",
                "enum": [
                  "PreviewDraft"
                ]
              },
              "context": {
                "$ref": "#/components/schemas/DraftSafetyContextData"
              },
              "draft": {
                "$ref": "#/components/schemas/Draft"
              },
              "pending_attachments": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/DraftAttachment"
                }
              }
            }
          },
          {
            "type": "object",
            "required": [
              "request",
              "cmd"
            ],
            "properties": {
              "cmd": {
                "type": "string",
                "enum": [
                  "RemoteAuthority"
                ]
              },
              "request": {
                "$ref": "#/components/schemas/RemoteRequest"
              }
            }
          },
          {
            "type": "object",
            "required": [
              "limit",
              "offset",
              "cmd"
            ],
            "properties": {
              "account_id": {
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/AccountId"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "cmd": {
                "type": "string",
                "enum": [
                  "ListEnvelopes"
                ]
              },
              "label_id": {
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/LabelId"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "label_role": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "A system mailbox (`inbox`, `starred`, `sent`, `drafts`, `spam`,\n`trash`, `all_mail`). With no `account_id` it lists that mailbox\nacross every enabled account; with one, that account's. A daemon\nthat knows it prefers it to `label_id`; an older one ignores it\nand lists `label_id`, so callers keep sending both."
              },
              "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": [
                  {
                    "$ref": "#/components/schemas/AccountId"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "cmd": {
                "type": "string",
                "enum": [
                  "ListInvites"
                ]
              },
              "limit": {
                "type": "integer",
                "format": "int32",
                "minimum": 0
              }
            }
          },
          {
            "type": "object",
            "required": [
              "cmd"
            ],
            "properties": {
              "account_id": {
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/AccountId"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "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",
            "description": "Read one bounded chunk of an inline source present in this message's HTML.\nRemote web resources and host file sources cannot be requested.",
            "required": [
              "message_id",
              "source",
              "offset",
              "length",
              "cmd"
            ],
            "properties": {
              "cmd": {
                "type": "string",
                "enum": [
                  "ReadInlineImage"
                ]
              },
              "length": {
                "type": "integer",
                "format": "int32",
                "minimum": 0
              },
              "message_id": {
                "$ref": "#/components/schemas/MessageId"
              },
              "offset": {
                "type": "integer",
                "format": "int64",
                "minimum": 0
              },
              "source": {
                "type": "string"
              }
            }
          },
          {
            "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",
            "description": "Describe an attachment for a path-free, integrity-checked transfer.\nValidate upload declaration without creating a draft, resource or file.",
            "required": [
              "metadata",
              "cmd"
            ],
            "properties": {
              "cmd": {
                "type": "string",
                "enum": [
                  "PreviewDraftAttachment"
                ]
              },
              "metadata": {
                "$ref": "#/components/schemas/DraftAttachment"
              }
            }
          },
          {
            "type": "object",
            "required": [
              "metadata",
              "cmd"
            ],
            "properties": {
              "cmd": {
                "type": "string",
                "enum": [
                  "BeginDraftAttachment"
                ]
              },
              "metadata": {
                "$ref": "#/components/schemas/DraftAttachment"
              }
            }
          },
          {
            "type": "object",
            "required": [
              "draft_id",
              "account_id",
              "resource_id",
              "offset",
              "data_base64",
              "cmd"
            ],
            "properties": {
              "account_id": {
                "$ref": "#/components/schemas/AccountId"
              },
              "cmd": {
                "type": "string",
                "enum": [
                  "WriteDraftAttachmentChunk"
                ]
              },
              "data_base64": {
                "type": "string"
              },
              "draft_id": {
                "$ref": "#/components/schemas/DraftId"
              },
              "offset": {
                "type": "integer",
                "format": "int64",
                "minimum": 0
              },
              "resource_id": {
                "$ref": "#/components/schemas/DraftAttachmentId"
              }
            }
          },
          {
            "type": "object",
            "required": [
              "draft_id",
              "account_id",
              "resource_id",
              "cmd"
            ],
            "properties": {
              "account_id": {
                "$ref": "#/components/schemas/AccountId"
              },
              "cmd": {
                "type": "string",
                "enum": [
                  "FinalizeDraftAttachment"
                ]
              },
              "draft_id": {
                "$ref": "#/components/schemas/DraftId"
              },
              "resource_id": {
                "$ref": "#/components/schemas/DraftAttachmentId"
              }
            }
          },
          {
            "type": "object",
            "required": [
              "message_id",
              "attachment_id",
              "cmd"
            ],
            "properties": {
              "attachment_id": {
                "$ref": "#/components/schemas/AttachmentId"
              },
              "cmd": {
                "type": "string",
                "enum": [
                  "GetAttachmentTransferMetadata"
                ]
              },
              "message_id": {
                "$ref": "#/components/schemas/MessageId"
              }
            }
          },
          {
            "type": "object",
            "description": "Read one bounded range from a previously described attachment.",
            "required": [
              "message_id",
              "attachment_id",
              "offset",
              "length",
              "cmd"
            ],
            "properties": {
              "attachment_id": {
                "$ref": "#/components/schemas/AttachmentId"
              },
              "cmd": {
                "type": "string",
                "enum": [
                  "ReadAttachmentChunk"
                ]
              },
              "length": {
                "type": "integer",
                "format": "int32",
                "minimum": 0
              },
              "message_id": {
                "$ref": "#/components/schemas/MessageId"
              },
              "offset": {
                "type": "integer",
                "format": "int64",
                "minimum": 0
              }
            }
          },
          {
            "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"
              },
              "window": {
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/ThreadWindow",
                    "description": "A bounded page of the thread. Omitted returns every message,\nwhich is what the CLI, TUI and MCP keep asking for."
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            }
          },
          {
            "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": [
                  {
                    "$ref": "#/components/schemas/AccountId"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "cmd": {
                "type": "string",
                "enum": [
                  "ListThreads"
                ]
              },
              "label_id": {
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/LabelId"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "label_role": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "Same meaning as on `ListEnvelopes`."
              },
              "limit": {
                "type": "integer",
                "format": "int32",
                "minimum": 0
              },
              "offset": {
                "type": "integer",
                "format": "int32",
                "minimum": 0
              },
              "sort": {
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/SortOrder"
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            }
          },
          {
            "type": "object",
            "required": [
              "cmd"
            ],
            "properties": {
              "account_id": {
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/AccountId"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "all_accounts": {
                "type": "boolean",
                "description": "With no `account_id`, return every enabled account's labels\ninstead of only the default account's. Ignored when\n`account_id` is set."
              },
              "cmd": {
                "type": "string",
                "enum": [
                  "ListLabels"
                ]
              }
            }
          },
          {
            "type": "object",
            "description": "Unread and total for each system mailbox, summed over the named\naccount or, with none, every enabled account. A daemon that predates\nit answers with an error and callers fall back to summing labels.",
            "required": [
              "cmd"
            ],
            "properties": {
              "account_id": {
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/AccountId"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "cmd": {
                "type": "string",
                "enum": [
                  "SystemMailboxCounts"
                ]
              }
            }
          },
          {
            "type": "object",
            "required": [
              "name",
              "cmd"
            ],
            "properties": {
              "account_id": {
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/AccountId"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "cmd": {
                "type": "string",
                "enum": [
                  "CreateLabel"
                ]
              },
              "color": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "name": {
                "type": "string"
              }
            }
          },
          {
            "type": "object",
            "required": [
              "name",
              "cmd"
            ],
            "properties": {
              "account_id": {
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/AccountId"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "cmd": {
                "type": "string",
                "enum": [
                  "DeleteLabel"
                ]
              },
              "name": {
                "type": "string"
              }
            }
          },
          {
            "type": "object",
            "required": [
              "old",
              "new",
              "cmd"
            ],
            "properties": {
              "account_id": {
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/AccountId"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "cmd": {
                "type": "string",
                "enum": [
                  "RenameLabel"
                ]
              },
              "new": {
                "type": "string"
              },
              "old": {
                "type": "string"
              }
            }
          },
          {
            "type": "object",
            "required": [
              "cmd"
            ],
            "properties": {
              "account_id": {
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/AccountId"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "cmd": {
                "type": "string",
                "enum": [
                  "ListCategories"
                ]
              }
            }
          },
          {
            "type": "object",
            "required": [
              "category_id",
              "limit",
              "offset",
              "cmd"
            ],
            "properties": {
              "account_id": {
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/AccountId"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "category_id": {
                "$ref": "#/components/schemas/CategoryId"
              },
              "cmd": {
                "type": "string",
                "enum": [
                  "ListCategoryMessages"
                ]
              },
              "limit": {
                "type": "integer",
                "format": "int32",
                "minimum": 0
              },
              "offset": {
                "type": "integer",
                "format": "int32",
                "minimum": 0
              }
            }
          },
          {
            "type": "object",
            "required": [
              "message_ids",
              "category_ids",
              "cmd"
            ],
            "properties": {
              "account_id": {
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/AccountId"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "category_ids": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/CategoryId"
                }
              },
              "cmd": {
                "type": "string",
                "enum": [
                  "GetCategoryMemberships"
                ]
              },
              "message_ids": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/MessageId"
                }
              }
            }
          },
          {
            "type": "object",
            "required": [
              "name",
              "cmd"
            ],
            "properties": {
              "cmd": {
                "type": "string",
                "enum": [
                  "CreateCategory"
                ]
              },
              "name": {
                "type": "string"
              }
            }
          },
          {
            "type": "object",
            "required": [
              "name",
              "cmd"
            ],
            "properties": {
              "category_id": {
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/CategoryId"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "cmd": {
                "type": "string",
                "enum": [
                  "PreviewCategoryName"
                ]
              },
              "name": {
                "type": "string"
              }
            }
          },
          {
            "type": "object",
            "required": [
              "category_id",
              "new_name",
              "cmd"
            ],
            "properties": {
              "category_id": {
                "$ref": "#/components/schemas/CategoryId"
              },
              "cmd": {
                "type": "string",
                "enum": [
                  "RenameCategory"
                ]
              },
              "new_name": {
                "type": "string"
              }
            }
          },
          {
            "type": "object",
            "required": [
              "message_ids",
              "add_category_ids",
              "remove_category_ids",
              "cmd"
            ],
            "properties": {
              "account_id": {
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/AccountId"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "add_category_ids": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/CategoryId"
                }
              },
              "cmd": {
                "type": "string",
                "enum": [
                  "PreviewCategoryMembership"
                ]
              },
              "message_ids": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/MessageId"
                }
              },
              "remove_category_ids": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/CategoryId"
                }
              }
            }
          },
          {
            "type": "object",
            "required": [
              "preview_token",
              "cmd"
            ],
            "properties": {
              "cmd": {
                "type": "string",
                "enum": [
                  "ApplyCategoryMembership"
                ]
              },
              "preview_token": {
                "type": "string"
              }
            }
          },
          {
            "type": "object",
            "required": [
              "category_id",
              "cmd"
            ],
            "properties": {
              "category_id": {
                "$ref": "#/components/schemas/CategoryId"
              },
              "cmd": {
                "type": "string",
                "enum": [
                  "PreviewDeleteCategory"
                ]
              }
            }
          },
          {
            "type": "object",
            "required": [
              "preview_token",
              "cmd"
            ],
            "properties": {
              "cmd": {
                "type": "string",
                "enum": [
                  "DeleteCategory"
                ]
              },
              "preview_token": {
                "type": "string"
              }
            }
          },
          {
            "type": "object",
            "required": [
              "mutation_id",
              "cmd"
            ],
            "properties": {
              "cmd": {
                "type": "string",
                "enum": [
                  "UndoCategoryMembership"
                ]
              },
              "mutation_id": {
                "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",
            "description": "Writes only `[accounts.<key>] color/tag`. Unlike `UpsertAccountConfig`\nit never changes `default_account` or the account's other fields.\n`dry_run` computes the same plan and writes nothing.",
            "required": [
              "key",
              "dry_run",
              "cmd"
            ],
            "properties": {
              "cmd": {
                "type": "string",
                "enum": [
                  "SetAccountIdentity"
                ]
              },
              "color": {
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/AccountColor"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "dry_run": {
                "type": "boolean"
              },
              "key": {
                "type": "string"
              },
              "tag": {
                "type": [
                  "string",
                  "null"
                ]
              }
            }
          },
          {
            "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",
            "description": "Preview or apply only the sorting action of a draft rule.",
            "required": [
              "form",
              "cmd"
            ],
            "properties": {
              "cmd": {
                "type": "string",
                "enum": [
                  "RuleTreatment"
                ]
              },
              "form": {
                "$ref": "#/components/schemas/RuleFormData"
              },
              "preview_token": {
                "type": [
                  "string",
                  "null"
                ]
              }
            }
          },
          {
            "type": "object",
            "required": [
              "form",
              "cmd"
            ],
            "properties": {
              "cmd": {
                "type": "string",
                "enum": [
                  "RuleCategories"
                ]
              },
              "delete": {
                "type": "boolean"
              },
              "form": {
                "$ref": "#/components/schemas/RuleFormData"
              },
              "preview_token": {
                "type": [
                  "string",
                  "null"
                ]
              }
            }
          },
          {
            "type": "object",
            "required": [
              "message_id",
              "category_id",
              "cmd"
            ],
            "properties": {
              "category_id": {
                "$ref": "#/components/schemas/CategoryId"
              },
              "cmd": {
                "type": "string",
                "enum": [
                  "ExplainCategoryMembership"
                ]
              },
              "message_id": {
                "$ref": "#/components/schemas/MessageId"
              }
            }
          },
          {
            "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": {
              "account_id": {
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/AccountId"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "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": [
                  {
                    "$ref": "#/components/schemas/AccountId"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "all_accounts": {
                "type": "boolean",
                "description": "With no `account_id`, list every enabled account's senders instead\nof only the default account's. Ignored when `account_id` is set."
              },
              "cmd": {
                "type": "string",
                "enum": [
                  "ListSubscriptions"
                ]
              },
              "limit": {
                "type": "integer",
                "format": "int32",
                "minimum": 0
              }
            }
          },
          {
            "type": "object",
            "required": [
              "group_by",
              "limit",
              "cmd"
            ],
            "properties": {
              "account_id": {
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/AccountId"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "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": [
                  {
                    "$ref": "#/components/schemas/AccountId"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "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": [
                  {
                    "$ref": "#/components/schemas/AccountId"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "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": [
                  {
                    "$ref": "#/components/schemas/AccountId"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "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": [
                  {
                    "$ref": "#/components/schemas/AccountId"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "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": [
                  {
                    "$ref": "#/components/schemas/AccountId"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "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",
            "description": "Rewrite the database file to hand free pages back to the disk and turn\non incremental vacuum. `dry_run` only reports what it would reclaim\nand whether the disk has room. Writes wait while it runs.",
            "required": [
              "dry_run",
              "cmd"
            ],
            "properties": {
              "cmd": {
                "type": "string",
                "enum": [
                  "CompactStore"
                ]
              },
              "dry_run": {
                "type": "boolean"
              }
            }
          },
          {
            "type": "object",
            "required": [
              "direction",
              "cmd"
            ],
            "properties": {
              "account_id": {
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/AccountId"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "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"
                ]
              },
              "dry_run": {
                "type": "boolean",
                "description": "Report what the add would reclassify without writing anything."
              },
              "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"
                ]
              },
              "dry_run": {
                "type": "boolean",
                "description": "Report what the remove would reclassify without writing anything."
              },
              "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",
            "description": "Resolve (and validate ownership of) the effective From address a draft\nwould send from, without sending. `from == None` resolves to the\naccount primary; a `Some` override that the account does not own is\nrejected. The dry-run/preview path uses this so a preview shows exactly\nthe From a real send would use, and fails identically on an unowned one.",
            "required": [
              "account_id",
              "cmd"
            ],
            "properties": {
              "account_id": {
                "$ref": "#/components/schemas/AccountId"
              },
              "cmd": {
                "type": "string",
                "enum": [
                  "ResolveSendFrom"
                ]
              },
              "from": {
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/Address"
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            }
          },
          {
            "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",
            "description": "Re-read `[llm]` from config.toml and apply it to the running daemon,\nfor edits made outside it (`mxr config set llm.*`, a text editor).",
            "required": [
              "cmd"
            ],
            "properties": {
              "cmd": {
                "type": "string",
                "enum": [
                  "ReloadLlmConfig"
                ]
              }
            }
          },
          {
            "type": "object",
            "description": "Store (or replace) a provider key, written by the daemon alone. With\n`dry_run` nothing is stored; the reply says what would change.",
            "required": [
              "provider",
              "key",
              "cmd"
            ],
            "properties": {
              "cmd": {
                "type": "string",
                "enum": [
                  "SetLlmKey"
                ]
              },
              "dry_run": {
                "type": "boolean"
              },
              "key": {
                "$ref": "#/components/schemas/LlmKeySecret"
              },
              "provider": {
                "$ref": "#/components/schemas/LlmProviderData"
              }
            }
          },
          {
            "type": "object",
            "description": "Delete the stored key for a provider. With `dry_run` nothing is\nremoved; the reply says what would change.",
            "required": [
              "provider",
              "cmd"
            ],
            "properties": {
              "cmd": {
                "type": "string",
                "enum": [
                  "RemoveLlmKey"
                ]
              },
              "dry_run": {
                "type": "boolean"
              },
              "provider": {
                "$ref": "#/components/schemas/LlmProviderData"
              }
            }
          },
          {
            "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",
            "description": "Change only the given fields of the chime setting, applied to the\ncurrent setting under the daemon's config lock, so concurrent clients\n(the web, `mxr chimes`) never overwrite each other's other fields.",
            "required": [
              "patch",
              "cmd"
            ],
            "properties": {
              "cmd": {
                "type": "string",
                "enum": [
                  "PatchNotificationChimes"
                ]
              },
              "patch": {
                "$ref": "#/components/schemas/NotificationChimesPatchData"
              }
            }
          },
          {
            "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"
                ]
              },
              "force": {
                "type": "boolean",
                "description": "Re-embed every message even when its stored vectors already look\ncurrent. Defaults to false: an ordinary reindex skips messages\nwhose chunks and embeddings match the active profile."
              }
            }
          },
          {
            "type": "object",
            "required": [
              "cmd"
            ],
            "properties": {
              "cmd": {
                "type": "string",
                "enum": [
                  "BackfillSemantic"
                ]
              }
            }
          },
          {
            "type": "object",
            "required": [
              "name",
              "query",
              "search_mode",
              "cmd"
            ],
            "properties": {
              "account_id": {
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/AccountId"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "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": [
                  {
                    "$ref": "#/components/schemas/SearchMode"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "sort": {
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/SortOrder"
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            }
          },
          {
            "type": "object",
            "required": [
              "name",
              "limit",
              "cmd"
            ],
            "properties": {
              "account_id": {
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/AccountId"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "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": [
                  {
                    "$ref": "#/components/schemas/AccountId"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "cmd": {
                "type": "string",
                "enum": [
                  "Search"
                ]
              },
              "explain": {
                "type": "boolean"
              },
              "limit": {
                "type": "integer",
                "format": "int32",
                "minimum": 0
              },
              "limit_from_config": {
                "type": "boolean",
                "description": "Page size comes from `[search] max_results` on the daemon and `limit`\nis only the fallback for a daemon that does not know this field."
              },
              "mode": {
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/SearchMode"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "offset": {
                "type": "integer",
                "format": "int32",
                "minimum": 0
              },
              "query": {
                "type": "string"
              },
              "sort": {
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/SortOrder",
                    "description": "`None` asks the daemon for `[search] default_sort`."
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            }
          },
          {
            "type": "object",
            "required": [
              "cmd"
            ],
            "properties": {
              "account_id": {
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/AccountId"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "background": {
                "type": "boolean",
                "description": "Answer as soon as the sync has started instead of after it\nfinishes. Defaults to the historical blocking behaviour so an\nolder client's wire bytes keep meaning what they used to."
              },
              "cmd": {
                "type": "string",
                "enum": [
                  "SyncNow"
                ]
              }
            }
          },
          {
            "type": "object",
            "description": "Preview the accounts an explicit global sync would target. This keeps\nthe old `SyncNow { account_id: None }` default-account meaning intact.",
            "required": [
              "cmd"
            ],
            "properties": {
              "cmd": {
                "type": "string",
                "enum": [
                  "PreviewSyncAll"
                ]
              }
            }
          },
          {
            "type": "object",
            "description": "Start or join a background sync for every enabled sync-capable account.",
            "required": [
              "cmd"
            ],
            "properties": {
              "cmd": {
                "type": "string",
                "enum": [
                  "SyncAll"
                ]
              }
            }
          },
          {
            "type": "object",
            "required": [
              "account_id",
              "cmd"
            ],
            "properties": {
              "account_id": {
                "$ref": "#/components/schemas/AccountId"
              },
              "cmd": {
                "type": "string",
                "enum": [
                  "GetSyncStatus"
                ]
              }
            }
          },
          {
            "type": "object",
            "description": "Is the local copy current: the newest message received in any\nmailbox, each account's sync health (last good sync, last error\nwith its kind and retry time) and the last `limit` arrivals with\nthe modes they went to. Omit `account_id` for every account: the\nfreshest mail and the worst sync state. Local reads only. Returns\n`ResponseData::Freshness`.",
            "required": [
              "cmd"
            ],
            "properties": {
              "account_id": {
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/AccountId"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "cmd": {
                "type": "string",
                "enum": [
                  "GetFreshness"
                ]
              },
              "limit": {
                "type": [
                  "integer",
                  "null"
                ],
                "format": "int32",
                "description": "Arrivals to return: default 5, at most 50.",
                "minimum": 0
              }
            }
          },
          {
            "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": [
                  {
                    "$ref": "#/components/schemas/AccountId"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "cmd": {
                "type": "string",
                "enum": [
                  "Count"
                ]
              },
              "mode": {
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/SearchMode"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "query": {
                "type": "string"
              }
            }
          },
          {
            "type": "object",
            "required": [
              "query",
              "group_by",
              "cmd"
            ],
            "properties": {
              "account_id": {
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/AccountId"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "cmd": {
                "type": "string",
                "enum": [
                  "SearchAggregation"
                ]
              },
              "group_by": {
                "$ref": "#/components/schemas/SearchAggregationGroupBy"
              },
              "limit": {
                "type": [
                  "integer",
                  "null"
                ],
                "format": "int32",
                "minimum": 0
              },
              "mode": {
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/SearchMode"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "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": [
                  "GetArchiveWorkspace"
                ]
              }
            }
          },
          {
            "type": "object",
            "required": [
              "cmd"
            ],
            "properties": {
              "cmd": {
                "type": "string",
                "enum": [
                  "GetRecoveryStatus"
                ]
              }
            }
          },
          {
            "type": "object",
            "required": [
              "expected_workspace",
              "source_owner_stopped",
              "dry_run",
              "cmd"
            ],
            "properties": {
              "cmd": {
                "type": "string",
                "enum": [
                  "ActivateRecovery"
                ]
              },
              "dry_run": {
                "type": "boolean"
              },
              "expected_workspace": {
                "$ref": "#/components/schemas/ArchiveWorkspaceData"
              },
              "source_owner_stopped": {
                "type": "boolean"
              }
            }
          },
          {
            "type": "object",
            "required": [
              "draft_id",
              "expected_revision",
              "expected_workspace",
              "dry_run",
              "cmd"
            ],
            "properties": {
              "cmd": {
                "type": "string",
                "enum": [
                  "PrepareRecoveredDraft"
                ]
              },
              "draft_id": {
                "$ref": "#/components/schemas/DraftId"
              },
              "dry_run": {
                "type": "boolean"
              },
              "expected_revision": {
                "type": "integer",
                "format": "int64"
              },
              "expected_workspace": {
                "$ref": "#/components/schemas/ArchiveWorkspaceData"
              }
            }
          },
          {
            "type": "object",
            "required": [
              "identity",
              "mutation",
              "cmd"
            ],
            "properties": {
              "cmd": {
                "type": "string",
                "enum": [
                  "PreviewArchive"
                ]
              },
              "identity": {
                "$ref": "#/components/schemas/ArchiveIdentityData"
              },
              "mutation": {
                "$ref": "#/components/schemas/MutationCommand"
              }
            }
          },
          {
            "type": "object",
            "required": [
              "identity",
              "review_id",
              "mutation",
              "cmd"
            ],
            "properties": {
              "cmd": {
                "type": "string",
                "enum": [
                  "SubmitArchive"
                ]
              },
              "identity": {
                "$ref": "#/components/schemas/ArchiveIdentityData"
              },
              "mutation": {
                "$ref": "#/components/schemas/MutationCommand"
              },
              "review_id": {
                "type": "string"
              }
            }
          },
          {
            "type": "object",
            "required": [
              "identity",
              "cmd"
            ],
            "properties": {
              "cmd": {
                "type": "string",
                "enum": [
                  "GetArchiveOperation"
                ]
              },
              "identity": {
                "$ref": "#/components/schemas/ArchiveIdentityData"
              }
            }
          },
          {
            "type": "object",
            "description": "Resolve `selection` in the daemon and report what `mutation` would\ncover: an exact count, thread and account counts, a sample of the\nnewest messages, and a single-use token. `mutation.message_ids` must be\nempty. Changes nothing; no message id list is returned.",
            "required": [
              "selection",
              "mutation",
              "cmd"
            ],
            "properties": {
              "cmd": {
                "type": "string",
                "enum": [
                  "PreviewSelection"
                ]
              },
              "mutation": {
                "$ref": "#/components/schemas/MutationCommand"
              },
              "sample_size": {
                "type": [
                  "integer",
                  "null"
                ],
                "format": "int32",
                "description": "Sample size; the daemon defaults to 20 and caps at 100.",
                "minimum": 0
              },
              "selection": {
                "$ref": "#/components/schemas/SelectionData"
              }
            }
          },
          {
            "type": "object",
            "description": "Run `mutation` over exactly the messages a `PreviewSelection` counted,\nas one background job. `job_id` is chosen by the client and makes the\nrequest idempotent: a repeat returns the existing job, so a lost reply\nis recovered with `GetJob`. `mutation.message_ids` must be empty and\n`selection` and `mutation` must equal the preview's. The job keeps no\nundo: it cannot be undone, so the preview is the check.",
            "required": [
              "job_id",
              "preview_token",
              "selection",
              "mutation",
              "cmd"
            ],
            "properties": {
              "client_correlation_id": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "cmd": {
                "type": "string",
                "enum": [
                  "StartSelectionJob"
                ]
              },
              "job_id": {
                "type": "string"
              },
              "mutation": {
                "$ref": "#/components/schemas/MutationCommand"
              },
              "preview_token": {
                "type": "string"
              },
              "selection": {
                "$ref": "#/components/schemas/SelectionData"
              }
            }
          },
          {
            "type": "object",
            "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",
            "description": "What `UndoMutation` with this id would reverse, read without changing\nanything. `mxr undo --dry-run` asks this, so it refuses the ids the\nreal undo refuses, with the same messages.",
            "required": [
              "mutation_id",
              "cmd"
            ],
            "properties": {
              "cmd": {
                "type": "string",
                "enum": [
                  "UndoPreview"
                ]
              },
              "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": [
                  {
                    "$ref": "#/components/schemas/AccountId"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "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"
              },
              "preview_token": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "From the dry run. When given, the purge acts on exactly the mail\nthat preview listed, with the method it showed, once; mail that\narrived since is left alone."
              }
            }
          },
          {
            "type": "object",
            "description": "Commit exactly one sender unsubscribe preview. Older daemons reject\nthis variant instead of silently clearing mail when `archive` is false.",
            "required": [
              "address",
              "preview_token",
              "archive",
              "cmd"
            ],
            "properties": {
              "account_id": {
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/AccountId"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "address": {
                "type": "string"
              },
              "archive": {
                "type": "boolean"
              },
              "archive_on_no_method": {
                "type": "boolean"
              },
              "cmd": {
                "type": "string",
                "enum": [
                  "CommitUnsubscribePreview"
                ]
              },
              "preview_token": {
                "type": "string"
              }
            }
          },
          {
            "type": "object",
            "description": "Plans the one unsubscribe request for messages picked by one email\naddress: the newest message with a usable method. On the same date, a\none-click link beats an http(s) link, which beats mailto. Read-only. The\nCLI sends that message through `Unsubscribe`, so the per-message receipt\nstill applies.",
            "required": [
              "message_ids",
              "cmd"
            ],
            "properties": {
              "cmd": {
                "type": "string",
                "enum": [
                  "PlanUnsubscribe"
                ]
              },
              "message_ids": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/MessageId"
                }
              }
            }
          },
          {
            "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"
              },
              "expected_revision": {
                "type": [
                  "integer",
                  "null"
                ],
                "format": "int64"
              },
              "managed_attachments_reviewed": {
                "type": "boolean"
              },
              "send_at": {
                "type": "string",
                "format": "date-time"
              },
              "undo_window": {
                "type": "boolean",
                "description": "A client holds the send for its undo window and will cancel\nthis before it sends. Kept out of the activity log, which\nrecords the send itself."
              }
            }
          },
          {
            "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"
              },
              "undo_window": {
                "type": "boolean"
              }
            }
          },
          {
            "type": "object",
            "description": "List drafts scheduled to send later that have not fired yet,\nsoonest first. `account_id: None` lists every account.",
            "required": [
              "cmd"
            ],
            "properties": {
              "account_id": {
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/AccountId"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "cmd": {
                "type": "string",
                "enum": [
                  "ListScheduledSends"
                ]
              }
            }
          },
          {
            "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": [
                  {
                    "$ref": "#/components/schemas/AccountId"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "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": "Take back the last dismiss or manual resolve of a delivery.",
            "required": [
              "delivery_id",
              "cmd"
            ],
            "properties": {
              "cmd": {
                "type": "string",
                "enum": [
                  "ReopenDelivery"
                ]
              },
              "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": [
                  {
                    "$ref": "#/components/schemas/AccountId"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "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": [
                  {
                    "$ref": "#/components/schemas/AccountId"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "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": [
                  {
                    "$ref": "#/components/schemas/AccountId"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "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": [
                  {
                    "$ref": "#/components/schemas/AccountId"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "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": [
                  {
                    "$ref": "#/components/schemas/AccountId"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "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",
            "description": "Rebuild the relationship profile, summary included, of every\ncontact with mail in the last `since_days` days, backfilled mail\nincluded. Background work summarises only contacts whose mail arrived\nlive; this is how older contacts get one. `dry_run` counts the\ncontacts and model calls without writing or calling the model.",
            "required": [
              "cmd"
            ],
            "properties": {
              "account_id": {
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/AccountId"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "cmd": {
                "type": "string",
                "enum": [
                  "RebuildRelationshipProfiles"
                ]
              },
              "dry_run": {
                "type": "boolean"
              },
              "since_days": {
                "type": "integer",
                "format": "int32",
                "minimum": 0
              }
            }
          },
          {
            "type": "object",
            "required": [
              "account_id",
              "cmd"
            ],
            "properties": {
              "account_id": {
                "$ref": "#/components/schemas/AccountId"
              },
              "cmd": {
                "type": "string",
                "enum": [
                  "ListCommitments"
                ]
              },
              "email": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "status": {
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/CommitmentStatusData"
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            }
          },
          {
            "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"
              },
              "all_senders": {
                "type": "boolean",
                "description": "Every sender ever without a decision, in any folder. The default\nis the set the desk's Screener count counts: inbox mail from\nsenders first seen in the last 14 days, so the count and the\nlist always agree (and `limit` only applies with `all_senders`)."
              },
              "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": [
                  {
                    "$ref": "#/components/schemas/AccountId"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "cmd": {
                "type": "string",
                "enum": [
                  "TriageSearch"
                ]
              },
              "limit": {
                "type": "integer",
                "format": "int32",
                "minimum": 0
              },
              "mode": {
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/SearchMode"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "offset": {
                "type": "integer",
                "format": "int32",
                "minimum": 0
              },
              "query": {
                "type": "string"
              },
              "sort": {
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/SortOrder"
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            }
          },
          {
            "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": [
                  {
                    "$ref": "#/components/schemas/AccountId"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "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": [
                  {
                    "$ref": "#/components/schemas/DraftLengthHintData"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "register": {
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/VoiceRegisterData"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "source_message_id": {
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/MessageId"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "thread_id": {
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/ThreadId"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "to": {
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/Address"
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            }
          },
          {
            "type": "object",
            "required": [
              "draft_id",
              "knobs",
              "cmd"
            ],
            "properties": {
              "body": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "The text to refine, when the editor has changes the stored draft\ndoesn't yet; the stored body otherwise."
              },
              "cmd": {
                "type": "string",
                "enum": [
                  "DraftRefine"
                ]
              },
              "draft_id": {
                "$ref": "#/components/schemas/DraftId"
              },
              "knobs": {
                "$ref": "#/components/schemas/DraftRefineKnobsData"
              }
            }
          },
          {
            "type": "object",
            "description": "Writing help for the text in a draft's body region: write it, finish\nwhat is typed, polish it or edit a selection. Returns a proposal; the\ndraft is not changed until `ApplyComposeProposal`. A separate command\nfrom `DraftCompose`, so a daemon that predates it rejects it as unknown\ninstead of drafting over the typed text.",
            "required": [
              "draft",
              "text",
              "cmd"
            ],
            "properties": {
              "action": {
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/AssistActionData"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "adjust": {
                "$ref": "#/components/schemas/AssistAdjustData"
              },
              "cmd": {
                "type": "string",
                "enum": [
                  "ComposeAssist"
                ]
              },
              "draft": {
                "$ref": "#/components/schemas/DraftTargetData"
              },
              "instruction": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "model": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "A catalogue model for this draft only. Does not change the\npersistent compose default."
              },
              "revise": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "The id of a proposal to revise. The model is shown that proposal's\ntext and the instruction is applied to it; `text` stays the user's\nown text, which the check and the diff still run against. Absent on\na first request."
              },
              "selection": {
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/TextRangeData"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "text": {
                "type": "string",
                "description": "The user's text region only: no signature, no forward header."
              }
            }
          },
          {
            "type": "object",
            "description": "Accept a proposal: write its text into the stored draft's text region,\nkeeping the signature and forward header, if that region still hashes\nto the proposal's `base`.",
            "required": [
              "proposal_id",
              "draft_id",
              "cmd"
            ],
            "properties": {
              "cmd": {
                "type": "string",
                "enum": [
                  "ApplyComposeProposal"
                ]
              },
              "draft_id": {
                "$ref": "#/components/schemas/DraftId"
              },
              "proposal_id": {
                "type": "string"
              }
            }
          },
          {
            "type": "object",
            "description": "Replay the user's most recent replies: draft each one from what was\nknown just before they replied, and compare with what they sent.\nCalls the configured LLM once per case; nothing is saved or sent.",
            "required": [
              "limit",
              "cmd"
            ],
            "properties": {
              "account_id": {
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/AccountId"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "cmd": {
                "type": "string",
                "enum": [
                  "DraftEvalWithPolicy"
                ]
              },
              "limit": {
                "type": "integer",
                "format": "int32",
                "minimum": 0
              },
              "rewrite": {
                "type": "boolean",
                "description": "Also run the configured humanizer rewrite model for each replay.\nKept off by default so `--set mine` measures the drafting model."
              }
            }
          },
          {
            "type": "object",
            "description": "Draft the labelled compose corpus with the configured LLM and grade\neach draft against what its case required. Nothing is saved or sent.\nA separate request, not a field on `DraftEval`: a daemon that predates\nit rejects the unknown command, instead of ignoring a field and\nreplaying the user's own mail.",
            "required": [
              "cmd"
            ],
            "properties": {
              "cmd": {
                "type": "string",
                "enum": [
                  "DraftEvalQuick"
                ]
              }
            }
          },
          {
            "type": "object",
            "description": "Read stored fallback decisions only. The limit is capped at 10,000.",
            "required": [
              "limit",
              "cmd"
            ],
            "properties": {
              "account_id": {
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/AccountId"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "cmd": {
                "type": "string",
                "enum": [
                  "ClassifyReport"
                ]
              },
              "limit": {
                "type": "integer",
                "format": "int32",
                "minimum": 0
              }
            }
          },
          {
            "type": "object",
            "description": "Compare only versions actually retained in this mailbox.",
            "required": [
              "policy_version",
              "limit",
              "cmd"
            ],
            "properties": {
              "account_id": {
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/AccountId"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "cmd": {
                "type": "string",
                "enum": [
                  "ClassifyCompare"
                ]
              },
              "limit": {
                "type": "integer",
                "format": "int32",
                "minimum": 0
              },
              "policy_version": {
                "type": "string"
              }
            }
          },
          {
            "type": "object",
            "description": "Measure today's classifier against labelled scenarios in stored mail:\nsender, home, asks and records. Local; nothing is changed or sent.",
            "required": [
              "cmd"
            ],
            "properties": {
              "account_id": {
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/AccountId"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "cmd": {
                "type": "string",
                "enum": [
                  "ClassifyEval"
                ]
              },
              "set": {
                "$ref": "#/components/schemas/ClassifyEvalSetData"
              }
            }
          },
          {
            "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",
            "description": "Create or return the canonical unsent reply draft for this conversation.",
            "required": [
              "message_id",
              "reply_all",
              "cmd"
            ],
            "properties": {
              "cmd": {
                "type": "string",
                "enum": [
                  "EnsureReplyDraft"
                ]
              },
              "dry_run": {
                "type": "boolean"
              },
              "message_id": {
                "$ref": "#/components/schemas/MessageId"
              },
              "reply_all": {
                "type": "boolean"
              }
            }
          },
          {
            "type": "object",
            "description": "Change the audience of an existing reply without replacing its content.",
            "required": [
              "draft_id",
              "reply_all",
              "expected_revision",
              "cmd"
            ],
            "properties": {
              "cmd": {
                "type": "string",
                "enum": [
                  "SetReplyDraftAudience"
                ]
              },
              "draft_id": {
                "$ref": "#/components/schemas/DraftId"
              },
              "dry_run": {
                "type": "boolean"
              },
              "expected_revision": {
                "type": "integer",
                "format": "int64"
              },
              "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"
                ]
              },
              "send_identity": {
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/SendIdentity"
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            }
          },
          {
            "type": "object",
            "required": [
              "account_id",
              "operation_id",
              "cmd"
            ],
            "properties": {
              "account_id": {
                "$ref": "#/components/schemas/AccountId"
              },
              "cmd": {
                "type": "string",
                "enum": [
                  "GetSendOutcome"
                ]
              },
              "operation_id": {
                "type": "string"
              }
            }
          },
          {
            "type": "object",
            "description": "Resume a historical false-unknown only from matched local gate evidence.",
            "required": [
              "account_id",
              "operation_id",
              "dry_run",
              "cmd"
            ],
            "properties": {
              "account_id": {
                "$ref": "#/components/schemas/AccountId"
              },
              "cmd": {
                "type": "string",
                "enum": [
                  "RecoverSendOutcome"
                ]
              },
              "dry_run": {
                "type": "boolean"
              },
              "expected_evidence_sha256": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "operation_id": {
                "type": "string"
              }
            }
          },
          {
            "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"
              },
              "managed_attachments_reviewed": {
                "type": "boolean"
              },
              "override_safety_token": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "send_identity": {
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/SendIdentity"
                  },
                  {
                    "type": "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 the replies you owe for an account. By default this is the\ndesk's You owe lane: mail from people, in the inbox, from someone\nyou are in conversation with, ranked by how far past your usual\npace with them it is. `all` returns the raw list instead: every\nthread whose latest inbound has not been followed by an outbound,\nranked by overdue ratio.",
            "required": [
              "account_id",
              "cmd"
            ],
            "properties": {
              "account_id": {
                "$ref": "#/components/schemas/AccountId"
              },
              "all": {
                "type": "boolean"
              },
              "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"
              },
              "expected_revision": {
                "type": [
                  "integer",
                  "null"
                ],
                "format": "int64"
              }
            }
          },
          {
            "type": "object",
            "description": "Fetch a single locally-stored draft by id (for editing in place).\nReturns `ResponseData::Draft`; errors when no such draft exists.",
            "required": [
              "draft_id",
              "cmd"
            ],
            "properties": {
              "cmd": {
                "type": "string",
                "enum": [
                  "GetDraft"
                ]
              },
              "draft_id": {
                "$ref": "#/components/schemas/DraftId"
              }
            }
          },
          {
            "type": "object",
            "description": "Update a locally-stored draft in place, keyed by `draft.id`. Preserves\nthe draft's `created_at`; only drafts still in `'draft'` status are\neditable. Errors when the draft is missing or already sending/sent.",
            "required": [
              "draft",
              "cmd"
            ],
            "properties": {
              "cmd": {
                "type": "string",
                "enum": [
                  "UpdateDraft"
                ]
              },
              "draft": {
                "$ref": "#/components/schemas/Draft"
              }
            }
          },
          {
            "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. Query their send outcome before taking any action;\nstartup preserves uncertain submissions.",
            "required": [
              "cmd"
            ],
            "properties": {
              "cmd": {
                "type": "string",
                "enum": [
                  "ListOrphanedDrafts"
                ]
              }
            }
          },
          {
            "type": "object",
            "description": "Check an orphaned draft conservatively: uncertain or sent rows\nrefuse reset. Already-`'draft'` rows return the no-op variant.\nQuery the retained send outcome rather than resending blindly.",
            "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": [
                  {
                    "$ref": "#/components/schemas/AccountId"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "cmd": {
                "type": "string",
                "enum": [
                  "ExportSearch"
                ]
              },
              "format": {
                "$ref": "#/components/schemas/ExportFormat"
              },
              "query": {
                "type": "string"
              }
            }
          },
          {
            "type": "object",
            "description": "Declare a cooperative client identity before any requests or events.\nToken transports authenticate first. The kind is fixed for the entire\nconnection; an exact protocol match is required. Success is `Ack`.",
            "required": [
              "kind",
              "protocol_version",
              "cmd"
            ],
            "properties": {
              "cmd": {
                "type": "string",
                "enum": [
                  "DeclareClient"
                ]
              },
              "kind": {
                "$ref": "#/components/schemas/ClientKind"
              },
              "protocol_version": {
                "type": "integer",
                "format": "int32",
                "minimum": 0
              }
            }
          },
          {
            "type": "object",
            "description": "Limit this connection to strict local reads for the rest of its life,\nafter `DeclareClient`. The daemon then refuses any request that could\nchange mail, contact a provider or the network, call a model, or send\nor export anything. There is no request that lifts the limit. Success\nis `Ack`.",
            "required": [
              "cmd"
            ],
            "properties": {
              "cmd": {
                "type": "string",
                "enum": [
                  "RestrictToLocalReads"
                ]
              }
            }
          },
          {
            "type": "object",
            "required": [
              "cmd"
            ],
            "properties": {
              "cmd": {
                "type": "string",
                "enum": [
                  "GetStatus"
                ]
              }
            }
          },
          {
            "type": "object",
            "description": "Build identity only: protocol, version, build id and pid. Answers\nwithout touching the store, so version checks stay cheap under load.\nOlder daemons reject it; callers fall back to [`Request::GetStatus`].",
            "required": [
              "cmd"
            ],
            "properties": {
              "cmd": {
                "type": "string",
                "enum": [
                  "GetDaemonIdentity"
                ]
              }
            }
          },
          {
            "type": "object",
            "required": [
              "cmd"
            ],
            "properties": {
              "cmd": {
                "type": "string",
                "enum": [
                  "Ping"
                ]
              }
            }
          },
          {
            "type": "object",
            "required": [
              "cmd"
            ],
            "properties": {
              "cmd": {
                "type": "string",
                "enum": [
                  "Shutdown"
                ]
              }
            }
          },
          {
            "type": "object",
            "description": "In-band authentication handshake for token-bearing transports\n(phase 5, transport adapters). Raw framed IPC carries no headers, so a\ntransport with no implicit peer identity (`PeerAuth::TokenRequired`,\ne.g. the TCP-loopback adapter) authenticates by sending this as the\nFIRST request on the connection. The serve core gates every other\nrequest on that connection behind a successful `Authenticate`, replying\n`IpcErrorKind::Auth` until then. On transports that DO carry implicit\ntrust (UDS peer creds, in-process, stdio) the handshake is a harmless\nno-op that returns [`ResponseData::Authenticated`]. Additive only — no\n`IPC_PROTOCOL_VERSION` bump: old clients never emit it, and the only\ntransport that requires it (TCP) is itself new.",
            "required": [
              "token",
              "cmd"
            ],
            "properties": {
              "cmd": {
                "type": "string",
                "enum": [
                  "Authenticate"
                ]
              },
              "token": {
                "type": "string",
                "description": "Bearer token, matched against the daemon's token store (env\n`MXR_DAEMON_TOKEN` or the daemon token file)."
              }
            }
          },
          {
            "type": "object",
            "description": "Paginated reverse-chron list of activity rows.",
            "required": [
              "filter",
              "limit",
              "cmd"
            ],
            "properties": {
              "cmd": {
                "type": "string",
                "enum": [
                  "ListActivity"
                ]
              },
              "cursor": {
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/ActivityCursor"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "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": [
                  {
                    "$ref": "#/components/schemas/ActivityFilter"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "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": [
                  {
                    "$ref": "#/components/schemas/ActivityTier"
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            }
          },
          {
            "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"
              }
            }
          },
          {
            "type": "object",
            "description": "Resolve a time phrase (\"fri 3\", \"tomorrow 9am\", \"in 2d\") in the\ndaemon's local zone with the user's snooze hours. Read-only; clients\npreview with it and send the chosen instant to the real mutation.",
            "required": [
              "input",
              "cmd"
            ],
            "properties": {
              "cmd": {
                "type": "string",
                "enum": [
                  "ResolveTime"
                ]
              },
              "input": {
                "type": "string"
              },
              "now": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "date-time",
                "description": "Anchor for relative phrases. Defaults to the daemon's clock;\nset it for reproducible output."
              },
              "time_zone": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "IANA zone to resolve in, such as \"Europe/London\". The web app\nsends the browser's zone because the browser may not be on the\ndaemon's machine; omitted means the daemon's local zone."
              }
            }
          },
          {
            "type": "object",
            "description": "What the store knows about a conversation (relationship with the\nmain counterparty, whether you owe a reply, open promises). No\nmodel; read-only. Returns `ResponseData::ThreadContext`.",
            "required": [
              "thread_id",
              "cmd"
            ],
            "properties": {
              "cmd": {
                "type": "string",
                "enum": [
                  "GetThreadContext"
                ]
              },
              "thread_id": {
                "$ref": "#/components/schemas/ThreadId"
              }
            }
          },
          {
            "type": "object",
            "description": "One-sentence gist and the ask, from the configured model, cached per\nthread and latest message. Read-only. Returns\n`ResponseData::ThreadGist`; an unavailable model is a status, not an\nerror.",
            "required": [
              "thread_id",
              "cmd"
            ],
            "properties": {
              "cmd": {
                "type": "string",
                "enum": [
                  "GetThreadGist"
                ]
              },
              "refresh": {
                "type": "boolean"
              },
              "thread_id": {
                "$ref": "#/components/schemas/ThreadId"
              }
            }
          },
          {
            "type": "object",
            "description": "The desk: what needs you rather than what arrived. Replies you owe,\npromises coming due, threads waiting on someone, and new mail from\npeople, each row with a reason; plus counts for everything else.\nPure local store reads, no LLM. `account_id: None` covers every\nenabled account.",
            "required": [
              "cmd"
            ],
            "properties": {
              "account_id": {
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/AccountId"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "cmd": {
                "type": "string",
                "enum": [
                  "GetDesk"
                ]
              },
              "lane_limit": {
                "type": "integer",
                "format": "int32",
                "description": "Rows returned per lane; each lane still reports its full total.",
                "minimum": 0
              }
            }
          },
          {
            "type": "object",
            "description": "\"Done waiting\": take threads you wrote last off the desk's Waiting\nlane until a new message arrives in them. `dry_run` returns the same\nselection without writing.",
            "required": [
              "thread_ids",
              "cmd"
            ],
            "properties": {
              "cmd": {
                "type": "string",
                "enum": [
                  "DismissDeskThreads"
                ]
              },
              "dry_run": {
                "type": "boolean"
              },
              "thread_ids": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/ThreadId"
                }
              }
            }
          },
          {
            "type": "object",
            "description": "Undo `DismissDeskThreads`: the threads wait again.",
            "required": [
              "thread_ids",
              "cmd"
            ],
            "properties": {
              "cmd": {
                "type": "string",
                "enum": [
                  "RestoreDeskThreads"
                ]
              },
              "thread_ids": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/ThreadId"
                }
              }
            }
          },
          {
            "type": "object",
            "description": "Find promises the sender makes in a draft or a sent message, with\neach due phrase resolved in `time_zone`. Read-only and capped by a\nshort budget, so a send never waits on it. Returns\n`ResponseData::Promises`; an unavailable or slow model is a status.",
            "required": [
              "source",
              "cmd"
            ],
            "properties": {
              "cmd": {
                "type": "string",
                "enum": [
                  "DetectPromises"
                ]
              },
              "now": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "date-time",
                "description": "Anchor for relative due phrases; defaults to the daemon's clock."
              },
              "source": {
                "$ref": "#/components/schemas/PromiseSourceData"
              },
              "time_zone": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "IANA zone to resolve due phrases in; defaults to the daemon's."
              }
            }
          },
          {
            "type": "object",
            "description": "Keep a promise from a message you sent as an open commitment due at\n`due_at`, so it comes back when due. Idempotent per message and\npromise: recording it again moves the date. `dry_run` returns what\nwould be stored without writing. Returns `ResponseData::RecordedPromise`.",
            "required": [
              "message_id",
              "what",
              "due_at",
              "cmd"
            ],
            "properties": {
              "cmd": {
                "type": "string",
                "enum": [
                  "RecordPromise"
                ]
              },
              "dry_run": {
                "type": "boolean"
              },
              "due_at": {
                "type": "string",
                "format": "date-time"
              },
              "message_id": {
                "$ref": "#/components/schemas/MessageId"
              },
              "what": {
                "type": "string"
              }
            }
          },
          {
            "type": "object",
            "description": "Whether the optional `ms-todo` executable is installed on the daemon.",
            "required": [
              "cmd"
            ],
            "properties": {
              "cmd": {
                "type": "string",
                "enum": [
                  "GetMicrosoftTodoStatus"
                ]
              }
            }
          },
          {
            "type": "object",
            "description": "Link one to-do with Microsoft To Do. Preview never executes the CLI;\ncommitting requires the fingerprint returned by that preview.",
            "required": [
              "todo_id",
              "cmd"
            ],
            "properties": {
              "account_id": {
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/AccountId"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "cmd": {
                "type": "string",
                "enum": [
                  "SendTodoToMicrosoft"
                ]
              },
              "dry_run": {
                "type": "boolean"
              },
              "fingerprint": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "todo_id": {
                "type": "string"
              }
            }
          },
          {
            "type": "object",
            "description": "Reconcile explicitly linked tasks within the selected account. With\nno account, external profiles select only their allowed enabled accounts.\nA preview reads ms-todo's cache but changes neither application's tasks.",
            "required": [
              "cmd"
            ],
            "properties": {
              "account_id": {
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/AccountId"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "cmd": {
                "type": "string",
                "enum": [
                  "SyncMicrosoftTodos"
                ]
              },
              "dry_run": {
                "type": "boolean"
              },
              "todo_id": {
                "type": [
                  "string",
                  "null"
                ]
              }
            }
          },
          {
            "type": "object",
            "description": "The To do runway: Now, Coming up by week, Later, Whenever and Done\nthis week, with the headline, the empty state and the catch-up\ncount. `mark_seen` records that To do was opened, so the next\n\"expired since you last looked\" counts from now. Returns\n`ResponseData::TodoRunway`.",
            "required": [
              "cmd"
            ],
            "properties": {
              "account_id": {
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/AccountId"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "cmd": {
                "type": "string",
                "enum": [
                  "GetTodoRunway"
                ]
              },
              "mark_seen": {
                "type": "boolean"
              }
            }
          },
          {
            "type": "object",
            "description": "Rows in one state, newest change first: `expired` is the Expired\nlist. Returns `ResponseData::Todos`.",
            "required": [
              "state",
              "cmd"
            ],
            "properties": {
              "account_id": {
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/AccountId"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "cmd": {
                "type": "string",
                "enum": [
                  "ListTodos"
                ]
              },
              "limit": {
                "type": "integer",
                "format": "int32",
                "minimum": 0
              },
              "state": {
                "$ref": "#/components/schemas/TodoStateData"
              }
            }
          },
          {
            "type": "object",
            "description": "One row with every field's provenance. Takes a full id or a unique\nprefix. Returns `ResponseData::Todo`.",
            "required": [
              "todo_id",
              "cmd"
            ],
            "properties": {
              "cmd": {
                "type": "string",
                "enum": [
                  "GetTodo"
                ]
              },
              "todo_id": {
                "type": "string"
              }
            }
          },
          {
            "type": "object",
            "description": "Tick off, reopen or mark \"not a to-do\". Returns\n`ResponseData::TodoChange`.",
            "required": [
              "todo_ids",
              "action",
              "cmd"
            ],
            "properties": {
              "action": {
                "$ref": "#/components/schemas/TodoStateActionData"
              },
              "cmd": {
                "type": "string",
                "enum": [
                  "SetTodoState"
                ]
              },
              "dry_run": {
                "type": "boolean"
              },
              "todo_ids": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            }
          },
          {
            "type": "object",
            "description": "Four distinct user corrections. Wrong details requires edits and does\nnot change the row until saved. Quotes are immutable source evidence.",
            "required": [
              "todo_id",
              "reason",
              "cmd"
            ],
            "properties": {
              "cmd": {
                "type": "string",
                "enum": [
                  "CorrectTodo"
                ]
              },
              "dry_run": {
                "type": "boolean"
              },
              "edits": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/TodoEditData"
                }
              },
              "reason": {
                "$ref": "#/components/schemas/TodoCorrectionData"
              },
              "time_zone": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "todo_id": {
                "type": "string"
              }
            }
          },
          {
            "type": "object",
            "required": [
              "todo_id",
              "correction_id",
              "cmd"
            ],
            "properties": {
              "cmd": {
                "type": "string",
                "enum": [
                  "UndoTodoCorrection"
                ]
              },
              "correction_id": {
                "type": "string"
              },
              "dry_run": {
                "type": "boolean"
              },
              "todo_id": {
                "type": "string"
              }
            }
          },
          {
            "type": "object",
            "description": "Preview or accept one evidence-backed later-mail resolution.",
            "required": [
              "todo_id",
              "suggestion_id",
              "action",
              "cmd"
            ],
            "properties": {
              "action": {
                "$ref": "#/components/schemas/TodoResolutionActionData"
              },
              "cmd": {
                "type": "string",
                "enum": [
                  "ResolveTodoSuggestion"
                ]
              },
              "dry_run": {
                "type": "boolean"
              },
              "suggestion_id": {
                "type": "string"
              },
              "todo_id": {
                "type": "string"
              }
            }
          },
          {
            "type": "object",
            "description": "Show the row on your own date (\"mon 9am\", \"in 3d\", RFC3339), or\nclear it with `when: None`. Resolved in `time_zone`, else the\ndaemon's. Returns `ResponseData::TodoChange`.",
            "required": [
              "todo_id",
              "cmd"
            ],
            "properties": {
              "cmd": {
                "type": "string",
                "enum": [
                  "ScheduleTodo"
                ]
              },
              "dry_run": {
                "type": "boolean"
              },
              "time_zone": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "todo_id": {
                "type": "string"
              },
              "when": {
                "type": [
                  "string",
                  "null"
                ]
              }
            }
          },
          {
            "type": "object",
            "description": "Correct fields; the row is yours from then on. Returns\n`ResponseData::TodoChange`.",
            "required": [
              "todo_id",
              "edits",
              "cmd"
            ],
            "properties": {
              "cmd": {
                "type": "string",
                "enum": [
                  "UpdateTodo"
                ]
              },
              "dry_run": {
                "type": "boolean"
              },
              "edits": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/TodoEditData"
                }
              },
              "time_zone": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "todo_id": {
                "type": "string"
              }
            }
          },
          {
            "type": "object",
            "description": "Make a to-do from a message yourself. `kind` defaults to `other`;\n`due` is a phrase or RFC3339. Returns `ResponseData::TodoChange`.",
            "required": [
              "message_id",
              "title",
              "cmd"
            ],
            "properties": {
              "cmd": {
                "type": "string",
                "enum": [
                  "CreateTodo"
                ]
              },
              "dry_run": {
                "type": "boolean"
              },
              "due": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "kind": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "message_id": {
                "$ref": "#/components/schemas/MessageId"
              },
              "time_zone": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "title": {
                "type": "string"
              }
            }
          },
          {
            "type": "object",
            "description": "The first run's one-time catch-up batch. Returns\n`ResponseData::TodoCatchup`.",
            "required": [
              "cmd"
            ],
            "properties": {
              "account_id": {
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/AccountId"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "cmd": {
                "type": "string",
                "enum": [
                  "GetTodoCatchup"
                ]
              }
            }
          },
          {
            "type": "object",
            "description": "Keep or let go in the catch-up; `let_go_all` takes every row still\nwaiting. Returns `ResponseData::TodoChange`.",
            "required": [
              "decision",
              "cmd"
            ],
            "properties": {
              "account_id": {
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/AccountId"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "cmd": {
                "type": "string",
                "enum": [
                  "SetTodoCatchup"
                ]
              },
              "decision": {
                "$ref": "#/components/schemas/TodoCatchupDecisionData"
              },
              "dry_run": {
                "type": "boolean"
              }
            }
          },
          {
            "type": "object",
            "description": "Every keyboard shortcut in every client, from the one definition\nwith the person's `keys.toml` applied (blueprint chapter 35).\nReturns `ResponseData::Keymap`.",
            "required": [
              "cmd"
            ],
            "properties": {
              "cmd": {
                "type": "string",
                "enum": [
                  "GetKeymap"
                ]
              }
            }
          },
          {
            "type": "object",
            "description": "Change `keys.toml`: an action's keys, or the single-key switch.\nNothing is written on a dry run or when the change has problems\n(a key another action has). Returns `ResponseData::KeysUpdate`.",
            "required": [
              "change",
              "cmd"
            ],
            "properties": {
              "change": {
                "$ref": "#/components/schemas/KeysChangeData"
              },
              "cmd": {
                "type": "string",
                "enum": [
                  "UpdateKeys"
                ]
              },
              "dry_run": {
                "type": "boolean"
              }
            }
          },
          {
            "type": "object",
            "description": "How a mode explains itself: header, empty states, why template,\nkeys, the `?` explanation and its hints with whether each was\ndismissed. `mode: None` returns every shipped mode. Returns\n`ResponseData::ModeGuides`.",
            "required": [
              "cmd"
            ],
            "properties": {
              "cmd": {
                "type": "string",
                "enum": [
                  "GetModeGuide"
                ]
              },
              "mode": {
                "type": [
                  "string",
                  "null"
                ]
              }
            }
          },
          {
            "type": "object",
            "description": "Dismiss a hint on this profile, so it never shows again in any\nclient; `seen: false` brings it back. Returns\n`ResponseData::ModeGuides` with every mode the hint attaches in, or\n`ResponseData::HintSeen` for a \"Next time\" hint\n(`next-time.<action id>`, D171).",
            "required": [
              "hint",
              "cmd"
            ],
            "properties": {
              "cmd": {
                "type": "string",
                "enum": [
                  "SetHintSeen"
                ]
              },
              "hint": {
                "type": "string"
              },
              "seen": {
                "type": "boolean"
              }
            }
          },
          {
            "type": "object",
            "description": "Mark only the exact To do or Updates row revision that was opened or\npeeked. Does not read the source email or complete/let go of the row.\nReturns `Ack`; dry runs validate without writing.",
            "required": [
              "account_id",
              "mode",
              "row_id",
              "revision",
              "cmd"
            ],
            "properties": {
              "account_id": {
                "$ref": "#/components/schemas/AccountId"
              },
              "cmd": {
                "type": "string",
                "enum": [
                  "SetModeRowSeen"
                ]
              },
              "dry_run": {
                "type": "boolean"
              },
              "mode": {
                "$ref": "#/components/schemas/ModeKindData"
              },
              "revision": {
                "type": "string"
              },
              "row_id": {
                "type": "string"
              }
            }
          },
          {
            "type": "object",
            "description": "Now, the front page: People, Due soon, one Updates card and an\nevening Reading pick, at most three items each, with \"and N more\"\nlines and the clear state. Local reads only. Returns\n`ResponseData::Now`.",
            "required": [
              "cmd"
            ],
            "properties": {
              "account_id": {
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/AccountId"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "cmd": {
                "type": "string",
                "enum": [
                  "GetNow"
                ]
              }
            }
          },
          {
            "type": "object",
            "description": "The rail: Now, the five modes and Inbox in order, each with its\nkey, count, badge (work only: Now) and whether it is built or an\nearly version on an existing view, plus the pages under More.\nReturns `ResponseData::Rail`.",
            "required": [
              "cmd"
            ],
            "properties": {
              "account_id": {
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/AccountId"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "cmd": {
                "type": "string",
                "enum": [
                  "GetRail"
                ]
              }
            }
          },
          {
            "type": "object",
            "description": "Which modes hold a thread and why, computed from the desk's lanes,\nopen to-dos, the sender classifier and per-mode done marks. Name\nthe thread by `thread_id`, by one of its messages, or many at once\nin `thread_ids` (at most 100). Returns `ResponseData::ModeMembership`.",
            "required": [
              "cmd"
            ],
            "properties": {
              "cmd": {
                "type": "string",
                "enum": [
                  "GetModeMembership"
                ]
              },
              "limit": {
                "type": [
                  "integer",
                  "null"
                ],
                "format": "int32",
                "description": "Keep only the newest `limit` messages' asks, assessments and\npending asks in each answer. Omitted returns every message's\nevidence, which the CLI and TUI still read.",
                "minimum": 0
              },
              "message_id": {
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/MessageId"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "thread_id": {
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/ThreadId"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "thread_ids": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/ThreadId"
                }
              }
            }
          },
          {
            "type": "object",
            "description": "One preview per thread in `thread_ids` (at most 100): subject, the\nlatest sender, date and snippet, counts and an attachment flag, with\nno bodies. Unknown ids are left out. Returns\n`ResponseData::ThreadPreviews`.",
            "required": [
              "thread_ids",
              "cmd"
            ],
            "properties": {
              "cmd": {
                "type": "string",
                "enum": [
                  "GetThreadPreviews"
                ]
              },
              "thread_ids": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/ThreadId"
                }
              }
            }
          },
          {
            "type": "object",
            "description": "Now's arrivals line (D119): every inbound email first seen since Now\nwas last opened (at most 24 hours back), counted once by where it\nwent, plus \"Not sure\" questions and the weekly track record.\n`mark_seen` starts a visit: the window then runs from the visit\nbefore. `since` is the window start of the visit a client already\nhas open (the `since` it was answered): a read that doesn't mark\nthen keeps that window instead of working one out again, so a Now\nthat stays open polls the same window all visit. Returns\n`ResponseData::Arrivals`.",
            "required": [
              "cmd"
            ],
            "properties": {
              "account_id": {
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/AccountId"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "cmd": {
                "type": "string",
                "enum": [
                  "GetArrivals"
                ]
              },
              "mark_seen": {
                "type": "boolean"
              },
              "since": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "date-time"
              }
            }
          },
          {
            "type": "object",
            "description": "The emails behind one count of the arrivals line, newest first:\nexactly as many as the count. `since`/`until` default to the line's\nwindow; `bucket` omitted lists every arrival. Returns\n`ResponseData::ArrivalList`.",
            "required": [
              "cmd"
            ],
            "properties": {
              "account_id": {
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/AccountId"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "bucket": {
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/ArrivalBucketData"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "cmd": {
                "type": "string",
                "enum": [
                  "ListArrivals"
                ]
              },
              "limit": {
                "type": "integer",
                "format": "int32",
                "minimum": 0
              },
              "since": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "date-time"
              },
              "until": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "date-time"
              }
            }
          },
          {
            "type": "object",
            "description": "Where each email went when it arrived and where it is now, for\nInbox's mode chips. At most 200; emails older than the ledger are\nleft out. Returns `ResponseData::ArrivalModes`.",
            "required": [
              "message_ids",
              "cmd"
            ],
            "properties": {
              "cmd": {
                "type": "string",
                "enum": [
                  "GetArrivalModes"
                ]
              },
              "message_ids": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/MessageId"
                }
              }
            }
          },
          {
            "type": "object",
            "description": "Move one email to a mode (`X`), or with `sender` set the sender's\nmode for all their mail (`K`). Messages, Updates and Reading move\nit; To do and Archive add it there (a to-do, a record). Takes effect\nin every client at once and is stored as a correction. `source:\n\"not_sure\"` answers a Not-sure question. Returns\n`ResponseData::MessageMoved` with the id `UndoMove` takes.",
            "required": [
              "message_id",
              "mode",
              "cmd"
            ],
            "properties": {
              "cmd": {
                "type": "string",
                "enum": [
                  "MoveMessage"
                ]
              },
              "dry_run": {
                "type": "boolean"
              },
              "message_id": {
                "$ref": "#/components/schemas/MessageId"
              },
              "mode": {
                "$ref": "#/components/schemas/ModeKindData"
              },
              "sender": {
                "type": "boolean"
              },
              "source": {
                "type": [
                  "string",
                  "null"
                ]
              }
            }
          },
          {
            "type": "object",
            "description": "Put a move back exactly as it was. Undoing twice changes nothing.\nReturns `ResponseData::MoveUndone`.",
            "required": [
              "correction_id",
              "cmd"
            ],
            "properties": {
              "cmd": {
                "type": "string",
                "enum": [
                  "UndoMove"
                ]
              },
              "correction_id": {
                "type": "integer",
                "format": "int64"
              }
            }
          },
          {
            "type": "object",
            "description": "Every move, sender mode and Not-sure answer, newest first. Returns\n`ResponseData::Corrections`.",
            "required": [
              "cmd"
            ],
            "properties": {
              "account_id": {
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/AccountId"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "cmd": {
                "type": "string",
                "enum": [
                  "ListCorrections"
                ]
              },
              "limit": {
                "type": "integer",
                "format": "int32",
                "minimum": 0
              }
            }
          },
          {
            "type": "object",
            "description": "Done here: the thread leaves `mode` until a new message arrives\n(To do ticks its open rows off). When no other mode holds the\nthread and `modes.archive_on_last_done` is on, it is archived at\nthe provider too. Each outcome carries the handoff copy. `dry_run`\nreturns the same plan without changing anything; the real run\nreturns one `mutation_id` for `UndoMutation`. Archive has no done.\nIn To do, `todo_ids` ticks off only those rows; To do lets go of a\nthread only once none of its to-dos is open. `sender` adds every\nthread of that sender's in the mode (Updates or Reading), resolved\nhere so the preview and the run cover the same set. Returns\n`ResponseData::ModeDone`.",
            "required": [
              "mode",
              "cmd"
            ],
            "properties": {
              "cmd": {
                "type": "string",
                "enum": [
                  "SetModeDone"
                ]
              },
              "dry_run": {
                "type": "boolean"
              },
              "mode": {
                "$ref": "#/components/schemas/ModeKindData"
              },
              "sender": {
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/ModeDoneSenderData"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "thread_ids": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/ThreadId"
                }
              },
              "todo_ids": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            }
          },
          {
            "type": "object",
            "description": "Messages: people you talk with, one row each, in four bands (Your\nturn, Pinned, Recent, Quiet), each row with its topics, a preview\nof what they asked and your usual pace. Your turn shares the one\nowed rule with Now. `filter` keeps only rows matching its turn,\nunread and past-pace settings; `limit` caps Recent and Quiet\n(totals count everything). The top-level `turn` is the older\nspelling of `filter.turn`; when both are given, the filter's wins.\nLocal reads only. Returns `ResponseData::Messages`.",
            "required": [
              "cmd"
            ],
            "properties": {
              "account_id": {
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/AccountId"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "cmd": {
                "type": "string",
                "enum": [
                  "ListMessages"
                ]
              },
              "filter": {
                "$ref": "#/components/schemas/MessagesFilterData"
              },
              "limit": {
                "type": "integer",
                "format": "int32",
                "minimum": 0
              },
              "turn": {
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/MessagesTurnData"
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            }
          },
          {
            "type": "object",
            "description": "One person's page (or a group's): the relationship line, every\ntopic, and the selected topic as a conversation of new texts.\n`person` is a row id (`person:<email>`, `group:<thread_id>`) or an\naddress. `topic` picks the conversation; by default the one whose\nturn it is, else the latest. Returns `ResponseData::PersonPage`.",
            "required": [
              "person",
              "cmd"
            ],
            "properties": {
              "account_id": {
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/AccountId"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "cmd": {
                "type": "string",
                "enum": [
                  "GetPerson"
                ]
              },
              "conversation": {
                "type": "boolean",
                "description": "False returns only the profile (row, relationship line, topics):\nno conversation and no message text, as a hover card needs."
              },
              "person": {
                "type": "string"
              },
              "topic": {
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/ThreadId"
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            }
          },
          {
            "type": "object",
            "description": "Got it: a short acknowledgement on `thread_id`, in your usual\ngreeting and sign-off for that person, built from a template with\nno model. A preview (the default) returns the exact plan and a\n`preview_token`. A send (`dry_run: false`) needs that token, issued\nwithin the last minute, and the previewed text: it goes only when\nthe recipient, sender, target message and text all still match,\nand never twice for the same message. Returns\n`ResponseData::MessagesAck`.",
            "required": [
              "thread_id",
              "cmd"
            ],
            "properties": {
              "cmd": {
                "type": "string",
                "enum": [
                  "AckMessage"
                ]
              },
              "dry_run": {
                "type": "boolean"
              },
              "expect_text": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "preview_token": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "thread_id": {
                "$ref": "#/components/schemas/ThreadId"
              }
            }
          },
          {
            "type": "object",
            "description": "Merge addresses into one person, by hand (D117): `into` becomes the\nperson's primary address. `dry_run` shows the result without\nstoring it. Returns `ResponseData::PersonMerge`.",
            "required": [
              "account_id",
              "into",
              "addresses",
              "cmd"
            ],
            "properties": {
              "account_id": {
                "$ref": "#/components/schemas/AccountId"
              },
              "addresses": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "cmd": {
                "type": "string",
                "enum": [
                  "MergePeople"
                ]
              },
              "dry_run": {
                "type": "boolean"
              },
              "into": {
                "type": "string"
              }
            }
          },
          {
            "type": "object",
            "description": "Take an address back out of its person. Returns\n`ResponseData::PersonMerge`.",
            "required": [
              "account_id",
              "address",
              "cmd"
            ],
            "properties": {
              "account_id": {
                "$ref": "#/components/schemas/AccountId"
              },
              "address": {
                "type": "string"
              },
              "cmd": {
                "type": "string",
                "enum": [
                  "SplitPerson"
                ]
              },
              "dry_run": {
                "type": "boolean"
              }
            }
          },
          {
            "type": "object",
            "description": "Merges mxr suggests: the same name on addresses you've written to.\nIt never merges on its own. Returns `ResponseData::MergeSuggestions`.",
            "required": [
              "cmd"
            ],
            "properties": {
              "account_id": {
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/AccountId"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "cmd": {
                "type": "string",
                "enum": [
                  "ListMergeSuggestions"
                ]
              }
            }
          },
          {
            "type": "object",
            "description": "Archive's ledger: records newest first by transaction date, one page\nof `limit` from `offset`, with month counts and totals, facet counts\nand the \"coming up\" strip over every matching record. Local reads\nonly. Returns `ResponseData::RecordLedger`.",
            "required": [
              "cmd"
            ],
            "properties": {
              "account_id": {
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/AccountId"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "cmd": {
                "type": "string",
                "enum": [
                  "ListRecords"
                ]
              },
              "filter": {
                "$ref": "#/components/schemas/RecordFilterData"
              },
              "limit": {
                "type": "integer",
                "format": "int32",
                "minimum": 0
              },
              "offset": {
                "type": "integer",
                "format": "int32",
                "minimum": 0
              }
            }
          },
          {
            "type": "object",
            "description": "Subscriptions: receipts and invoices from one issuer for one\nproduct at a steady cadence, with their history, price changes,\nnext charge, status and totals per currency. Worked out from the\nrecords on each call; local reads only. Returns\n`ResponseData::RecordSubscriptions`.",
            "required": [
              "cmd"
            ],
            "properties": {
              "account_id": {
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/AccountId"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "cmd": {
                "type": "string",
                "enum": [
                  "ListRecordSubscriptions"
                ]
              }
            }
          },
          {
            "type": "object",
            "description": "One record's card: every field with its provenance, its documents\nand its source emails. Takes a full id or a unique prefix. Returns\n`ResponseData::Record`.",
            "required": [
              "record_id",
              "cmd"
            ],
            "properties": {
              "cmd": {
                "type": "string",
                "enum": [
                  "GetRecord"
                ]
              },
              "record_id": {
                "type": "string"
              }
            }
          },
          {
            "type": "object",
            "description": "The answer box. A query that matches record fields returns the field\nasked for, with no model; only when no record matches does it fall\nback to `ArchiveAsk` (when `fallback`), and says so. Returns\n`ResponseData::RecordAnswer`.",
            "required": [
              "query",
              "cmd"
            ],
            "properties": {
              "account_id": {
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/AccountId"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "cmd": {
                "type": "string",
                "enum": [
                  "AnswerFromRecords"
                ]
              },
              "fallback": {
                "type": "boolean"
              },
              "limit": {
                "type": "integer",
                "format": "int32",
                "description": "Records in \"also matching\" after the answer.",
                "minimum": 0
              },
              "list": {
                "type": "boolean",
                "description": "Every match as a list, whatever the query asks for: \"Show all\"."
              },
              "list_limit": {
                "type": "integer",
                "format": "int32",
                "minimum": 0
              },
              "offset": {
                "type": "integer",
                "format": "int32",
                "description": "The page of a list: where it starts and how many records.",
                "minimum": 0
              },
              "query": {
                "type": "string"
              }
            }
          },
          {
            "type": "object",
            "description": "Correct a record's field, confirm it, or confirm the whole card. A\ncorrection is yours from then on and wins over every re-run.\n`apply_to_sender` with an issuer name renames this sender's issuer\non every record, now and later. Returns `ResponseData::RecordChange`.",
            "required": [
              "record_id",
              "edit",
              "cmd"
            ],
            "properties": {
              "apply_to_sender": {
                "type": "boolean"
              },
              "cmd": {
                "type": "string",
                "enum": [
                  "SetRecordField"
                ]
              },
              "dry_run": {
                "type": "boolean"
              },
              "edit": {
                "$ref": "#/components/schemas/RecordEditData"
              },
              "record_id": {
                "type": "string"
              }
            }
          },
          {
            "type": "object",
            "description": "\"Not a record\" (or back again with `restore`). The email is never\ntouched, and a dismissed record is never filed again. Returns\n`ResponseData::RecordChange`.",
            "required": [
              "record_ids",
              "cmd"
            ],
            "properties": {
              "cmd": {
                "type": "string",
                "enum": [
                  "DismissRecord"
                ]
              },
              "dry_run": {
                "type": "boolean"
              },
              "record_ids": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "restore": {
                "type": "boolean"
              }
            }
          },
          {
            "type": "object",
            "description": "File an email as a record by hand, as `kind` when given. The dry run\nreturns the card that would be filed, from the same plan the real\nfiling writes. Returns `ResponseData::RecordChange`.",
            "required": [
              "message_id",
              "cmd"
            ],
            "properties": {
              "cmd": {
                "type": "string",
                "enum": [
                  "FileRecord"
                ]
              },
              "dry_run": {
                "type": "boolean"
              },
              "kind": {
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/RecordKindData"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "message_id": {
                "$ref": "#/components/schemas/MessageId"
              }
            }
          },
          {
            "type": "object",
            "description": "Always or never file mail from this message's sender (`verdict:\nNone` clears it). \"Always\" also files the sender's mail already\nhere. Returns `ResponseData::RecordChange`.",
            "required": [
              "message_id",
              "cmd"
            ],
            "properties": {
              "cmd": {
                "type": "string",
                "enum": [
                  "SetRecordSender"
                ]
              },
              "dry_run": {
                "type": "boolean"
              },
              "kind": {
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/RecordKindData"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "message_id": {
                "$ref": "#/components/schemas/MessageId"
              },
              "verdict": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "always | never"
              }
            }
          },
          {
            "type": "object",
            "description": "Export the matching records as CSV, and their PDFs to\n`attachments_dir` when given. The dry run reports the row count,\ntotals, unchecked rows and missing PDFs for the same rows. Returns\n`ResponseData::RecordExport`.",
            "required": [
              "cmd"
            ],
            "properties": {
              "account_id": {
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/AccountId"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "attachments_dir": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "cmd": {
                "type": "string",
                "enum": [
                  "ExportRecords"
                ]
              },
              "dry_run": {
                "type": "boolean"
              },
              "filter": {
                "$ref": "#/components/schemas/RecordFilterData"
              }
            }
          },
          {
            "type": "object",
            "description": "The edition: Reading's items in three bands (since your last visit,\nearlier, fading), ranked inside by how much you read each source,\nplus Later and the sources. Items past their source's window are\nmarked done in Reading on the way (never archived at the provider).\n`mark_visit` records that Reading was opened, so the next visit's\n\"since you were last here\" starts from this one. Returns\n`ResponseData::ReadingEdition`.",
            "required": [
              "cmd"
            ],
            "properties": {
              "account_id": {
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/AccountId"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "cmd": {
                "type": "string",
                "enum": [
                  "GetReadingEdition"
                ]
              },
              "mark_visit": {
                "type": "boolean"
              }
            }
          },
          {
            "type": "object",
            "description": "One item as the reader shows it: the issue as reader text, the\nsaved article, highlights and minutes left. Local only: it never\nfetches. Returns `ResponseData::ReadingItem`.",
            "required": [
              "item_key",
              "cmd"
            ],
            "properties": {
              "cmd": {
                "type": "string",
                "enum": [
                  "GetReadingItem"
                ]
              },
              "item_key": {
                "type": "string"
              }
            }
          },
          {
            "type": "object",
            "description": "Put items on Later (`later: true`, which also answers \"Still want\nit?\" with keep) or take them off. A link put on Later has its article\nfetched by the client with `FetchArticle`, so it reads offline.\nReturns `ResponseData::ReadingLater`.",
            "required": [
              "item_keys",
              "cmd"
            ],
            "properties": {
              "cmd": {
                "type": "string",
                "enum": [
                  "SetReadingLater"
                ]
              },
              "dry_run": {
                "type": "boolean"
              },
              "item_keys": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "later": {
                "type": "boolean"
              }
            }
          },
          {
            "type": "object",
            "description": "Local engagement for ranking and unsubscribe evidence: opened,\nseconds read, how far. Never leaves the machine; with\n`MXR_ACTIVITY=off` nothing is written. Returns\n`ResponseData::ReadingEngagement`.",
            "required": [
              "item_key",
              "cmd"
            ],
            "properties": {
              "cmd": {
                "type": "string",
                "enum": [
                  "RecordReadingEngagement"
                ]
              },
              "dwell_ms": {
                "type": "integer",
                "format": "int64",
                "description": "Time spent reading since the last report, in milliseconds.",
                "minimum": 0
              },
              "item_key": {
                "type": "string"
              },
              "opened": {
                "type": "boolean"
              },
              "progress": {
                "type": "number",
                "format": "double",
                "description": "How far down the item, 0 to 1. Only ever moves forward."
              }
            }
          },
          {
            "type": "object",
            "description": "Fetch and save the article an item links to, contacting the link's\nsite (and any site it redirects to). Only ever on an explicit\nrequest; private addresses, redirects into them and pages over the\nsize cap are refused. A saved copy is served unless `refresh`.\nReturns `ResponseData::ReadingArticle`.",
            "required": [
              "item_key",
              "cmd"
            ],
            "properties": {
              "cmd": {
                "type": "string",
                "enum": [
                  "FetchArticle"
                ]
              },
              "item_key": {
                "type": "string"
              },
              "refresh": {
                "type": "boolean"
              }
            }
          },
          {
            "type": "object",
            "description": "Save a passage from an item, with an optional note. Highlights are\nfound by search and exported with `ExportReadingHighlights`. Returns\n`ResponseData::ReadingHighlight`.",
            "required": [
              "item_key",
              "quote",
              "cmd"
            ],
            "properties": {
              "cmd": {
                "type": "string",
                "enum": [
                  "SaveHighlight"
                ]
              },
              "item_key": {
                "type": "string"
              },
              "note": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "paragraph": {
                "type": [
                  "integer",
                  "null"
                ],
                "format": "int32",
                "description": "The paragraph it was selected in (0-based, in the view's own\nparagraph list), so it marks that passage and not the first\nmatch. Absent: the first match.",
                "minimum": 0
              },
              "quote": {
                "type": "string"
              },
              "view": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "`issue` (default) or `article`."
              }
            }
          },
          {
            "type": "object",
            "description": "Change a highlight's note. An empty note (after trimming) clears it;\nthe field is required, so a missing or null note is an error rather\nthan a quiet clear. Refused for a highlight made elsewhere\n(`origin` other than `mxr`, such as Marginalia's). `dry_run` names\nthe highlight it would change without changing it. The real run\nreturns a `mutation_id` for `UndoMutation`, which brings the old\nnote back. Returns `ResponseData::ReadingHighlightChanged`.",
            "required": [
              "highlight_id",
              "note",
              "cmd"
            ],
            "properties": {
              "cmd": {
                "type": "string",
                "enum": [
                  "UpdateHighlight"
                ]
              },
              "dry_run": {
                "type": "boolean"
              },
              "highlight_id": {
                "type": "string"
              },
              "note": {
                "type": "string"
              }
            }
          },
          {
            "type": "object",
            "description": "Remove a highlight. Refused for one made elsewhere, as for\n`UpdateHighlight`. `dry_run` names the highlight it would remove\nwithout removing it, by the same lookup. The real run returns a\n`mutation_id` for `UndoMutation`, which puts it back. Returns\n`ResponseData::ReadingHighlightChanged`.",
            "required": [
              "highlight_id",
              "cmd"
            ],
            "properties": {
              "cmd": {
                "type": "string",
                "enum": [
                  "RemoveHighlight"
                ]
              },
              "dry_run": {
                "type": "boolean"
              },
              "highlight_id": {
                "type": "string"
              }
            }
          },
          {
            "type": "object",
            "description": "Every highlight, oldest first, with the same as one Markdown\ndocument. Returns `ResponseData::ReadingHighlights`.",
            "required": [
              "cmd"
            ],
            "properties": {
              "account_id": {
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/AccountId"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "cmd": {
                "type": "string",
                "enum": [
                  "ExportReadingHighlights"
                ]
              }
            }
          },
          {
            "type": "object",
            "description": "Per-source reading settings: show the sender's own layout (`R`), or\nstop offering to unsubscribe. Returns `ResponseData::ReadingSource`.",
            "required": [
              "account_id",
              "sender_email",
              "cmd"
            ],
            "properties": {
              "account_id": {
                "$ref": "#/components/schemas/AccountId"
              },
              "cmd": {
                "type": "string",
                "enum": [
                  "SetReadingSource"
                ]
              },
              "dismiss_unsubscribe_offer": {
                "type": "boolean"
              },
              "original_layout": {
                "type": [
                  "boolean",
                  "null"
                ]
              },
              "sender_email": {
                "type": "string"
              }
            }
          },
          {
            "type": "object",
            "description": "Whether Marginalia is connected, and where. Returns\n`ResponseData::MarginaliaStatus`.",
            "required": [
              "cmd"
            ],
            "properties": {
              "cmd": {
                "type": "string",
                "enum": [
                  "GetMarginaliaStatus"
                ]
              }
            }
          },
          {
            "type": "object",
            "description": "Connect Marginalia with its site and a personal token, checked with\nMarginalia before it is saved, or disconnect with `None`. The token\ngoes to the secrets file, the site to config. Returns\n`ResponseData::MarginaliaStatus`.",
            "required": [
              "cmd"
            ],
            "properties": {
              "cmd": {
                "type": "string",
                "enum": [
                  "SetMarginaliaConnection"
                ]
              },
              "connection": {
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/MarginaliaConnectionData"
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            }
          },
          {
            "type": "object",
            "description": "Send an item to Marginalia: the saved article when there is one\n(fetching a digest link's first), else the issue. An item sent\nbefore isn't sent again. `dry_run` names what would be sent and\nwhere, and contacts nothing. Returns `ResponseData::MarginaliaSend`.",
            "required": [
              "item_key",
              "cmd"
            ],
            "properties": {
              "cmd": {
                "type": "string",
                "enum": [
                  "SendReadingToMarginalia"
                ]
              },
              "dry_run": {
                "type": "boolean"
              },
              "item_key": {
                "type": "string"
              }
            }
          },
          {
            "type": "object",
            "description": "Read back the highlights made in Marginalia on one sent item, or on\nevery sent item: new ones are added, ones deleted there are\nremoved, and highlights made in mxr are never touched. Returns\n`ResponseData::MarginaliaSync`.",
            "required": [
              "cmd"
            ],
            "properties": {
              "cmd": {
                "type": "string",
                "enum": [
                  "SyncMarginaliaHighlights"
                ]
              },
              "item_key": {
                "type": [
                  "string",
                  "null"
                ]
              }
            }
          },
          {
            "type": "object",
            "description": "Whether the assistant can run and on which model. Returns\n`ResponseData::AssistantAvailability`.",
            "required": [
              "cmd"
            ],
            "properties": {
              "cmd": {
                "type": "string",
                "enum": [
                  "GetAssistantAvailability"
                ]
              }
            }
          },
          {
            "type": "object",
            "description": "The models the assistant can be set to and the one it uses now.\nReturns `ResponseData::AssistantModels`.",
            "required": [
              "cmd"
            ],
            "properties": {
              "cmd": {
                "type": "string",
                "enum": [
                  "GetAssistantModels"
                ]
              }
            }
          },
          {
            "type": "object",
            "description": "The models available to compose under its own routing and privacy policy.\nReturns `ResponseData::ComposeModels`.",
            "required": [
              "cmd"
            ],
            "properties": {
              "cmd": {
                "type": "string",
                "enum": [
                  "GetComposeModels"
                ]
              }
            }
          },
          {
            "type": "object",
            "description": "Set the model the assistant's next turn uses, for every conversation.\nRefused for a model that isn't in the list, has no key, or would send\nmail off this machine without `llm.allow_cloud_relationship_data`.\nWith `dry_run` nothing is written. Returns\n`ResponseData::AssistantModelChange`.",
            "required": [
              "model",
              "cmd"
            ],
            "properties": {
              "cmd": {
                "type": "string",
                "enum": [
                  "SetAssistantModel"
                ]
              },
              "dry_run": {
                "type": "boolean"
              },
              "model": {
                "type": "string"
              }
            }
          },
          {
            "type": "object",
            "description": "Send the user's message, starting a conversation when\n`conversation_id` is `None`. Returns as soon as the turn starts, with\nthe conversation `running`; `AssistantUpdated` events follow until it\nsettles. Calls still waiting for the user are declined first. Returns\n`ResponseData::AssistantConversation`.",
            "required": [
              "message",
              "cmd"
            ],
            "properties": {
              "cmd": {
                "type": "string",
                "enum": [
                  "AssistantSend"
                ]
              },
              "context": {
                "$ref": "#/components/schemas/AssistantViewContextData"
              },
              "conversation_id": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "message": {
                "type": "string"
              }
            }
          },
          {
            "type": "object",
            "description": "Approve, reject or answer waiting calls. Approving runs exactly the\ncall that was shown. The turn continues once nothing waits. Returns\n`ResponseData::AssistantConversation`.",
            "required": [
              "conversation_id",
              "decisions",
              "cmd"
            ],
            "properties": {
              "cmd": {
                "type": "string",
                "enum": [
                  "AssistantDecide"
                ]
              },
              "conversation_id": {
                "type": "string"
              },
              "decisions": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/AssistantDecisionData"
                }
              }
            }
          },
          {
            "type": "object",
            "description": "Stop a running turn. Calls not yet run are recorded as cancelled.\nReturns `ResponseData::AssistantConversation`.",
            "required": [
              "conversation_id",
              "cmd"
            ],
            "properties": {
              "cmd": {
                "type": "string",
                "enum": [
                  "AssistantCancel"
                ]
              },
              "conversation_id": {
                "type": "string"
              }
            }
          },
          {
            "type": "object",
            "description": "Let reversible changes run without asking in this conversation, or\nstop. Sending, deleting, trash, spam and rules always ask. Returns\n`ResponseData::AssistantConversation`.",
            "required": [
              "conversation_id",
              "enabled",
              "cmd"
            ],
            "properties": {
              "cmd": {
                "type": "string",
                "enum": [
                  "SetAssistantAutoApprove"
                ]
              },
              "conversation_id": {
                "type": "string"
              },
              "enabled": {
                "type": "boolean"
              }
            }
          },
          {
            "type": "object",
            "description": "Most recently active first. Returns\n`ResponseData::AssistantConversations`.",
            "required": [
              "cmd"
            ],
            "properties": {
              "cmd": {
                "type": "string",
                "enum": [
                  "ListAssistantConversations"
                ]
              },
              "limit": {
                "type": [
                  "integer",
                  "null"
                ],
                "format": "int32",
                "minimum": 0
              }
            }
          },
          {
            "type": "object",
            "description": "Returns `ResponseData::AssistantConversation`.",
            "required": [
              "conversation_id",
              "cmd"
            ],
            "properties": {
              "cmd": {
                "type": "string",
                "enum": [
                  "GetAssistantConversation"
                ]
              },
              "conversation_id": {
                "type": "string"
              }
            }
          },
          {
            "type": "object",
            "description": "Every row a step's stored result lists, up to 500, for a client that\nshows the rest of a step's \"and N more\". A call id can repeat across\na conversation, so `seq` names the assistant message that declared\nthe call (the step's `seq`). An unknown conversation or step is an\nerror; a step with no stored result has no rows. Returns\n`ResponseData::AssistantStepRows`.",
            "required": [
              "conversation_id",
              "call_id",
              "seq",
              "cmd"
            ],
            "properties": {
              "call_id": {
                "type": "string"
              },
              "cmd": {
                "type": "string",
                "enum": [
                  "GetAssistantStepRows"
                ]
              },
              "conversation_id": {
                "type": "string"
              },
              "seq": {
                "type": "integer",
                "format": "int64"
              }
            }
          },
          {
            "type": "object",
            "description": "Delete a conversation and its transcript; `dry_run` says what would\ngo. A running turn must be stopped first. Returns\n`ResponseData::AssistantDelete`.",
            "required": [
              "conversation_id",
              "cmd"
            ],
            "properties": {
              "cmd": {
                "type": "string",
                "enum": [
                  "DeleteAssistantConversation"
                ]
              },
              "conversation_id": {
                "type": "string"
              },
              "dry_run": {
                "type": "boolean"
              }
            }
          },
          {
            "type": "object",
            "description": "One-time codes from mail received in the last day, at most `limit`\n(default 10): the current ones first, then expired ones, each newest\nfirst. Found by rules in the subject and body, any folder but\nTrash and Spam. Read only. Returns `ResponseData::OneTimeCodes`.",
            "required": [
              "cmd"
            ],
            "properties": {
              "account_id": {
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/AccountId"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "cmd": {
                "type": "string",
                "enum": [
                  "ListOneTimeCodes"
                ]
              },
              "limit": {
                "type": [
                  "integer",
                  "null"
                ],
                "format": "int32",
                "minimum": 0
              }
            }
          },
          {
            "type": "object",
            "description": "The Updates briefing (blueprint 22, phase 4): everything that\narrived by the cut (`cut`, else the latest one) and wasn't let go,\none line per source in Needs a look, Changed and Routine, plus what\narrived since. Rules only; deltas are computed, never written by a\nmodel. `mark_seen` records that Updates was opened, so the expired\ncount starts again and the mute question counts as asked;\n`expired` lists every update past its window. Returns\n`ResponseData::UpdatesDigest`.",
            "required": [
              "cmd"
            ],
            "properties": {
              "account_id": {
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/AccountId"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "cmd": {
                "type": "string",
                "enum": [
                  "GetUpdatesDigest"
                ]
              },
              "cut": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "date-time"
              },
              "expired": {
                "type": "boolean"
              },
              "mark_seen": {
                "type": "boolean"
              }
            }
          },
          {
            "type": "object",
            "description": "Let go of a digest: every update in the cut leaves Updates, shown or\nhidden by tuning or expiry, and nothing that arrived after it. A\nthread no other mode holds is archived at the provider when\n`modes.archive_on_last_done` is on. `source_key` lets go of one\nsource only. `dry_run` returns the same selection; pass its\n`selection_token` back and the run refuses if the cut changed in\nbetween. Returns `ResponseData::UpdatesLetGo`.",
            "required": [
              "cmd"
            ],
            "properties": {
              "account_id": {
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/AccountId"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "cmd": {
                "type": "string",
                "enum": [
                  "LetGoDigest"
                ]
              },
              "cut": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "date-time"
              },
              "dry_run": {
                "type": "boolean"
              },
              "selection_token": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "source_key": {
                "type": [
                  "string",
                  "null"
                ]
              }
            }
          },
          {
            "type": "object",
            "description": "Tune a source: every digest, changes only, muted, or breakthrough\n(every message at the top of Needs a look with a suggested to-do). `source` is a source key\n(\"github.com/acme/api\") or a sender address. Returns\n`ResponseData::UpdateSource`.",
            "required": [
              "source",
              "setting",
              "cmd"
            ],
            "properties": {
              "account_id": {
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/AccountId"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "cmd": {
                "type": "string",
                "enum": [
                  "SetUpdateSource"
                ]
              },
              "dry_run": {
                "type": "boolean"
              },
              "setting": {
                "$ref": "#/components/schemas/UpdateSourceSettingData"
              },
              "source": {
                "type": "string"
              }
            }
          },
          {
            "type": "object",
            "description": "A place (Reading or Paper trail): inbox mail of that kind grouped by\nsender, newest bundle first, each with the reason it is there.\n`account_id: None` covers every enabled account.",
            "required": [
              "place",
              "cmd"
            ],
            "properties": {
              "account_id": {
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/AccountId"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "cmd": {
                "type": "string",
                "enum": [
                  "ListPlace"
                ]
              },
              "limit": {
                "type": "integer",
                "format": "int32",
                "description": "Bundles per page.",
                "minimum": 0
              },
              "message_offset": {
                "type": "integer",
                "format": "int32",
                "description": "Messages to skip in each bundle, for paging through one\nsender's mail (pinned messages list first).",
                "minimum": 0
              },
              "messages_per_bundle": {
                "type": "integer",
                "format": "int32",
                "description": "Messages listed per bundle; counts always cover the whole bundle.",
                "minimum": 0
              },
              "offset": {
                "type": "integer",
                "format": "int32",
                "minimum": 0
              },
              "place": {
                "$ref": "#/components/schemas/MailPlaceData"
              },
              "sender_email": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "Only this sender's bundle."
              }
            }
          },
          {
            "type": "object",
            "description": "Why one message is where it is: its kind, rule and reason.",
            "required": [
              "message_id",
              "cmd"
            ],
            "properties": {
              "cmd": {
                "type": "string",
                "enum": [
                  "GetMessageKind"
                ]
              },
              "message_id": {
                "$ref": "#/components/schemas/MessageId"
              }
            }
          },
          {
            "type": "object",
            "description": "Move a sender to a kind for this and all future mail, or with\n`kind: None` return it to automatic. Stored as the sender's screener\ndecision (People: allow, Reading: feed, Paper trail: paper trail,\nScreened out: deny).",
            "required": [
              "account_id",
              "sender_email",
              "cmd"
            ],
            "properties": {
              "account_id": {
                "$ref": "#/components/schemas/AccountId"
              },
              "cmd": {
                "type": "string",
                "enum": [
                  "SetSenderKind"
                ]
              },
              "kind": {
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/SenderKindData"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "sender_email": {
                "type": "string"
              }
            }
          },
          {
            "type": "object",
            "description": "Pin or unpin messages: a pinned message stays put when its bundle\nor place is swept. Local to this machine.",
            "required": [
              "message_ids",
              "pinned",
              "cmd"
            ],
            "properties": {
              "cmd": {
                "type": "string",
                "enum": [
                  "PinMessages"
                ]
              },
              "message_ids": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/MessageId"
                }
              },
              "pinned": {
                "type": "boolean"
              }
            }
          },
          {
            "type": "object",
            "description": "Archive every unpinned message in a place, or in one sender's bundle.\n`dry_run` returns what would be archived and a `preview_token`. The\nreal sweep needs that token and archives only what the preview\nlisted that is still in the place and still unpinned, never mail\nthat arrived or moved in since, as an undoable archive job.",
            "required": [
              "place",
              "cmd"
            ],
            "properties": {
              "account_id": {
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/AccountId"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "cmd": {
                "type": "string",
                "enum": [
                  "SweepPlace"
                ]
              },
              "dry_run": {
                "type": "boolean"
              },
              "place": {
                "$ref": "#/components/schemas/MailPlaceData"
              },
              "preview_token": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "From the dry run; required when `dry_run` is false."
              },
              "sender_email": {
                "type": [
                  "string",
                  "null"
                ]
              }
            }
          },
          {
            "type": "object",
            "description": "The desk's Done: nothing for me to do here, put it away. You owe and\nNew from people rows are archived, marked read and kept off the desk\nuntil someone writes in the conversation again; Waiting on rows are\nmarked read and done waiting; a Due promise is resolved and its\nconversation marked read. `dry_run` returns the same plan per item\nwithout changing anything. The real run returns one `mutation_id`\nfor `UndoMutation`, which puts messages, dismissals and promises\nback as they were. Returns `ResponseData::DeskItemsResolved`.",
            "required": [
              "items",
              "cmd"
            ],
            "properties": {
              "cmd": {
                "type": "string",
                "enum": [
                  "ResolveDeskItems"
                ]
              },
              "dry_run": {
                "type": "boolean"
              },
              "items": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/DeskDoneItemData"
                }
              }
            }
          },
          {
            "type": "object",
            "description": "Gists for list rows, many conversations at once. Returns the cached\ngists that still match each conversation at once, without calling a\nmodel. With `generate`, conversations from people that have none are\nqueued for a background writer, in the order given (put the rows on\nscreen first); each gist arrives as `DaemonEvent::ThreadGistReady`.\nWith `automated`, conversations from automated senders (receipts,\nalerts: what Updates shows) are queued too, and written with the\nnotification prompt. A newer request goes ahead of older ones, and\nasking again for a queued conversation never queues it twice. At\nmost 100 ids. Returns `ResponseData::ThreadGists`.",
            "required": [
              "thread_ids",
              "cmd"
            ],
            "properties": {
              "automated": {
                "type": "boolean"
              },
              "cmd": {
                "type": "string",
                "enum": [
                  "GetThreadGists"
                ]
              },
              "generate": {
                "type": "boolean"
              },
              "thread_ids": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/ThreadId"
                }
              }
            }
          },
          {
            "type": "object",
            "description": "Reply later, or wait, until `until`, per conversation by who wrote\nlast: when they did, reply later (off the desk and out of the reply\nqueue until then, back in both at the time); when you did, bring it\nback if nobody replies (off Waiting on until then; at the time,\nunless someone replied, back on Waiting on and in the reply queue).\n`until` is the instant the client previewed, never a phrase, and\nmust be in the future. `dry_run` returns the same plan without\nchanging anything. The real run returns one `mutation_id` for\n`UndoMutation`, which puts the flags and reminders back as they\nwere. Returns `ResponseData::ThreadsDeferred`.",
            "required": [
              "thread_ids",
              "until",
              "cmd"
            ],
            "properties": {
              "cmd": {
                "type": "string",
                "enum": [
                  "DeferThreads"
                ]
              },
              "dry_run": {
                "type": "boolean"
              },
              "thread_ids": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/ThreadId"
                }
              },
              "until": {
                "type": "string",
                "format": "date-time"
              }
            }
          }
        ],
        "description": "Every command a client can ask the daemon to perform.\n\nTagged `cmd` on the wire. One flat enum is the whole client-facing\nsurface: the CLI, TUI, web bridge, and MCP server all speak these same\nrequests, which is what keeps daemon capabilities client-agnostic (see\n[`IpcCategory`] for the conceptual grouping). Mutations are expressed as\nexplicit commands with dry-run/preview options rather than free-form\nstate writes."
      },
      "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"
                ]
              }
            }
          }
        ],
        "description": "The daemon's reply to a [`Request`], correlated by [`IpcMessage::id`].\n\nEither `Ok` wrapping a [`ResponseData`] payload, or `Error` with a\nhuman-readable message plus a machine-readable [`IpcErrorKind`] so\nclients can branch on failure class instead of parsing strings."
      },
      "ResponseData": {
        "oneOf": [
          {
            "type": "object",
            "required": [
              "requires_save",
              "draft",
              "from",
              "workspace",
              "send_identity",
              "pending_attachments",
              "report",
              "kind"
            ],
            "properties": {
              "draft": {
                "$ref": "#/components/schemas/Draft"
              },
              "from": {
                "$ref": "#/components/schemas/Address"
              },
              "kind": {
                "type": "string",
                "enum": [
                  "DraftPreview"
                ]
              },
              "pending_attachments": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/DraftAttachment"
                }
              },
              "report": {
                "$ref": "#/components/schemas/DraftSafetyReport"
              },
              "requires_save": {
                "type": "boolean"
              },
              "send_identity": {
                "$ref": "#/components/schemas/SendIdentity"
              },
              "workspace": {
                "$ref": "#/components/schemas/ArchiveWorkspaceData"
              }
            }
          },
          {
            "type": "object",
            "required": [
              "protocol_version",
              "host_id",
              "workspace",
              "client_id",
              "kind"
            ],
            "properties": {
              "accepting_mail": {
                "type": "boolean",
                "description": "A draining host still admits status and original-operation recovery."
              },
              "attachment_transfer_supported": {
                "type": "boolean"
              },
              "boot_id": {
                "type": "string",
                "description": "Changes with every daemon boot; stale lifecycle notices must not cross it."
              },
              "capabilities": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/RemoteCapability"
                }
              },
              "client_id": {
                "type": "string"
              },
              "draft_attachment_upload_supported": {
                "type": "boolean"
              },
              "draft_revision_supported": {
                "type": "boolean"
              },
              "host_id": {
                "type": "string"
              },
              "kind": {
                "type": "string",
                "enum": [
                  "RemoteReady"
                ]
              },
              "protocol_version": {
                "type": "integer",
                "format": "int32",
                "minimum": 0
              },
              "send_outcome_supported": {
                "type": "boolean"
              },
              "shutdown_deadline_at": {
                "type": [
                  "integer",
                  "null"
                ],
                "format": "int64"
              },
              "workspace": {
                "$ref": "#/components/schemas/ArchiveWorkspaceData"
              }
            }
          },
          {
            "type": "object",
            "required": [
              "response",
              "kind"
            ],
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "RemoteAuthority"
                ]
              },
              "response": {
                "$ref": "#/components/schemas/RemoteResponse"
              }
            }
          },
          {
            "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": [
              "chunk",
              "kind"
            ],
            "properties": {
              "chunk": {
                "$ref": "#/components/schemas/InlineImageChunkData"
              },
              "kind": {
                "type": "string",
                "enum": [
                  "InlineImageChunk"
                ]
              }
            }
          },
          {
            "type": "object",
            "required": [
              "file",
              "kind"
            ],
            "properties": {
              "file": {
                "$ref": "#/components/schemas/AttachmentFile"
              },
              "kind": {
                "type": "string",
                "enum": [
                  "AttachmentFile"
                ]
              }
            }
          },
          {
            "type": "object",
            "required": [
              "metadata",
              "kind"
            ],
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "DraftAttachment"
                ]
              },
              "metadata": {
                "$ref": "#/components/schemas/DraftAttachment"
              }
            }
          },
          {
            "type": "object",
            "required": [
              "metadata",
              "kind"
            ],
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "AttachmentTransferMetadata"
                ]
              },
              "metadata": {
                "$ref": "#/components/schemas/AttachmentTransferMetadata"
              }
            }
          },
          {
            "type": "object",
            "required": [
              "chunk",
              "kind"
            ],
            "properties": {
              "chunk": {
                "$ref": "#/components/schemas/AttachmentChunk"
              },
              "kind": {
                "type": "string",
                "enum": [
                  "AttachmentChunk"
                ]
              }
            }
          },
          {
            "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": [
                  {
                    "$ref": "#/components/schemas/ThreadSummaryData"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "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": [
              "mailboxes",
              "kind"
            ],
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "SystemMailboxCounts"
                ]
              },
              "mailboxes": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/SystemMailboxCount"
                }
              }
            }
          },
          {
            "type": "object",
            "required": [
              "label",
              "kind"
            ],
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "Label"
                ]
              },
              "label": {
                "$ref": "#/components/schemas/Label"
              }
            }
          },
          {
            "type": "object",
            "required": [
              "categories",
              "kind"
            ],
            "properties": {
              "categories": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/PersonalCategory"
                }
              },
              "kind": {
                "type": "string",
                "enum": [
                  "Categories"
                ]
              }
            }
          },
          {
            "type": "object",
            "required": [
              "normalized_name",
              "available",
              "kind"
            ],
            "properties": {
              "available": {
                "type": "boolean"
              },
              "kind": {
                "type": "string",
                "enum": [
                  "CategoryNamePreview"
                ]
              },
              "normalized_name": {
                "type": "string"
              }
            }
          },
          {
            "type": "object",
            "required": [
              "envelopes",
              "total",
              "has_more",
              "kind"
            ],
            "properties": {
              "envelopes": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/Envelope"
                }
              },
              "has_more": {
                "type": "boolean"
              },
              "kind": {
                "type": "string",
                "enum": [
                  "CategoryMessages"
                ]
              },
              "total": {
                "type": "integer",
                "format": "int32",
                "minimum": 0
              }
            }
          },
          {
            "type": "object",
            "required": [
              "states",
              "kind"
            ],
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "CategoryMembershipStates"
                ]
              },
              "states": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/CategoryMembershipState"
                }
              }
            }
          },
          {
            "type": "object",
            "required": [
              "preview",
              "kind"
            ],
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "CategoryMembershipPreview"
                ]
              },
              "preview": {
                "$ref": "#/components/schemas/CategoryMembershipPreview"
              }
            }
          },
          {
            "type": "object",
            "required": [
              "mutation_id",
              "added",
              "removed",
              "kind"
            ],
            "properties": {
              "added": {
                "type": "integer",
                "format": "int32",
                "minimum": 0
              },
              "kind": {
                "type": "string",
                "enum": [
                  "CategoryMembershipApplied"
                ]
              },
              "mutation_id": {
                "type": "string"
              },
              "removed": {
                "type": "integer",
                "format": "int32",
                "minimum": 0
              }
            }
          },
          {
            "type": "object",
            "required": [
              "preview",
              "kind"
            ],
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "CategoryDeletePreview"
                ]
              },
              "preview": {
                "$ref": "#/components/schemas/CategoryDeletePreview"
              }
            }
          },
          {
            "type": "object",
            "required": [
              "category_id",
              "name",
              "kind"
            ],
            "properties": {
              "category_id": {
                "$ref": "#/components/schemas/CategoryId"
              },
              "kind": {
                "type": "string",
                "enum": [
                  "CategoryDeleted"
                ]
              },
              "name": {
                "type": "string"
              }
            }
          },
          {
            "type": "object",
            "required": [
              "restored",
              "skipped",
              "kind"
            ],
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "CategoryMembershipUndone"
                ]
              },
              "restored": {
                "type": "integer",
                "format": "int32",
                "minimum": 0
              },
              "skipped": {
                "type": "integer",
                "format": "int32",
                "minimum": 0
              }
            }
          },
          {
            "type": "object",
            "required": [
              "results",
              "kind"
            ],
            "properties": {
              "degraded": {
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/SearchDegraded",
                    "description": "Set when the lexical index was unavailable and SQLite answered a\nnarrower question. Absent when the index answered."
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "explain": {
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/SearchExplain"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "has_more": {
                "type": "boolean"
              },
              "kind": {
                "type": "string",
                "enum": [
                  "SearchResults"
                ]
              },
              "limit": {
                "type": [
                  "integer",
                  "null"
                ],
                "format": "int32",
                "description": "The page size the daemon actually used, which may come from\n`[search] max_results`. Older daemons omit it.",
                "minimum": 0
              },
              "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",
            "description": "Targets selected by `Request::PreviewSyncAll`.",
            "required": [
              "targets",
              "kind"
            ],
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "SyncPlan"
                ]
              },
              "targets": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/SyncTarget"
                }
              }
            }
          },
          {
            "type": "object",
            "description": "Per-account result of `Request::SyncAll`.",
            "required": [
              "results",
              "kind"
            ],
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "SyncBatch"
                ]
              },
              "results": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/SyncAccountResult"
                }
              }
            }
          },
          {
            "type": "object",
            "description": "Returned by `Request::GetFreshness`.",
            "required": [
              "freshness",
              "kind"
            ],
            "properties": {
              "freshness": {
                "$ref": "#/components/schemas/FreshnessData"
              },
              "kind": {
                "type": "string",
                "enum": [
                  "Freshness"
                ]
              }
            }
          },
          {
            "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",
            "description": "A single locally-stored draft, returned by `Request::GetDraft`.",
            "required": [
              "draft",
              "kind"
            ],
            "properties": {
              "draft": {
                "$ref": "#/components/schemas/Draft"
              },
              "kind": {
                "type": "string",
                "enum": [
                  "Draft"
                ]
              }
            }
          },
          {
            "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",
            "description": "Returned by `Request::ListScheduledSends`.",
            "required": [
              "sends",
              "kind"
            ],
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "ScheduledSends"
                ]
              },
              "sends": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/ScheduledSendData"
                }
              }
            }
          },
          {
            "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",
            "description": "Returned by `Request::RebuildRelationshipProfiles`.",
            "required": [
              "summary",
              "kind"
            ],
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "RelationshipRebuild"
                ]
              },
              "summary": {
                "$ref": "#/components/schemas/RelationshipRebuildSummary"
              }
            }
          },
          {
            "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": [
                  {
                    "$ref": "#/components/schemas/SignatureData"
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            }
          },
          {
            "type": "object",
            "required": [
              "kind"
            ],
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "SenderProfile"
                ]
              },
              "profile": {
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/SenderProfileData"
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            }
          },
          {
            "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": [
                  {
                    "$ref": "#/components/schemas/RelationshipProfileData"
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            }
          },
          {
            "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": [
                  {
                    "$ref": "#/components/schemas/UserVoiceProfileData"
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            }
          },
          {
            "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"
              },
              "rewrite": {
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/DraftRewriteProvenanceData",
                    "description": "The model that rewrote the text, when one did."
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "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": [
                  {
                    "$ref": "#/components/schemas/HumanizerReportSummaryData"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "inferred_length": {
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/DraftLengthHintData"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "inferred_register": {
                "oneOf": [
                  {
                    "$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."
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "kind": {
                "type": "string",
                "enum": [
                  "DraftSuggestion"
                ]
              },
              "model": {
                "type": "string"
              },
              "provenance": {
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/DraftProvenanceData",
                    "description": "What the draft was written from, for the \"which model, whose\nhistory, which emails\" line."
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "rewrite_iterations": {
                "type": "integer",
                "format": "int32",
                "minimum": 0
              },
              "voice_match": {
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/VoiceMatchData"
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            }
          },
          {
            "type": "object",
            "required": [
              "cases",
              "summary",
              "kind"
            ],
            "properties": {
              "cases": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/DraftEvalCaseData"
                }
              },
              "kind": {
                "type": "string",
                "enum": [
                  "DraftEval"
                ]
              },
              "summary": {
                "$ref": "#/components/schemas/DraftEvalSummaryData"
              }
            }
          },
          {
            "type": "object",
            "description": "Returned by `Request::ComposeAssist`.",
            "required": [
              "proposal",
              "kind"
            ],
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "ComposeProposal"
                ]
              },
              "proposal": {
                "$ref": "#/components/schemas/ComposeProposalData"
              }
            }
          },
          {
            "type": "object",
            "description": "Returned by `Request::ApplyComposeProposal`: the stored draft now holds\nthe proposal; `text_hash` is the hex SHA-256 of its new text region.",
            "required": [
              "draft_id",
              "text_hash",
              "kind"
            ],
            "properties": {
              "draft_id": {
                "$ref": "#/components/schemas/DraftId"
              },
              "kind": {
                "type": "string",
                "enum": [
                  "ComposeApplied"
                ]
              },
              "text_hash": {
                "type": "string"
              }
            }
          },
          {
            "type": "object",
            "description": "Returned by `Request::DraftEvalQuick`: the labelled synthetic corpus\nonly, never the user's mail.",
            "required": [
              "cases",
              "summary",
              "kind"
            ],
            "properties": {
              "cases": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/DraftEvalQuickCaseData"
                }
              },
              "kind": {
                "type": "string",
                "enum": [
                  "DraftEvalQuick"
                ]
              },
              "summary": {
                "$ref": "#/components/schemas/DraftEvalQuickSummaryData"
              }
            }
          },
          {
            "type": "object",
            "description": "Returned by `Request::ClassifyEval`. Mismatches are sorted by\nscenario, then provider id, then question.",
            "required": [
              "report",
              "kind"
            ],
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "ClassifyReport"
                ]
              },
              "report": {
                "$ref": "#/components/schemas/ClassifyReportData"
              }
            }
          },
          {
            "type": "object",
            "required": [
              "comparison",
              "kind"
            ],
            "properties": {
              "comparison": {
                "$ref": "#/components/schemas/ClassifyComparisonData"
              },
              "kind": {
                "type": "string",
                "enum": [
                  "ClassifyCompare"
                ]
              }
            }
          },
          {
            "type": "object",
            "required": [
              "summary",
              "mismatches",
              "kind"
            ],
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "ClassifyEval"
                ]
              },
              "mismatches": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/ClassifyEvalMismatchData"
                }
              },
              "summary": {
                "$ref": "#/components/schemas/ClassifyEvalSummaryData"
              }
            }
          },
          {
            "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": [
              "workspace",
              "kind"
            ],
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "ArchiveWorkspace"
                ]
              },
              "workspace": {
                "$ref": "#/components/schemas/ArchiveWorkspaceData"
              }
            }
          },
          {
            "type": "object",
            "required": [
              "recovery",
              "kind"
            ],
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "RecoveryStatus"
                ]
              },
              "recovery": {
                "$ref": "#/components/schemas/RecoveryStatusData"
              }
            }
          },
          {
            "type": "object",
            "required": [
              "action",
              "kind"
            ],
            "properties": {
              "action": {
                "$ref": "#/components/schemas/RecoveryActionData"
              },
              "kind": {
                "type": "string",
                "enum": [
                  "RecoveryAction"
                ]
              }
            }
          },
          {
            "type": "object",
            "required": [
              "operation",
              "kind"
            ],
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "ArchiveOperation"
                ]
              },
              "operation": {
                "$ref": "#/components/schemas/ArchiveOperationData"
              }
            }
          },
          {
            "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": [
              "preview",
              "kind"
            ],
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "UndoPreview"
                ]
              },
              "preview": {
                "$ref": "#/components/schemas/UndoPreview"
              }
            }
          },
          {
            "type": "object",
            "required": [
              "preview",
              "kind"
            ],
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "SelectionPreview"
                ]
              },
              "preview": {
                "$ref": "#/components/schemas/SelectionPreviewData"
              }
            }
          },
          {
            "type": "object",
            "required": [
              "result",
              "kind"
            ],
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "UnsubscribePurgeResult"
                ]
              },
              "result": {
                "$ref": "#/components/schemas/UnsubscribePurgeResultData"
              }
            }
          },
          {
            "type": "object",
            "required": [
              "plan",
              "kind"
            ],
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "UnsubscribePlan"
                ]
              },
              "plan": {
                "$ref": "#/components/schemas/UnsubscribePlanData"
              }
            }
          },
          {
            "type": "object",
            "required": [
              "preview",
              "kind"
            ],
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "RuleCategoriesResult"
                ]
              },
              "preview": {
                "$ref": "#/components/schemas/RuleCategoriesPreviewData"
              }
            }
          },
          {
            "type": "object",
            "required": [
              "explanation",
              "kind"
            ],
            "properties": {
              "explanation": {},
              "kind": {
                "type": "string",
                "enum": [
                  "CategoryMembershipExplanation"
                ]
              }
            }
          },
          {
            "type": "object",
            "required": [
              "preview",
              "kind"
            ],
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "RuleTreatmentResult"
                ]
              },
              "preview": {
                "$ref": "#/components/schemas/RuleTreatmentPreviewData"
              }
            }
          },
          {
            "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": [
              "report",
              "kind"
            ],
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "StoreCompaction"
                ]
              },
              "report": {
                "$ref": "#/components/schemas/StoreCompactionReport"
              }
            }
          },
          {
            "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",
            "description": "Reply to an address add, remove or primary change: how many stored\nmessages of the account were reclassified to match the new owned set.",
            "required": [
              "to_outbound",
              "to_inbound",
              "kind"
            ],
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "AccountAddressChanged"
                ]
              },
              "to_inbound": {
                "type": "integer",
                "format": "int32",
                "description": "Outbound messages now read as inbound: their sender is no longer owned.",
                "minimum": 0
              },
              "to_outbound": {
                "type": "integer",
                "format": "int32",
                "description": "Inbound messages now read as outbound: their sender is owned.",
                "minimum": 0
              }
            }
          },
          {
            "type": "object",
            "description": "Effective From address resolved (and ownership-validated) by\n`Request::ResolveSendFrom`.",
            "required": [
              "from",
              "kind"
            ],
            "properties": {
              "from": {
                "$ref": "#/components/schemas/Address"
              },
              "kind": {
                "type": "string",
                "enum": [
                  "ResolvedSendFrom"
                ]
              }
            }
          },
          {
            "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": [
              "change",
              "kind"
            ],
            "properties": {
              "change": {
                "$ref": "#/components/schemas/LlmKeyChangeData"
              },
              "kind": {
                "type": "string",
                "enum": [
                  "LlmKeyChange"
                ]
              }
            }
          },
          {
            "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"
                }
              },
              "archive_recovery_supported": {
                "type": "boolean"
              },
              "attachment_transfer_supported": {
                "type": "boolean"
              },
              "daemon_build_id": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "daemon_pid": {
                "type": [
                  "integer",
                  "null"
                ],
                "format": "int32",
                "minimum": 0
              },
              "daemon_version": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "degraded": {
                "type": "boolean",
                "description": "The DB-backed part of this snapshot (`accounts`, `total_messages`,\n`sync_statuses`) timed out and carries no reading: those three\nfields are empty/zero because the daemon could not answer in time,\nnot because the store is empty or idle. Poll again rather than\nconcluding anything from them. The DB-free fields (versions,\n`daemon_pid`, `feature_health`) are always a real reading."
              },
              "draft_attachment_upload_supported": {
                "type": "boolean"
              },
              "draft_revision_supported": {
                "type": "boolean"
              },
              "feature_health": {
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/FeatureHealthReport"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "kind": {
                "type": "string",
                "enum": [
                  "Status"
                ]
              },
              "protocol_version": {
                "type": "integer",
                "format": "int32",
                "minimum": 0
              },
              "recovery": {
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/RecoveryStatusData"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "recovery_supported": {
                "type": "boolean"
              },
              "repair_required": {
                "type": "boolean"
              },
              "semantic_runtime": {
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/SemanticRuntimeMetrics"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "send_outcome_supported": {
                "type": "boolean"
              },
              "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
              },
              "workspace_owner_supported": {
                "type": "boolean"
              }
            }
          },
          {
            "type": "object",
            "required": [
              "kind"
            ],
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "Pong"
                ]
              }
            }
          },
          {
            "type": "object",
            "required": [
              "protocol_version",
              "daemon_version",
              "daemon_build_id",
              "daemon_pid",
              "kind"
            ],
            "properties": {
              "daemon_build_id": {
                "type": "string"
              },
              "daemon_pid": {
                "type": "integer",
                "format": "int32",
                "minimum": 0
              },
              "daemon_version": {
                "type": "string"
              },
              "kind": {
                "type": "string",
                "enum": [
                  "DaemonIdentity"
                ]
              },
              "protocol_version": {
                "type": "integer",
                "format": "int32",
                "minimum": 0
              }
            }
          },
          {
            "type": "object",
            "required": [
              "kind"
            ],
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "Ack"
                ]
              }
            }
          },
          {
            "type": "object",
            "description": "Success reply to [`Request::Authenticate`]: the connection is now\ntrusted for the remainder of its lifetime (phase 5 token transports).",
            "required": [
              "kind"
            ],
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "Authenticated"
                ]
              }
            }
          },
          {
            "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": "Durable result of `Request::GetSendOutcome`.",
            "required": [
              "kind"
            ],
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "SendOutcome"
                ]
              },
              "outcome": {
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/DraftSendOutcome"
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            }
          },
          {
            "type": "object",
            "required": [
              "outcome",
              "recoverable",
              "reason",
              "kind"
            ],
            "properties": {
              "evidence_sha256": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "kind": {
                "type": "string",
                "enum": [
                  "SendRecoveryPreview"
                ]
              },
              "outcome": {
                "$ref": "#/components/schemas/DraftSendOutcome"
              },
              "reason": {
                "type": "string"
              },
              "recoverable": {
                "type": "boolean"
              }
            }
          },
          {
            "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"
                ]
              },
              "people": {
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/PeopleSplitData",
                    "description": "The desk's people split for the account (default mode only):\n`write_with` is the people these rows are with, `others` the\npeople who wrote to you and wait in Messages."
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "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": [
                  {
                    "$ref": "#/components/schemas/DecisionLogEntryData"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "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": [
                  {
                    "$ref": "#/components/schemas/ActivityCursor"
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            }
          },
          {
            "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": [
                  {
                    "$ref": "#/components/schemas/SavedActivityFilterEntry"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "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"
                ]
              }
            }
          },
          {
            "type": "object",
            "description": "Returned by `Request::ResolveTime`. Exactly one of `resolution` and\n`error` is set; a phrase that doesn't resolve is a normal answer,\nnot an IPC failure, so live previews can show why.",
            "required": [
              "input",
              "kind"
            ],
            "properties": {
              "error": {
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/TimeResolveError"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "input": {
                "type": "string"
              },
              "kind": {
                "type": "string",
                "enum": [
                  "ResolvedTime"
                ]
              },
              "resolution": {
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/TimeResolution"
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            }
          },
          {
            "type": "object",
            "description": "Returned by `Request::GetThreadContext`.",
            "required": [
              "context",
              "kind"
            ],
            "properties": {
              "context": {
                "$ref": "#/components/schemas/ThreadContextData"
              },
              "kind": {
                "type": "string",
                "enum": [
                  "ThreadContext"
                ]
              }
            }
          },
          {
            "type": "object",
            "description": "Returned by `Request::GetThreadGist`.",
            "required": [
              "gist",
              "kind"
            ],
            "properties": {
              "gist": {
                "$ref": "#/components/schemas/ThreadGistData"
              },
              "kind": {
                "type": "string",
                "enum": [
                  "ThreadGist"
                ]
              }
            }
          },
          {
            "type": "object",
            "description": "Returned by `Request::GetDesk`.",
            "required": [
              "owed",
              "due",
              "waiting",
              "people_new",
              "elsewhere",
              "generated_at",
              "kind"
            ],
            "properties": {
              "account_id": {
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/AccountId"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "due": {
                "$ref": "#/components/schemas/DeskLaneData"
              },
              "elsewhere": {
                "$ref": "#/components/schemas/DeskElsewhereData"
              },
              "generated_at": {
                "type": "string",
                "format": "date-time"
              },
              "kind": {
                "type": "string",
                "enum": [
                  "Desk"
                ]
              },
              "last_from_people_at": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "date-time",
                "description": "The latest message from a person that reached the inbox, for\n\"nothing from people since ...\" lines."
              },
              "owed": {
                "$ref": "#/components/schemas/DeskLaneData"
              },
              "people": {
                "$ref": "#/components/schemas/PeopleSplitData",
                "description": "People waiting on you, split as every surface counts them."
              },
              "people_new": {
                "$ref": "#/components/schemas/DeskLaneData"
              },
              "waiting": {
                "$ref": "#/components/schemas/DeskLaneData"
              }
            }
          },
          {
            "type": "object",
            "description": "Returned by `Request::DismissDeskThreads`: the threads that were (or,\nwith `dry_run`, would be) taken off Waiting.",
            "required": [
              "threads",
              "dry_run",
              "kind"
            ],
            "properties": {
              "dry_run": {
                "type": "boolean"
              },
              "kind": {
                "type": "string",
                "enum": [
                  "DeskThreadsDismissed"
                ]
              },
              "threads": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/DeskThreadRefData"
                }
              }
            }
          },
          {
            "type": "object",
            "description": "Returned by `Request::RestoreDeskThreads`.",
            "required": [
              "restored",
              "kind"
            ],
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "DeskThreadsRestored"
                ]
              },
              "restored": {
                "type": "integer",
                "format": "int64",
                "minimum": 0
              }
            }
          },
          {
            "type": "object",
            "description": "Returned by `Request::DetectPromises`.",
            "required": [
              "detection",
              "kind"
            ],
            "properties": {
              "detection": {
                "$ref": "#/components/schemas/PromiseDetectionData"
              },
              "kind": {
                "type": "string",
                "enum": [
                  "Promises"
                ]
              }
            }
          },
          {
            "type": "object",
            "description": "Returned by `Request::RecordPromise`. With `dry_run` the commitment\nis what would be stored and its `id` is empty.",
            "required": [
              "commitment",
              "dry_run",
              "kind"
            ],
            "properties": {
              "commitment": {
                "$ref": "#/components/schemas/CommitmentData"
              },
              "dry_run": {
                "type": "boolean"
              },
              "kind": {
                "type": "string",
                "enum": [
                  "RecordedPromise"
                ]
              }
            }
          },
          {
            "type": "object",
            "required": [
              "status",
              "kind"
            ],
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "MicrosoftTodoStatus"
                ]
              },
              "status": {
                "$ref": "#/components/schemas/MicrosoftTodoStatusData"
              }
            }
          },
          {
            "type": "object",
            "required": [
              "result",
              "kind"
            ],
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "MicrosoftTodoSend"
                ]
              },
              "result": {
                "$ref": "#/components/schemas/MicrosoftTodoSendData"
              }
            }
          },
          {
            "type": "object",
            "required": [
              "sync",
              "kind"
            ],
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "MicrosoftTodoSync"
                ]
              },
              "sync": {
                "$ref": "#/components/schemas/MicrosoftTodoSyncData"
              }
            }
          },
          {
            "type": "object",
            "description": "Returned by `Request::GetTodoRunway`.",
            "required": [
              "runway",
              "kind"
            ],
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "TodoRunway"
                ]
              },
              "runway": {
                "$ref": "#/components/schemas/TodoRunwayData"
              }
            }
          },
          {
            "type": "object",
            "description": "Returned by `Request::ListTodos`.",
            "required": [
              "todos",
              "kind"
            ],
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "Todos"
                ]
              },
              "todos": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/TodoData"
                }
              }
            }
          },
          {
            "type": "object",
            "description": "Returned by `Request::GetTodo`.",
            "required": [
              "todo",
              "kind"
            ],
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "Todo"
                ]
              },
              "todo": {
                "$ref": "#/components/schemas/TodoData"
              }
            }
          },
          {
            "type": "object",
            "description": "Returned by every to-do mutation.",
            "required": [
              "change",
              "kind"
            ],
            "properties": {
              "change": {
                "$ref": "#/components/schemas/TodoChangeData"
              },
              "kind": {
                "type": "string",
                "enum": [
                  "TodoChange"
                ]
              }
            }
          },
          {
            "type": "object",
            "description": "Returned by `Request::GetTodoCatchup`.",
            "required": [
              "catchup",
              "kind"
            ],
            "properties": {
              "catchup": {
                "$ref": "#/components/schemas/TodoCatchupData"
              },
              "kind": {
                "type": "string",
                "enum": [
                  "TodoCatchup"
                ]
              }
            }
          },
          {
            "type": "object",
            "description": "Returned by `Request::GetKeymap`.",
            "required": [
              "keymap",
              "kind"
            ],
            "properties": {
              "keymap": {
                "$ref": "#/components/schemas/KeymapData"
              },
              "kind": {
                "type": "string",
                "enum": [
                  "Keymap"
                ]
              }
            }
          },
          {
            "type": "object",
            "description": "Returned by `Request::UpdateKeys`.",
            "required": [
              "update",
              "kind"
            ],
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "KeysUpdate"
                ]
              },
              "update": {
                "$ref": "#/components/schemas/KeysUpdateData"
              }
            }
          },
          {
            "type": "object",
            "description": "Returned by `Request::GetModeGuide` and `Request::SetHintSeen`.",
            "required": [
              "guides",
              "kind"
            ],
            "properties": {
              "guides": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/ModeGuideData"
                }
              },
              "kind": {
                "type": "string",
                "enum": [
                  "ModeGuides"
                ]
              }
            }
          },
          {
            "type": "object",
            "description": "Returned by `Request::SetHintSeen` for a \"Next time\" hint: whether\nthis request is the one that marked it seen, so a client names the\nkey exactly once per profile, whichever client runs the action first.",
            "required": [
              "hint",
              "newly_seen",
              "kind"
            ],
            "properties": {
              "hint": {
                "type": "string"
              },
              "kind": {
                "type": "string",
                "enum": [
                  "HintSeen"
                ]
              },
              "newly_seen": {
                "type": "boolean"
              }
            }
          },
          {
            "type": "object",
            "description": "Returned by `Request::GetNow`.",
            "required": [
              "now",
              "kind"
            ],
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "Now"
                ]
              },
              "now": {
                "$ref": "#/components/schemas/NowData"
              }
            }
          },
          {
            "type": "object",
            "description": "Returned by `Request::ListOneTimeCodes`.",
            "required": [
              "codes",
              "kind"
            ],
            "properties": {
              "codes": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/OneTimeCodeData"
                }
              },
              "kind": {
                "type": "string",
                "enum": [
                  "OneTimeCodes"
                ]
              }
            }
          },
          {
            "type": "object",
            "description": "Returned by `Request::GetUpdatesDigest`.",
            "required": [
              "digest",
              "kind"
            ],
            "properties": {
              "digest": {
                "$ref": "#/components/schemas/UpdatesDigestData"
              },
              "kind": {
                "type": "string",
                "enum": [
                  "UpdatesDigest"
                ]
              }
            }
          },
          {
            "type": "object",
            "description": "Returned by `Request::LetGoDigest`.",
            "required": [
              "result",
              "kind"
            ],
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "UpdatesLetGo"
                ]
              },
              "result": {
                "$ref": "#/components/schemas/UpdatesLetGoData"
              }
            }
          },
          {
            "type": "object",
            "description": "Returned by `Request::SetUpdateSource`.",
            "required": [
              "change",
              "kind"
            ],
            "properties": {
              "change": {
                "$ref": "#/components/schemas/UpdateSourceChangeData"
              },
              "kind": {
                "type": "string",
                "enum": [
                  "UpdateSource"
                ]
              }
            }
          },
          {
            "type": "object",
            "description": "Returned by `Request::GetArrivals`.",
            "required": [
              "arrivals",
              "kind"
            ],
            "properties": {
              "arrivals": {
                "$ref": "#/components/schemas/ArrivalsData"
              },
              "kind": {
                "type": "string",
                "enum": [
                  "Arrivals"
                ]
              }
            }
          },
          {
            "type": "object",
            "description": "Returned by `Request::ListArrivals`.",
            "required": [
              "list",
              "kind"
            ],
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "ArrivalList"
                ]
              },
              "list": {
                "$ref": "#/components/schemas/ArrivalListData"
              }
            }
          },
          {
            "type": "object",
            "description": "Returned by `Request::GetArrivalModes`, one per email the ledger\nhas, in request order.",
            "required": [
              "items",
              "kind"
            ],
            "properties": {
              "items": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/ArrivalItemData"
                }
              },
              "kind": {
                "type": "string",
                "enum": [
                  "ArrivalModes"
                ]
              }
            }
          },
          {
            "type": "object",
            "description": "Returned by `Request::MoveMessage`.",
            "required": [
              "outcome",
              "kind"
            ],
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "MessageMoved"
                ]
              },
              "outcome": {
                "$ref": "#/components/schemas/MoveOutcomeData"
              }
            }
          },
          {
            "type": "object",
            "description": "Returned by `Request::UndoMove`.",
            "required": [
              "correction_id",
              "copy",
              "kind"
            ],
            "properties": {
              "copy": {
                "type": "string",
                "description": "\"Moved back to Reading.\" or \"Already undone.\""
              },
              "correction_id": {
                "type": "integer",
                "format": "int64"
              },
              "kind": {
                "type": "string",
                "enum": [
                  "MoveUndone"
                ]
              }
            }
          },
          {
            "type": "object",
            "description": "Returned by `Request::ListCorrections`.",
            "required": [
              "corrections",
              "kind"
            ],
            "properties": {
              "corrections": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/CorrectionData"
                }
              },
              "kind": {
                "type": "string",
                "enum": [
                  "Corrections"
                ]
              }
            }
          },
          {
            "type": "object",
            "description": "Returned by `Request::GetRail`.",
            "required": [
              "rail",
              "kind"
            ],
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "Rail"
                ]
              },
              "rail": {
                "$ref": "#/components/schemas/RailData"
              }
            }
          },
          {
            "type": "object",
            "description": "Returned by `Request::GetModeMembership`, one entry per thread\nfound, in request order.",
            "required": [
              "threads",
              "kind"
            ],
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "ModeMembership"
                ]
              },
              "threads": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/ThreadModesData"
                }
              }
            }
          },
          {
            "type": "object",
            "description": "Returned by `Request::GetThreadPreviews`, one entry per thread found.",
            "required": [
              "previews",
              "kind"
            ],
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "ThreadPreviews"
                ]
              },
              "previews": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/ThreadPreviewData"
                }
              }
            }
          },
          {
            "type": "object",
            "description": "Returned by `Request::SetModeDone`, one outcome per thread in\nrequest order. `mutation_id` undoes the whole run.\nReturned by `Request::ListRecords`.",
            "required": [
              "ledger",
              "kind"
            ],
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "RecordLedger"
                ]
              },
              "ledger": {
                "$ref": "#/components/schemas/RecordLedgerData"
              }
            }
          },
          {
            "type": "object",
            "description": "Returned by `Request::ListRecordSubscriptions`.",
            "required": [
              "subscriptions",
              "kind"
            ],
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "RecordSubscriptions"
                ]
              },
              "subscriptions": {
                "$ref": "#/components/schemas/RecordSubscriptionsData"
              }
            }
          },
          {
            "type": "object",
            "description": "Returned by `Request::GetRecord`.",
            "required": [
              "record",
              "kind"
            ],
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "Record"
                ]
              },
              "record": {
                "$ref": "#/components/schemas/RecordData"
              }
            }
          },
          {
            "type": "object",
            "description": "Returned by `Request::AnswerFromRecords`.",
            "required": [
              "answer",
              "kind"
            ],
            "properties": {
              "answer": {
                "$ref": "#/components/schemas/RecordAnswerData"
              },
              "kind": {
                "type": "string",
                "enum": [
                  "RecordAnswer"
                ]
              }
            }
          },
          {
            "type": "object",
            "description": "Returned by the record mutations.",
            "required": [
              "change",
              "kind"
            ],
            "properties": {
              "change": {
                "$ref": "#/components/schemas/RecordChangeData"
              },
              "kind": {
                "type": "string",
                "enum": [
                  "RecordChange"
                ]
              }
            }
          },
          {
            "type": "object",
            "description": "Returned by `Request::ExportRecords`.",
            "required": [
              "export",
              "kind"
            ],
            "properties": {
              "export": {
                "$ref": "#/components/schemas/RecordExportData"
              },
              "kind": {
                "type": "string",
                "enum": [
                  "RecordExport"
                ]
              }
            }
          },
          {
            "type": "object",
            "required": [
              "items",
              "dry_run",
              "kind"
            ],
            "properties": {
              "dry_run": {
                "type": "boolean"
              },
              "items": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/ModeDoneOutcomeData"
                }
              },
              "kind": {
                "type": "string",
                "enum": [
                  "ModeDone"
                ]
              },
              "mutation_id": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "undo_unavailable": {
                "type": "boolean",
                "description": "Something changed but its undo could not be saved."
              }
            }
          },
          {
            "type": "object",
            "description": "Returned by `Request::ListMessages`.",
            "required": [
              "messages",
              "kind"
            ],
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "Messages"
                ]
              },
              "messages": {
                "$ref": "#/components/schemas/MessagesData"
              }
            }
          },
          {
            "type": "object",
            "description": "Returned by `Request::GetPerson`.",
            "required": [
              "page",
              "kind"
            ],
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "PersonPage"
                ]
              },
              "page": {
                "$ref": "#/components/schemas/PersonPageData"
              }
            }
          },
          {
            "type": "object",
            "description": "Returned by `Request::AckMessage`.",
            "required": [
              "ack",
              "kind"
            ],
            "properties": {
              "ack": {
                "$ref": "#/components/schemas/AckPlanData"
              },
              "kind": {
                "type": "string",
                "enum": [
                  "MessagesAck"
                ]
              }
            }
          },
          {
            "type": "object",
            "description": "Returned by `Request::MergePeople` and `Request::SplitPerson`.",
            "required": [
              "merge",
              "kind"
            ],
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "PersonMerge"
                ]
              },
              "merge": {
                "$ref": "#/components/schemas/PersonMergeData"
              }
            }
          },
          {
            "type": "object",
            "description": "Returned by `Request::ListMergeSuggestions`.",
            "required": [
              "suggestions",
              "kind"
            ],
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "MergeSuggestions"
                ]
              },
              "suggestions": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/MergeSuggestionData"
                }
              }
            }
          },
          {
            "type": "object",
            "description": "Returned by `Request::GetReadingEdition`.",
            "required": [
              "edition",
              "kind"
            ],
            "properties": {
              "edition": {
                "$ref": "#/components/schemas/ReadingEditionData"
              },
              "kind": {
                "type": "string",
                "enum": [
                  "ReadingEdition"
                ]
              }
            }
          },
          {
            "type": "object",
            "description": "Returned by `Request::GetReadingItem`.",
            "required": [
              "item",
              "kind"
            ],
            "properties": {
              "item": {
                "$ref": "#/components/schemas/ReadingItemDetailData"
              },
              "kind": {
                "type": "string",
                "enum": [
                  "ReadingItem"
                ]
              }
            }
          },
          {
            "type": "object",
            "description": "Returned by `Request::SetReadingLater`.",
            "required": [
              "items",
              "dry_run",
              "later_count",
              "copy",
              "kind"
            ],
            "properties": {
              "copy": {
                "type": "string",
                "description": "\"Saved to Later. 4 things saved.\""
              },
              "dry_run": {
                "type": "boolean"
              },
              "items": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/ReadingLaterOutcomeData"
                }
              },
              "kind": {
                "type": "string",
                "enum": [
                  "ReadingLater"
                ]
              },
              "later_count": {
                "type": "integer",
                "format": "int32",
                "description": "Items on Later after this (unchanged on a dry run).",
                "minimum": 0
              }
            }
          },
          {
            "type": "object",
            "description": "Returned by `Request::RecordReadingEngagement`.",
            "required": [
              "item_key",
              "recorded",
              "finished",
              "kind"
            ],
            "properties": {
              "finished": {
                "type": "boolean"
              },
              "item_key": {
                "type": "string"
              },
              "kind": {
                "type": "string",
                "enum": [
                  "ReadingEngagement"
                ]
              },
              "recorded": {
                "type": "boolean",
                "description": "False when `MXR_ACTIVITY=off` or activity is paused."
              }
            }
          },
          {
            "type": "object",
            "description": "Returned by `Request::FetchArticle`.",
            "required": [
              "fetch",
              "kind"
            ],
            "properties": {
              "fetch": {
                "$ref": "#/components/schemas/ReadingFetchData"
              },
              "kind": {
                "type": "string",
                "enum": [
                  "ReadingArticle"
                ]
              }
            }
          },
          {
            "type": "object",
            "description": "Returned by `Request::SaveHighlight`.",
            "required": [
              "highlight",
              "kind"
            ],
            "properties": {
              "highlight": {
                "$ref": "#/components/schemas/ReadingHighlightData"
              },
              "kind": {
                "type": "string",
                "enum": [
                  "ReadingHighlight"
                ]
              }
            }
          },
          {
            "type": "object",
            "description": "Returned by `Request::UpdateHighlight` and `Request::RemoveHighlight`.",
            "required": [
              "change",
              "kind"
            ],
            "properties": {
              "change": {
                "$ref": "#/components/schemas/ReadingHighlightChangeData"
              },
              "kind": {
                "type": "string",
                "enum": [
                  "ReadingHighlightChanged"
                ]
              }
            }
          },
          {
            "type": "object",
            "description": "Returned by `Request::GetMarginaliaStatus` and\n`Request::SetMarginaliaConnection`.",
            "required": [
              "status",
              "kind"
            ],
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "MarginaliaStatus"
                ]
              },
              "status": {
                "$ref": "#/components/schemas/MarginaliaStatusData"
              }
            }
          },
          {
            "type": "object",
            "description": "Returned by `Request::SendReadingToMarginalia`.",
            "required": [
              "send",
              "kind"
            ],
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "MarginaliaSend"
                ]
              },
              "send": {
                "$ref": "#/components/schemas/MarginaliaSendData"
              }
            }
          },
          {
            "type": "object",
            "description": "Returned by `Request::SyncMarginaliaHighlights`.",
            "required": [
              "sync",
              "kind"
            ],
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "MarginaliaSync"
                ]
              },
              "sync": {
                "$ref": "#/components/schemas/MarginaliaSyncData"
              }
            }
          },
          {
            "type": "object",
            "description": "Returned by `Request::GetAssistantAvailability`.",
            "required": [
              "availability",
              "kind"
            ],
            "properties": {
              "availability": {
                "$ref": "#/components/schemas/AssistantAvailabilityData"
              },
              "kind": {
                "type": "string",
                "enum": [
                  "AssistantAvailability"
                ]
              }
            }
          },
          {
            "type": "object",
            "description": "Returned by `Request::GetAssistantModels`.",
            "required": [
              "models",
              "kind"
            ],
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "AssistantModels"
                ]
              },
              "models": {
                "$ref": "#/components/schemas/AssistantModelsData"
              }
            }
          },
          {
            "type": "object",
            "description": "Returned by `Request::GetComposeModels`.",
            "required": [
              "models",
              "kind"
            ],
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "ComposeModels"
                ]
              },
              "models": {
                "$ref": "#/components/schemas/AssistantModelsData"
              }
            }
          },
          {
            "type": "object",
            "description": "Returned by `Request::SetAssistantModel`.",
            "required": [
              "change",
              "kind"
            ],
            "properties": {
              "change": {
                "$ref": "#/components/schemas/AssistantModelChangeData"
              },
              "kind": {
                "type": "string",
                "enum": [
                  "AssistantModelChange"
                ]
              }
            }
          },
          {
            "type": "object",
            "description": "Returned by the assistant's send, decide, cancel and get requests.",
            "required": [
              "conversation",
              "kind"
            ],
            "properties": {
              "conversation": {
                "$ref": "#/components/schemas/AssistantConversationData"
              },
              "kind": {
                "type": "string",
                "enum": [
                  "AssistantConversation"
                ]
              }
            }
          },
          {
            "type": "object",
            "description": "Returned by `Request::ListAssistantConversations`.",
            "required": [
              "conversations",
              "kind"
            ],
            "properties": {
              "conversations": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/AssistantConversationSummaryData"
                }
              },
              "kind": {
                "type": "string",
                "enum": [
                  "AssistantConversations"
                ]
              }
            }
          },
          {
            "type": "object",
            "description": "Returned by `Request::GetAssistantStepRows`. `listed` counts the rows\nreturned; `total` is the readout's total, which can be larger when\nthe tool returned only one page.",
            "required": [
              "rows",
              "listed",
              "kind"
            ],
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "AssistantStepRows"
                ]
              },
              "listed": {
                "type": "integer",
                "format": "int64",
                "minimum": 0
              },
              "rows": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/AssistantReadoutRowData"
                }
              },
              "total": {
                "type": [
                  "integer",
                  "null"
                ],
                "format": "int64",
                "minimum": 0
              }
            }
          },
          {
            "type": "object",
            "description": "Returned by `Request::DeleteAssistantConversation`.",
            "required": [
              "delete",
              "kind"
            ],
            "properties": {
              "delete": {
                "$ref": "#/components/schemas/AssistantDeleteData"
              },
              "kind": {
                "type": "string",
                "enum": [
                  "AssistantDelete"
                ]
              }
            }
          },
          {
            "type": "object",
            "description": "Returned by `Request::ExportReadingHighlights`.",
            "required": [
              "highlights",
              "markdown",
              "kind"
            ],
            "properties": {
              "highlights": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/ReadingHighlightData"
                }
              },
              "kind": {
                "type": "string",
                "enum": [
                  "ReadingHighlights"
                ]
              },
              "markdown": {
                "type": "string"
              }
            }
          },
          {
            "type": "object",
            "description": "Returned by `Request::SetReadingSource`.",
            "required": [
              "source",
              "kind"
            ],
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "ReadingSource"
                ]
              },
              "source": {
                "$ref": "#/components/schemas/ReadingSourceData"
              }
            }
          },
          {
            "type": "object",
            "description": "Returned by `Request::ListPlace`.",
            "required": [
              "place",
              "bundles",
              "total_bundles",
              "total_messages",
              "generated_at",
              "kind"
            ],
            "properties": {
              "account_id": {
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/AccountId"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "bundles": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/PlaceBundleData"
                }
              },
              "generated_at": {
                "type": "string",
                "format": "date-time"
              },
              "kind": {
                "type": "string",
                "enum": [
                  "Place"
                ]
              },
              "place": {
                "$ref": "#/components/schemas/MailPlaceData"
              },
              "total_bundles": {
                "type": "integer",
                "format": "int32",
                "description": "Bundles in the whole place, not just this page.",
                "minimum": 0
              },
              "total_messages": {
                "type": "integer",
                "format": "int32",
                "description": "Messages in the whole place.",
                "minimum": 0
              }
            }
          },
          {
            "type": "object",
            "description": "Returned by `Request::GetMessageKind`.",
            "required": [
              "account_id",
              "message_id",
              "sender_email",
              "mail_kind",
              "kind"
            ],
            "properties": {
              "account_id": {
                "$ref": "#/components/schemas/AccountId"
              },
              "assessment": {
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/MailAssessment",
                    "description": "The exact stored home decision; absent for outbound context mail."
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "kind": {
                "type": "string",
                "enum": [
                  "MessageKind"
                ]
              },
              "mail_kind": {
                "$ref": "#/components/schemas/MailKindData"
              },
              "message_id": {
                "$ref": "#/components/schemas/MessageId"
              },
              "sender_email": {
                "type": "string"
              }
            }
          },
          {
            "type": "object",
            "description": "Returned by `Request::SetSenderKind`. `previous` is the kind the user\nhad chosen before (`None`: automatic), for undo.",
            "required": [
              "account_id",
              "sender_email",
              "kind"
            ],
            "properties": {
              "account_id": {
                "$ref": "#/components/schemas/AccountId"
              },
              "kind": {
                "type": "string",
                "enum": [
                  "SenderKindSet"
                ]
              },
              "previous": {
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/SenderKindData"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "sender_email": {
                "type": "string"
              },
              "sender_kind": {
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/SenderKindData"
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            }
          },
          {
            "type": "object",
            "description": "Returned by `Request::PinMessages`: how many messages changed.",
            "required": [
              "changed",
              "pinned",
              "kind"
            ],
            "properties": {
              "changed": {
                "type": "integer",
                "format": "int32",
                "minimum": 0
              },
              "kind": {
                "type": "string",
                "enum": [
                  "MessagesPinned"
                ]
              },
              "pinned": {
                "type": "boolean"
              }
            }
          },
          {
            "type": "object",
            "description": "Returned by `Request::SweepPlace`. `job` is the archive job, absent\nfor a dry run or when nothing matched.",
            "required": [
              "preview",
              "dry_run",
              "kind"
            ],
            "properties": {
              "dry_run": {
                "type": "boolean"
              },
              "job": {
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/JobData"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "kind": {
                "type": "string",
                "enum": [
                  "PlaceSwept"
                ]
              },
              "preview": {
                "$ref": "#/components/schemas/SweepPreviewData"
              }
            }
          },
          {
            "type": "object",
            "description": "Returned by `Request::ResolveDeskItems`, one outcome per item in\nrequest order. `mutation_id` undoes the whole run.",
            "required": [
              "items",
              "dry_run",
              "kind"
            ],
            "properties": {
              "dry_run": {
                "type": "boolean"
              },
              "items": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/DeskDoneOutcomeData"
                }
              },
              "kind": {
                "type": "string",
                "enum": [
                  "DeskItemsResolved"
                ]
              },
              "mutation_id": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "undo_unavailable": {
                "type": "boolean",
                "description": "Something changed but its undo could not be saved."
              }
            }
          },
          {
            "type": "object",
            "description": "Returned by `Request::GetThreadGists`.",
            "required": [
              "batch",
              "kind"
            ],
            "properties": {
              "batch": {
                "$ref": "#/components/schemas/ThreadGistBatchData"
              },
              "kind": {
                "type": "string",
                "enum": [
                  "ThreadGists"
                ]
              }
            }
          },
          {
            "type": "object",
            "description": "Returned by `Request::DeferThreads`, one item per conversation in\nrequest order. `mutation_id` undoes the whole run.",
            "required": [
              "items",
              "until",
              "dry_run",
              "kind"
            ],
            "properties": {
              "dry_run": {
                "type": "boolean"
              },
              "items": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/DeferredThreadData"
                }
              },
              "kind": {
                "type": "string",
                "enum": [
                  "ThreadsDeferred"
                ]
              },
              "mutation_id": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "undo_unavailable": {
                "type": "boolean",
                "description": "Something changed but its undo could not be saved."
              },
              "until": {
                "type": "string",
                "format": "date-time"
              }
            }
          }
        ]
      },
      "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
          }
        }
      },
      "RetainedIntentData": {
        "type": "object",
        "required": [
          "original_id",
          "kind",
          "original_state"
        ],
        "properties": {
          "account_id": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/AccountId"
              },
              {
                "type": "null"
              }
            ]
          },
          "archive_evidence": {},
          "kind": {
            "type": "string"
          },
          "original_id": {
            "type": "string"
          },
          "original_state": {
            "type": "string"
          },
          "outcome_reference": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "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"
        ]
      },
      "RowSeenBody": {
        "type": "object",
        "description": "The exact row revision the client opened; never a source-email read flag.",
        "required": [
          "account_id",
          "mode",
          "row_id",
          "revision"
        ],
        "properties": {
          "account_id": {
            "$ref": "#/components/schemas/AccountId"
          },
          "dry_run": {
            "type": "boolean"
          },
          "mode": {
            "$ref": "#/components/schemas/ModeKindData"
          },
          "revision": {
            "type": "string"
          },
          "row_id": {
            "type": "string"
          }
        }
      },
      "RuleCategoriesPreviewData": {
        "type": "object",
        "required": [
          "applied",
          "rule_id",
          "delete",
          "matches",
          "accounts",
          "complete",
          "unavailable",
          "notice"
        ],
        "properties": {
          "accounts": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AccountId"
            }
          },
          "applied": {
            "type": "boolean"
          },
          "complete": {
            "type": "boolean"
          },
          "delete": {
            "type": "boolean"
          },
          "matches": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RuleCategoryMatchData"
            }
          },
          "notice": {
            "type": "string"
          },
          "rule_id": {
            "type": "string"
          },
          "token": {
            "type": [
              "string",
              "null"
            ]
          },
          "unavailable": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          }
        }
      },
      "RuleCategoryMatchData": {
        "type": "object",
        "required": [
          "message_id",
          "account_id",
          "from",
          "subject",
          "category_id",
          "category_name",
          "before",
          "after",
          "reason"
        ],
        "properties": {
          "account_id": {
            "$ref": "#/components/schemas/AccountId"
          },
          "after": {
            "type": "boolean"
          },
          "before": {
            "type": "boolean"
          },
          "category_id": {
            "$ref": "#/components/schemas/CategoryId"
          },
          "category_name": {
            "type": "string"
          },
          "from": {
            "type": "string"
          },
          "manual_decision": {
            "type": [
              "boolean",
              "null"
            ]
          },
          "message_id": {
            "$ref": "#/components/schemas/MessageId"
          },
          "reason": {
            "type": "string"
          },
          "subject": {
            "type": "string"
          },
          "winner": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "RuleFormData": {
        "type": "object",
        "required": [
          "name",
          "condition",
          "action",
          "priority",
          "enabled"
        ],
        "properties": {
          "account_id": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/AccountId"
              },
              {
                "type": "null"
              }
            ]
          },
          "action": {
            "type": "string"
          },
          "condition": {
            "type": "string"
          },
          "enabled": {
            "type": "boolean"
          },
          "id": {
            "type": [
              "string",
              "null"
            ]
          },
          "name": {
            "type": "string"
          },
          "priority": {
            "type": "integer",
            "format": "int32"
          }
        }
      },
      "RuleTreatmentMatchData": {
        "type": "object",
        "required": [
          "message_id",
          "from",
          "subject",
          "before",
          "after",
          "reason",
          "blocked"
        ],
        "properties": {
          "after": {
            "type": "string"
          },
          "before": {
            "type": "string"
          },
          "blocked": {
            "type": "boolean"
          },
          "from": {
            "type": "string"
          },
          "message_id": {
            "$ref": "#/components/schemas/MessageId"
          },
          "reason": {
            "type": "string"
          },
          "subject": {
            "type": "string"
          },
          "treatment": {
            "type": [
              "string",
              "null"
            ]
          },
          "winner": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "RuleTreatmentPreviewData": {
        "type": "object",
        "required": [
          "applied",
          "result"
        ],
        "properties": {
          "applied": {
            "type": "boolean"
          },
          "result": {
            "$ref": "#/components/schemas/RuleTreatmentSelectionData"
          },
          "rule_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "token": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "RuleTreatmentSelectionData": {
        "type": "object",
        "required": [
          "matches",
          "complete",
          "scan_limit",
          "unavailable",
          "notice"
        ],
        "properties": {
          "complete": {
            "type": "boolean"
          },
          "matches": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RuleTreatmentMatchData"
            }
          },
          "notice": {
            "type": "string"
          },
          "scan_limit": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "unavailable": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          }
        }
      },
      "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"
          }
        }
      },
      "SavedDraftResponse": {
        "type": "object",
        "required": [
          "ok",
          "draft_id"
        ],
        "properties": {
          "draft_id": {
            "$ref": "#/components/schemas/DraftId"
          },
          "ok": {
            "type": "boolean"
          },
          "revision": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64"
          }
        }
      },
      "SavedSearch": {
        "type": "object",
        "required": [
          "id",
          "name",
          "query",
          "sort",
          "position",
          "created_at"
        ],
        "properties": {
          "account_id": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/AccountId"
              },
              {
                "type": "null"
              }
            ]
          },
          "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"
      },
      "ScheduleStoredDraftRequest": {
        "type": "object",
        "required": [
          "draft_id",
          "send_at"
        ],
        "properties": {
          "draft_id": {
            "type": "string"
          },
          "expected_revision": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64"
          },
          "managed_attachments_reviewed": {
            "type": "boolean",
            "description": "True only after reviewing the current managed attachment metadata."
          },
          "send_at": {
            "type": "string",
            "format": "date-time"
          },
          "undo_window": {
            "type": "boolean",
            "description": "Holds a send for a client's undo window; kept out of the activity log."
          }
        }
      },
      "ScheduledComposeResponse": {
        "type": "object",
        "required": [
          "ok",
          "draft_id",
          "send_at",
          "cleanup_warnings"
        ],
        "properties": {
          "cleanup_warnings": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "draft_id": {
            "$ref": "#/components/schemas/DraftId"
          },
          "ok": {
            "type": "boolean"
          },
          "send_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "ScheduledSendData": {
        "type": "object",
        "description": "One draft waiting to be sent later.",
        "required": [
          "draft_id",
          "account_id",
          "send_at",
          "subject"
        ],
        "properties": {
          "account_id": {
            "$ref": "#/components/schemas/AccountId"
          },
          "bcc": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Address"
            }
          },
          "cc": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Address"
            }
          },
          "draft_id": {
            "$ref": "#/components/schemas/DraftId"
          },
          "last_attempt_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "When this draft last fired, if it fired before and was then\nrescheduled (for example after a failed or blocked send)."
          },
          "last_attempt_outcome": {
            "type": [
              "string",
              "null"
            ],
            "description": "Outcome of that firing: `sent`, `blocked`, `failed` or\n`interrupted`. The error text itself is not persisted."
          },
          "send_at": {
            "type": "string",
            "format": "date-time"
          },
          "subject": {
            "type": "string"
          },
          "to": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Address"
            }
          }
        }
      },
      "ScreenerChoiceData": {
        "type": "object",
        "required": [
          "kind",
          "label"
        ],
        "properties": {
          "kind": {
            "$ref": "#/components/schemas/SenderKindData",
            "description": "What `SetSenderKind` stores."
          },
          "label": {
            "type": "string",
            "description": "\"Messages\", \"Updates\", \"Reading\", \"Block\"."
          }
        }
      },
      "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"
        ]
      },
      "ScreenerQuestionData": {
        "type": "object",
        "description": "A first-time sender's one question, asked on their row in the mode\ntheir mail landed in (D117). Answering is `SetSenderKind`.",
        "required": [
          "account_id",
          "sender_email",
          "question",
          "choices"
        ],
        "properties": {
          "account_id": {
            "$ref": "#/components/schemas/AccountId"
          },
          "choices": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ScreenerChoiceData"
            },
            "description": "The answers, the current mode's first."
          },
          "question": {
            "type": "string",
            "description": "\"New sender. Keep in Messages?\""
          },
          "sender_email": {
            "type": "string"
          }
        }
      },
      "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
          }
        }
      },
      "SearchDegraded": {
        "type": "object",
        "description": "Set on a search reply that came from the SQLite fallback instead of the\nlexical index. Absent on a reply from the index.",
        "required": [
          "reason",
          "searched_fields"
        ],
        "properties": {
          "notice_override": {
            "type": [
              "string",
              "null"
            ],
            "description": "A notice the daemon wrote for this reply, shown in place of the one\nbuilt from `reason`. Clients older than this field ignore it and show\nthe generic notice for `reason`."
          },
          "reason": {
            "$ref": "#/components/schemas/SearchDegradedReason"
          },
          "searched_fields": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "The parts of a message the limited search looked at."
          }
        }
      },
      "SearchDegradedReason": {
        "type": "string",
        "enum": [
          "index_stopped",
          "index_rebuilding"
        ]
      },
      "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"
          }
        }
      },
      "SelectionAccountData": {
        "type": "object",
        "description": "How many messages of a selection one account holds.",
        "required": [
          "account_id",
          "account_name",
          "count"
        ],
        "properties": {
          "account_id": {
            "$ref": "#/components/schemas/AccountId"
          },
          "account_name": {
            "type": "string"
          },
          "count": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          }
        }
      },
      "SelectionData": {
        "oneOf": [
          {
            "type": "object",
            "required": [
              "query",
              "kind"
            ],
            "properties": {
              "account_id": {
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/AccountId"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "kind": {
                "type": "string",
                "enum": [
                  "search"
                ]
              },
              "query": {
                "type": "string"
              }
            }
          }
        ],
        "description": "What a bulk action covers. The daemon resolves it lexically, newest first,\nwith the same visibility and trash/spam rules as `Request::Search`."
      },
      "SelectionPreviewData": {
        "type": "object",
        "description": "What a selection covers right now, and the token that starts a job over\nexactly that set.",
        "required": [
          "count",
          "threads",
          "accounts",
          "sample",
          "sample_size",
          "capped",
          "preview_token",
          "expires_at"
        ],
        "properties": {
          "accounts": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SelectionAccountData"
            }
          },
          "capped": {
            "type": "boolean",
            "description": "Always false: a selection is never cut to a cap. Present so one parser\nreads both this shape and the capped one."
          },
          "count": {
            "type": "integer",
            "format": "int32",
            "description": "Exact: messages the user can see, still in the store, after the same\nfilters `Request::Search` applies.",
            "minimum": 0
          },
          "expires_at": {
            "type": "integer",
            "format": "int64",
            "description": "Unix milliseconds; the token stops working at this time."
          },
          "preview_token": {
            "type": "string",
            "description": "Single use. `StartSelectionJob` acts on exactly the messages counted\nhere: mail that arrives later is left alone."
          },
          "sample": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SelectionSampleData"
            },
            "description": "The newest messages, newest first."
          },
          "sample_size": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "threads": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          }
        }
      },
      "SelectionSampleData": {
        "type": "object",
        "description": "One of the newest messages in a selection, for the confirmation table.",
        "required": [
          "message_id",
          "account_id",
          "thread_id",
          "from",
          "subject",
          "date"
        ],
        "properties": {
          "account_id": {
            "$ref": "#/components/schemas/AccountId"
          },
          "date": {
            "type": "string",
            "format": "date-time"
          },
          "from": {
            "type": "string"
          },
          "message_id": {
            "$ref": "#/components/schemas/MessageId"
          },
          "subject": {
            "type": "string"
          },
          "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"
          }
        }
      },
      "SendIdentity": {
        "type": "object",
        "description": "Identity retained by a client before submitting a reviewed send.",
        "required": [
          "operation_id",
          "expected_revision"
        ],
        "properties": {
          "expected_revision": {
            "type": "integer",
            "format": "int64"
          },
          "operation_id": {
            "type": "string"
          }
        }
      },
      "SendOutcomeState": {
        "type": "string",
        "enum": [
          "unknown",
          "accepted",
          "not_accepted",
          "waiting"
        ]
      },
      "SendRecoveryStatus": {
        "type": "object",
        "required": [
          "phase",
          "attempts"
        ],
        "properties": {
          "attempts": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "phase": {
            "$ref": "#/components/schemas/SendSubmissionPhase"
          },
          "reason": {
            "type": [
              "string",
              "null"
            ],
            "description": "Stable diagnostic code; never message bodies, addresses or credentials."
          },
          "retry_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          }
        }
      },
      "SendSubmissionPhase": {
        "type": "string",
        "description": "The last boundary for which the adapter has positive evidence.",
        "enum": [
          "preparation",
          "cooldown",
          "authentication",
          "thread_resolution",
          "dispatch",
          "provider_response",
          "accepted"
        ]
      },
      "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"
          }
        }
      },
      "SenderKindBody": {
        "type": "object",
        "description": "Body of `POST /api/v1/mail/senders/kind`.",
        "required": [
          "account_id",
          "sender_email"
        ],
        "properties": {
          "account_id": {
            "type": "string"
          },
          "kind": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/SenderKindData",
                "description": "`null` or omitted: back to automatic."
              },
              {
                "type": "null"
              }
            ]
          },
          "sender_email": {
            "type": "string"
          }
        }
      },
      "SenderKindData": {
        "type": "string",
        "description": "What kind of sender mail comes from, and so where it lives.",
        "enum": [
          "people",
          "reading",
          "paper_trail",
          "screened_out"
        ]
      },
      "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": [
              {
                "$ref": "#/components/schemas/RelationshipProfileData"
              },
              {
                "type": "null"
              }
            ]
          },
          "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": [
              {
                "$ref": "#/components/schemas/SenderUnansweredQuestionData"
              },
              {
                "type": "null"
              }
            ]
          },
          "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"
          }
        }
      },
      "SetAccountIdentityBody": {
        "type": "object",
        "description": "Body of `POST /api/v1/platform/accounts/{key}/identity`. Omitted fields keep their stored value.",
        "properties": {
          "color": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/AccountColor",
                "description": "One of the eight colour slots; the daemon refuses any other value."
              },
              {
                "type": "null"
              }
            ]
          },
          "dry_run": {
            "type": "boolean",
            "description": "Ask the daemon what would change without saving it."
          },
          "tag": {
            "type": [
              "string",
              "null"
            ],
            "description": "One to three uppercase letters or digits; the daemon refuses a tag another account holds."
          }
        }
      },
      "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": [
              {
                "$ref": "#/components/schemas/AccountId"
              },
              {
                "type": "null"
              }
            ]
          },
          "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"
        ]
      },
      "SplitBody": {
        "type": "object",
        "description": "Body of `POST /api/v1/mail/people/split`.",
        "required": [
          "account_id",
          "address"
        ],
        "properties": {
          "account_id": {
            "type": "string"
          },
          "address": {
            "type": "string"
          },
          "dry_run": {
            "type": "boolean"
          }
        }
      },
      "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"
        ]
      },
      "StoreCompactionReport": {
        "type": "object",
        "description": "What compacting the database reclaims, and what it needs to run.",
        "required": [
          "database_bytes",
          "reclaimable_bytes",
          "required_disk_bytes",
          "available_disk_bytes",
          "incremental_vacuum",
          "compacted"
        ],
        "properties": {
          "available_disk_bytes": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "compacted": {
            "type": "boolean"
          },
          "database_bytes": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "database_bytes_after": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64",
            "minimum": 0
          },
          "elapsed_ms": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64",
            "minimum": 0
          },
          "incremental_vacuum": {
            "type": "boolean",
            "description": "Freed pages already return to the disk hourly."
          },
          "reclaimable_bytes": {
            "type": "integer",
            "format": "int64",
            "description": "Space held by free pages, which compaction hands back to the disk.",
            "minimum": 0
          },
          "required_disk_bytes": {
            "type": "integer",
            "format": "int64",
            "description": "Free disk space a rewrite needs: a temporary copy plus its WAL.",
            "minimum": 0
          }
        }
      },
      "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": "Stable JSON field. The subscriptions query currently returns zero;\nreply-pair counts power sender/contact analytics, not this ranker.",
            "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"
          }
        }
      },
      "SweepPlaceBody": {
        "type": "object",
        "description": "Body of `POST /api/v1/mail/places/{place}/sweep`.",
        "properties": {
          "account_id": {
            "type": [
              "string",
              "null"
            ],
            "description": "Omitted: every account."
          },
          "dry_run": {
            "type": [
              "boolean",
              "null"
            ],
            "description": "Preview only; nothing is archived."
          },
          "preview_token": {
            "type": [
              "string",
              "null"
            ],
            "description": "From the dry run's preview; required unless `dry_run`. The sweep\narchives only what that preview listed."
          },
          "sender_email": {
            "type": [
              "string",
              "null"
            ],
            "description": "Only this sender's bundle."
          }
        }
      },
      "SweepPreviewData": {
        "type": "object",
        "description": "What a sweep archives. The dry run and the real sweep build this from\nthe same selection; the real sweep only ever narrows the preview's.",
        "required": [
          "place",
          "count",
          "pinned_excluded",
          "senders",
          "sample_subjects"
        ],
        "properties": {
          "count": {
            "type": "integer",
            "format": "int32",
            "description": "Messages that will be (or were) archived.",
            "minimum": 0
          },
          "pinned_excluded": {
            "type": "integer",
            "format": "int32",
            "description": "Pinned messages left where they are.",
            "minimum": 0
          },
          "place": {
            "$ref": "#/components/schemas/MailPlaceData"
          },
          "preview_token": {
            "type": [
              "string",
              "null"
            ],
            "description": "Hands the previewed selection to the real sweep, which archives\nonly those messages. Expires after a few minutes and works once.\nAbsent when nothing would be archived."
          },
          "sample_subjects": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Up to five subjects, newest first."
          },
          "sender_email": {
            "type": [
              "string",
              "null"
            ]
          },
          "senders": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SweepSenderData"
            },
            "description": "Largest first."
          }
        }
      },
      "SweepSenderData": {
        "type": "object",
        "description": "One sender a sweep would archive mail from.",
        "required": [
          "account_id",
          "sender_email",
          "count"
        ],
        "properties": {
          "account_id": {
            "$ref": "#/components/schemas/AccountId"
          },
          "count": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "sender_email": {
            "type": "string"
          },
          "sender_name": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "SyncAccountResult": {
        "type": "object",
        "required": [
          "account_id",
          "account_name",
          "result"
        ],
        "properties": {
          "account_id": {
            "$ref": "#/components/schemas/AccountId"
          },
          "account_name": {
            "type": "string"
          },
          "error": {
            "type": [
              "string",
              "null"
            ]
          },
          "result": {
            "$ref": "#/components/schemas/SyncAccountResultKind"
          }
        }
      },
      "SyncAccountResultKind": {
        "type": "string",
        "description": "Whether a global sync started new work, joined work already in progress,\nor could not start for this account.",
        "enum": [
          "started",
          "joined",
          "failed"
        ]
      },
      "SyncDurationTrend": {
        "type": "string",
        "description": "Direction of an account's recent sync durations, compared as the median of\nthe newest finished syncs against the median of the ones before them.",
        "enum": [
          "slower",
          "faster",
          "steady"
        ]
      },
      "SyncErrorData": {
        "type": "object",
        "description": "The last sync failure of one account.",
        "required": [
          "kind",
          "message"
        ],
        "properties": {
          "consecutive_failures": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "kind": {
            "$ref": "#/components/schemas/SyncErrorKindData"
          },
          "message": {
            "type": "string",
            "description": "The provider's own words, for the details view."
          },
          "retry_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "When the daemon will try again, when it has scheduled a retry."
          }
        }
      },
      "SyncErrorKindData": {
        "type": "string",
        "description": "What kind of failure stopped the last sync.",
        "enum": [
          "rate_limited",
          "auth",
          "offline",
          "provider",
          "store",
          "unknown"
        ]
      },
      "SyncHealthData": {
        "type": "string",
        "description": "How an account's sync is doing, least worrying first: the \"All\naccounts\" scope shows the last one in this order.",
        "enum": [
          "ok",
          "syncing",
          "never",
          "stale",
          "paused",
          "failing"
        ]
      },
      "SyncProgressData": {
        "type": "object",
        "description": "How far the sync pass running for an account has got.\n\n`current` counts messages committed so far in this backfill run, carrying\nacross provider pages. `total` is the denominator when the provider can\nsay how much is left — the fake provider knows its dataset exactly, Gmail\nand IMAP cannot count what remains without paying for it, so it stays\nabsent for them.",
        "required": [
          "current",
          "message"
        ],
        "properties": {
          "current": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "message": {
            "type": "string"
          },
          "total": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int32",
            "minimum": 0
          }
        }
      },
      "SyncTarget": {
        "type": "object",
        "description": "One enabled, sync-capable account selected by the global sync preview.",
        "required": [
          "account_id",
          "account_name",
          "provider_available"
        ],
        "properties": {
          "account_id": {
            "$ref": "#/components/schemas/AccountId"
          },
          "account_name": {
            "type": "string"
          },
          "provider_available": {
            "type": "boolean",
            "description": "False means the account is configured for sync but the running daemon\nhas no registered sync provider for it."
          }
        }
      },
      "SystemMailboxCount": {
        "type": "object",
        "description": "One system mailbox's counts across a set of accounts. `role` is the wire\nname `label_role` uses (`inbox`, `starred`, ..., `all_mail`).",
        "required": [
          "role",
          "unread",
          "total"
        ],
        "properties": {
          "role": {
            "type": "string"
          },
          "total": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "unread": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          }
        }
      },
      "TextChangeData": {
        "type": "object",
        "description": "One run of a word-level diff from the user's text to the proposal.",
        "required": [
          "kind",
          "text"
        ],
        "properties": {
          "kind": {
            "$ref": "#/components/schemas/TextChangeKindData"
          },
          "text": {
            "type": "string"
          }
        }
      },
      "TextChangeKindData": {
        "type": "string",
        "enum": [
          "kept",
          "added",
          "removed"
        ]
      },
      "TextPlainFormat": {
        "oneOf": [
          {
            "type": "string",
            "enum": [
              "Fixed"
            ]
          },
          {
            "type": "object",
            "required": [
              "Flowed"
            ],
            "properties": {
              "Flowed": {
                "type": "object",
                "required": [
                  "delsp"
                ],
                "properties": {
                  "delsp": {
                    "type": "boolean"
                  }
                }
              }
            }
          }
        ]
      },
      "TextRangeData": {
        "type": "object",
        "description": "A byte range into the request's `text`; both ends fall on char boundaries.",
        "required": [
          "start",
          "end"
        ],
        "properties": {
          "end": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "start": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          }
        }
      },
      "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
          }
        }
      },
      "ThreadAskData": {
        "type": "object",
        "required": [
          "summary"
        ],
        "properties": {
          "quote": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/VerifiedQuoteData",
                "description": "The sentence that makes the ask, verified by the daemon to appear in\nthat message's text (whitespace-insensitive), so clients can\nhighlight it. Dropped when it can't be found."
              },
              {
                "type": "null"
              }
            ]
          },
          "summary": {
            "type": "string",
            "description": "The ask in a short plain-text clause, at most 160 characters."
          }
        }
      },
      "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)."
          }
        }
      },
      "ThreadContextData": {
        "type": "object",
        "description": "Returned by `Request::GetThreadContext`. Computed from the local store\nwith no model involved.",
        "required": [
          "thread_id",
          "account_id"
        ],
        "properties": {
          "account_id": {
            "$ref": "#/components/schemas/AccountId"
          },
          "counterparty": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/ThreadCounterpartyData",
                "description": "The person this conversation is mainly with: the latest sender who\nisn't you, or the first recipient of your latest message."
              },
              {
                "type": "null"
              }
            ]
          },
          "owed_reply": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/OwedReplyHereData",
                "description": "Set when the newest message is from someone else, it isn't bulk\nmail, and you haven't written in the thread since."
              },
              {
                "type": "null"
              }
            ]
          },
          "promises": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ThreadPromiseData"
            },
            "description": "Open promises recorded against this thread, both directions."
          },
          "thread_id": {
            "$ref": "#/components/schemas/ThreadId"
          }
        }
      },
      "ThreadCounterpartyData": {
        "type": "object",
        "required": [
          "email",
          "messages_from_them",
          "messages_from_you",
          "your_reply_samples",
          "their_reply_samples",
          "bulk_sender"
        ],
        "properties": {
          "bulk_sender": {
            "type": "boolean",
            "description": "Mailing-list or bulk sender; relationship stats mean little here."
          },
          "display_name": {
            "type": [
              "string",
              "null"
            ]
          },
          "email": {
            "type": "string"
          },
          "last_contact_elsewhere_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "Latest message between you in any other thread. `None` means this is\nyour first conversation."
          },
          "messages_from_them": {
            "type": "integer",
            "format": "int32",
            "description": "Messages they sent you, across every thread.",
            "minimum": 0
          },
          "messages_from_you": {
            "type": "integer",
            "format": "int32",
            "description": "Messages you sent them (to, cc or bcc), across every thread.",
            "minimum": 0
          },
          "their_reply_p50_seconds": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int32",
            "description": "Median time they take to answer you.",
            "minimum": 0
          },
          "their_reply_samples": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "your_reply_p50_seconds": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int32",
            "description": "Median time you take to answer them, from past reply pairs.",
            "minimum": 0
          },
          "your_reply_samples": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          }
        }
      },
      "ThreadGistBatchData": {
        "type": "object",
        "description": "Returned by `Request::GetThreadGists`: the gists a list can show now,\nstraight from the cache, and what was queued to be written.",
        "required": [
          "model",
          "gists"
        ],
        "properties": {
          "gists": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ThreadGistData"
            },
            "description": "Cached gists that match each conversation's newest message, in\nrequest order. Only `ready` gists are listed."
          },
          "in_flight": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ThreadId"
            },
            "description": "Conversations a writer is on right now; their gists arrive as events\ntoo."
          },
          "model": {
            "$ref": "#/components/schemas/GistModelData",
            "description": "Whether gists can be written at all. Anything but `available` means\nlists show their rows as they are, with nothing to wait for."
          },
          "queued": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ThreadId"
            },
            "description": "Conversations waiting in the queue after this request. Each one's\ngist arrives as a `ThreadGistReady` event."
          },
          "skipped": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ThreadGistSkipData"
            },
            "description": "Conversations that have no gist and won't get one from this request."
          }
        }
      },
      "ThreadGistData": {
        "type": "object",
        "description": "Returned by `Request::GetThreadGist`.",
        "required": [
          "thread_id",
          "status",
          "from_cache"
        ],
        "properties": {
          "ask": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/ThreadAskData",
                "description": "What the conversation asks of you. `None` with `status: ready` means\nthe model found no ask."
              },
              {
                "type": "null"
              }
            ]
          },
          "from_cache": {
            "type": "boolean"
          },
          "generated_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "gist": {
            "type": [
              "string",
              "null"
            ],
            "description": "One plain-text sentence, at most 240 characters."
          },
          "newest_message_id": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/MessageId",
                "description": "The conversation's newest message when the gist was written. A client\nthat has seen a newer message in the conversation ignores the gist."
              },
              {
                "type": "null"
              }
            ]
          },
          "provenance": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/AiProvenanceData"
              },
              {
                "type": "null"
              }
            ]
          },
          "reason": {
            "type": [
              "string",
              "null"
            ],
            "description": "Why there is no gist, for `disabled`, `blocked` and `failed`."
          },
          "status": {
            "$ref": "#/components/schemas/ThreadGistStatusData"
          },
          "thread_id": {
            "$ref": "#/components/schemas/ThreadId"
          }
        }
      },
      "ThreadGistSkipData": {
        "type": "object",
        "required": [
          "thread_id",
          "reason"
        ],
        "properties": {
          "reason": {
            "$ref": "#/components/schemas/ThreadGistSkipReasonData"
          },
          "thread_id": {
            "$ref": "#/components/schemas/ThreadId"
          }
        }
      },
      "ThreadGistSkipReasonData": {
        "type": "string",
        "enum": [
          "not_people",
          "not_found",
          "recently_failed",
          "not_generated",
          "queue_full"
        ]
      },
      "ThreadGistStatusData": {
        "type": "string",
        "enum": [
          "ready",
          "disabled",
          "blocked",
          "failed"
        ]
      },
      "ThreadGistsBody": {
        "type": "object",
        "description": "Body of `POST /api/v1/mail/gists`.",
        "required": [
          "thread_ids"
        ],
        "properties": {
          "generate": {
            "type": [
              "boolean",
              "null"
            ],
            "description": "Queue missing gists for people's conversations; each arrives as a\n`ThreadGistReady` event."
          },
          "thread_ids": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "At most 100, in the order to write missing gists (visible rows first)."
          }
        }
      },
      "ThreadId": {
        "type": "string",
        "format": "uuid"
      },
      "ThreadModesData": {
        "type": "object",
        "description": "Every mode one thread is in, returned by `Request::GetModeMembership`.",
        "required": [
          "account_id",
          "thread_id",
          "subject",
          "modes",
          "in_inbox"
        ],
        "properties": {
          "account_id": {
            "$ref": "#/components/schemas/AccountId"
          },
          "asks": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AskSummary"
            },
            "description": "The independently versioned asks facet includes sent mail as well as received mail."
          },
          "asks_more": {
            "type": "boolean",
            "description": "Additional stored asks can be inspected through their source messages."
          },
          "asks_pending": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/MessageId"
            },
            "description": "Missing or invalidated asks are pending; readers never invent a replacement."
          },
          "assessments": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/MailAssessment"
            },
            "description": "The stored answers behind this thread's memberships; live marks stay separate."
          },
          "done_in": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ModeKindData"
            },
            "description": "Modes this thread was marked done in and stays out of until a new\nmessage arrives."
          },
          "held_by": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ModeKindData"
            },
            "description": "The modes keeping it in the provider's inbox: Inbox's \"held by To\ndo\" chip. Archive never holds."
          },
          "in_inbox": {
            "type": "boolean",
            "description": "Any message of the thread is in the provider's inbox."
          },
          "modes": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ModeMembershipData"
            },
            "description": "In rail order. Empty when no mode holds it (Inbox still shows it)."
          },
          "new_sender": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/ScreenerQuestionData"
              },
              {
                "type": "null"
              }
            ]
          },
          "subject": {
            "type": "string"
          },
          "thread_id": {
            "$ref": "#/components/schemas/ThreadId"
          }
        }
      },
      "ThreadPreviewData": {
        "type": "object",
        "description": "One thread at a glance. Sender, date, snippet come from its latest\nmessage; counts and the attachment flag cover the whole thread.",
        "required": [
          "thread_id",
          "subject",
          "sender_email",
          "latest_at",
          "message_count",
          "unread_count",
          "snippet"
        ],
        "properties": {
          "account_id": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/AccountId",
                "description": "The account the latest message came to. Absent from older daemons."
              },
              {
                "type": "null"
              }
            ]
          },
          "has_attachments": {
            "type": "boolean",
            "description": "Any message in the thread carries an attachment."
          },
          "latest_at": {
            "type": "integer",
            "format": "int64",
            "description": "When the latest message arrived: unix seconds."
          },
          "message_count": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "sender_email": {
            "type": "string"
          },
          "sender_name": {
            "type": [
              "string",
              "null"
            ],
            "description": "The latest message's sender name, when the message has one."
          },
          "snippet": {
            "type": "string",
            "description": "The start of the latest message's text, clipped."
          },
          "subject": {
            "type": "string"
          },
          "thread_id": {
            "$ref": "#/components/schemas/ThreadId"
          },
          "unread_count": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          }
        }
      },
      "ThreadPreviewsBody": {
        "type": "object",
        "description": "Body of `POST /api/v1/mail/threads/previews`.",
        "required": [
          "thread_ids"
        ],
        "properties": {
          "thread_ids": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "At most 100 threads, answered in this order; unknown ids are left out."
          }
        }
      },
      "ThreadPromiseData": {
        "type": "object",
        "description": "An open promise in the thread and who made it.",
        "required": [
          "owner",
          "commitment"
        ],
        "properties": {
          "commitment": {
            "$ref": "#/components/schemas/CommitmentData"
          },
          "owner": {
            "type": "string",
            "description": "Who owes it, as the thread knows them: \"you\" for your own promises,\nelse the owner's display name from the thread's messages, falling back\nto their address. In a group thread each promise keeps its own owner."
          }
        }
      },
      "ThreadShapeData": {
        "type": "string",
        "description": "A thread's shape, judged in the daemon.",
        "enum": [
          "one_to_one",
          "group",
          "copied"
        ]
      },
      "ThreadSummaryData": {
        "type": "object",
        "required": [
          "text",
          "model",
          "generated_at"
        ],
        "properties": {
          "generated_at": {
            "type": "string",
            "format": "date-time"
          },
          "model": {
            "type": "string"
          },
          "text": {
            "type": "string"
          }
        }
      },
      "ThreadWindow": {
        "type": "object",
        "description": "One bounded page of a conversation, for readers that must not load a\n2,000-message thread in one payload. `limit` counts messages; the page\nends just before `before` (exclusive) or starts just after `after`\n(exclusive). `focus` returns the page ending at that message, so a deep\nlink can open on an old message without loading everything newer.",
        "required": [
          "limit"
        ],
        "properties": {
          "after": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/MessageId"
              },
              {
                "type": "null"
              }
            ]
          },
          "before": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/MessageId"
              },
              {
                "type": "null"
              }
            ]
          },
          "focus": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/MessageId"
              },
              {
                "type": "null"
              }
            ]
          },
          "limit": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          }
        }
      },
      "TimeChoice": {
        "type": "object",
        "description": "One reading of the phrase.",
        "required": [
          "at",
          "local",
          "label",
          "date_label",
          "time_label",
          "relative_label",
          "implied"
        ],
        "properties": {
          "at": {
            "type": "string",
            "format": "date-time",
            "description": "The instant to store. Send this back to the mutation unchanged so\nwhat was previewed is what is saved."
          },
          "date_label": {
            "type": "string",
            "description": "\"Friday 3 October\", with the year only when it isn't this year."
          },
          "implied": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ImpliedPart"
            }
          },
          "label": {
            "type": "string",
            "description": "Short text for a choice chip, such as \"15:00\"."
          },
          "local": {
            "type": "string",
            "description": "The same instant as RFC3339 in the resolving zone."
          },
          "note": {
            "type": [
              "string",
              "null"
            ],
            "description": "Set when a clock change moved or doubled the requested wall time."
          },
          "relative_label": {
            "type": "string",
            "description": "\"in 6 days\", \"tomorrow\", \"in 2 hours\"."
          },
          "time_label": {
            "type": "string",
            "description": "\"15:00\"."
          }
        }
      },
      "TimeResolution": {
        "type": "object",
        "description": "A phrase resolved to at least one instant.",
        "required": [
          "input",
          "at",
          "description",
          "spans",
          "choices"
        ],
        "properties": {
          "at": {
            "type": "string",
            "format": "date-time",
            "description": "The default choice's instant."
          },
          "choices": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TimeChoice"
            },
            "description": "Every reading, default first. More than one means the phrase was\nambiguous."
          },
          "description": {
            "type": "string",
            "description": "\"Friday 3 October, 15:00\" for the default choice."
          },
          "input": {
            "type": "string"
          },
          "spans": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TimeSpan"
            },
            "description": "Byte ranges of `input` that were understood."
          }
        }
      },
      "TimeResolveError": {
        "type": "object",
        "description": "Why a phrase didn't resolve, phrased for the user.",
        "required": [
          "kind",
          "message",
          "understood"
        ],
        "properties": {
          "kind": {
            "$ref": "#/components/schemas/TimeResolveErrorKind"
          },
          "message": {
            "type": "string",
            "description": "A calm, specific message with an example that works."
          },
          "token": {
            "type": [
              "string",
              "null"
            ],
            "description": "The word that wasn't understood, for `unrecognized` and `conflict`."
          },
          "understood": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TimeSpan"
            },
            "description": "Byte ranges understood before the problem."
          }
        }
      },
      "TimeResolveErrorKind": {
        "type": "string",
        "enum": [
          "empty",
          "unrecognized",
          "conflict",
          "needs_time",
          "invalid_date",
          "in_past",
          "out_of_range"
        ]
      },
      "TimeSpan": {
        "type": "object",
        "description": "A byte range of the input the parser understood.",
        "required": [
          "start",
          "end"
        ],
        "properties": {
          "end": {
            "type": "integer",
            "minimum": 0
          },
          "start": {
            "type": "integer",
            "minimum": 0
          }
        }
      },
      "TodoActionData": {
        "type": "object",
        "description": "The one thing Enter does.",
        "required": [
          "label",
          "url",
          "trusted"
        ],
        "properties": {
          "domain": {
            "type": [
              "string",
              "null"
            ],
            "description": "The link's registrable domain, shown beside the label."
          },
          "kind": {
            "$ref": "#/components/schemas/TodoActionKindData",
            "description": "Always `open_email` in this phase."
          },
          "label": {
            "type": "string",
            "description": "\"Open email to pay\", \"Open email to verify\"."
          },
          "message_id": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/MessageId",
                "description": "The email to open."
              },
              {
                "type": "null"
              }
            ]
          },
          "trusted": {
            "type": "boolean",
            "description": "Always false: nothing on a to-do is trusted to open directly. Kept\nso earlier clients read the action as untrusted."
          },
          "url": {
            "type": "string",
            "description": "The link in that email the action is about, to highlight there.\nNot an action: never open it from the row."
          }
        }
      },
      "TodoActionKindData": {
        "type": "string",
        "description": "What the row's primary action does.",
        "enum": [
          "open_email"
        ]
      },
      "TodoAmountData": {
        "type": "object",
        "required": [
          "minor",
          "currency",
          "display"
        ],
        "properties": {
          "currency": {
            "type": "string",
            "description": "ISO 4217."
          },
          "display": {
            "type": "string",
            "description": "\"£142.00\"."
          },
          "minor": {
            "type": "integer",
            "format": "int64",
            "description": "In the currency's minor unit."
          }
        }
      },
      "TodoCatchupBody": {
        "type": "object",
        "description": "Body of `POST /api/v1/mail/todos/catchup`.",
        "required": [
          "decision"
        ],
        "properties": {
          "account_id": {
            "type": [
              "string",
              "null"
            ],
            "description": "Omitted: every account."
          },
          "decision": {
            "$ref": "#/components/schemas/TodoCatchupDecisionData"
          },
          "dry_run": {
            "type": "boolean"
          }
        }
      },
      "TodoCatchupData": {
        "type": "object",
        "description": "Returned by `Request::GetTodoCatchup`.",
        "required": [
          "title",
          "why",
          "window_days",
          "todos",
          "overflow_count",
          "already_over",
          "first_run"
        ],
        "properties": {
          "already_over": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TodoKindCountData"
            },
            "description": "What the first run found already over, by kind."
          },
          "already_over_line": {
            "type": [
              "string",
              "null"
            ],
            "description": "\"Already over, so not shown: 50 past invites, 63 quiet parcels.\""
          },
          "first_run": {
            "$ref": "#/components/schemas/TodoFirstRunData"
          },
          "overflow_count": {
            "type": "integer",
            "format": "int32",
            "description": "Found for the batch after it was full; in the Expired list.",
            "minimum": 0
          },
          "title": {
            "type": "string",
            "description": "\"Catch up: 12 things from the last two weeks might still need you.\""
          },
          "todos": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TodoData"
            }
          },
          "why": {
            "type": "string",
            "description": "`todo_copy::CATCH_UP_WHY`."
          },
          "window_days": {
            "type": "integer",
            "format": "int32",
            "description": "The catch-up window, in days.",
            "minimum": 0
          }
        }
      },
      "TodoCatchupDecisionData": {
        "oneOf": [
          {
            "type": "object",
            "required": [
              "todo_ids",
              "decision"
            ],
            "properties": {
              "decision": {
                "type": "string",
                "enum": [
                  "keep"
                ]
              },
              "todo_ids": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            }
          },
          {
            "type": "object",
            "required": [
              "todo_ids",
              "decision"
            ],
            "properties": {
              "decision": {
                "type": "string",
                "enum": [
                  "let_go"
                ]
              },
              "todo_ids": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            }
          },
          {
            "type": "object",
            "description": "Every row still waiting in the batch.",
            "required": [
              "decision"
            ],
            "properties": {
              "decision": {
                "type": "string",
                "enum": [
                  "let_go_all"
                ]
              }
            }
          },
          {
            "type": "object",
            "description": "Back to undecided in the batch: the undo of keep or let go.",
            "required": [
              "todo_ids",
              "decision"
            ],
            "properties": {
              "decision": {
                "type": "string",
                "enum": [
                  "undecide"
                ]
              },
              "todo_ids": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            }
          }
        ],
        "description": "Keep or let go in the catch-up."
      },
      "TodoChangeData": {
        "type": "object",
        "description": "Returned by every to-do mutation. With `dry_run`, `changed` is what\nwould change and nothing was written.",
        "required": [
          "dry_run",
          "action",
          "changed",
          "summary"
        ],
        "properties": {
          "action": {
            "type": "string",
            "description": "done | undo | dismiss | schedule | edit | create | keep | let_go"
          },
          "changed": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TodoData"
            },
            "description": "The rows as they are (or would be) after the change."
          },
          "correction_undo": {
            "type": [
              "string",
              "null"
            ],
            "description": "Opaque token for one-step correction undo; never inferred by a client."
          },
          "dry_run": {
            "type": "boolean"
          },
          "summary": {
            "type": "string",
            "description": "One line saying what happened: \"Ticked off 2.\", \"Would let go of 12.\""
          },
          "unchanged": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Ids that matched but were not in a state this change applies to."
          }
        }
      },
      "TodoCorrectionBody": {
        "type": "object",
        "required": [
          "reason"
        ],
        "properties": {
          "dry_run": {
            "type": "boolean"
          },
          "edits": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TodoEditData"
            }
          },
          "reason": {
            "$ref": "#/components/schemas/TodoCorrectionData"
          },
          "time_zone": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "TodoCorrectionData": {
        "type": "string",
        "enum": [
          "not_a_todo",
          "not_mine",
          "already_done",
          "wrong_details"
        ]
      },
      "TodoCorrectionUndoBody": {
        "type": "object",
        "required": [
          "correction_id"
        ],
        "properties": {
          "correction_id": {
            "type": "string"
          },
          "dry_run": {
            "type": "boolean"
          }
        }
      },
      "TodoCreateBody": {
        "type": "object",
        "description": "Body of `POST /api/v1/mail/todos`.",
        "required": [
          "message_id",
          "title"
        ],
        "properties": {
          "dry_run": {
            "type": "boolean"
          },
          "due": {
            "type": [
              "string",
              "null"
            ],
            "description": "A phrase (\"fri\", \"9 oct\") or RFC3339."
          },
          "kind": {
            "type": [
              "string",
              "null"
            ],
            "description": "Defaults to `other`."
          },
          "message_id": {
            "type": "string",
            "description": "The message it's about."
          },
          "time_zone": {
            "type": [
              "string",
              "null"
            ]
          },
          "title": {
            "type": "string",
            "description": "What to do, starting with the verb."
          }
        }
      },
      "TodoData": {
        "type": "object",
        "description": "One row: a thing to do, titled verb plus object, never the subject.",
        "required": [
          "id",
          "account_id",
          "kind",
          "verb",
          "title",
          "state",
          "origin",
          "why",
          "when_label",
          "overdue",
          "fields",
          "user_touched",
          "created_at",
          "updated_at"
        ],
        "properties": {
          "account_id": {
            "$ref": "#/components/schemas/AccountId"
          },
          "act_by_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "When you must act: due minus processing time."
          },
          "action": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/TodoActionData"
              },
              {
                "type": "null"
              }
            ]
          },
          "amount": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/TodoAmountData"
              },
              {
                "type": "null"
              }
            ]
          },
          "catchup": {
            "type": [
              "string",
              "null"
            ],
            "description": "pending | kept | let_go | overflow"
          },
          "counterparty": {
            "type": [
              "string",
              "null"
            ]
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "dismissed_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "done_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "due_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "The outside deadline."
          },
          "due_words": {
            "type": [
              "string",
              "null"
            ],
            "description": "The phrase the due date was read from, verbatim."
          },
          "expired_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "fields": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TodoFieldData"
            },
            "description": "Where each field came from."
          },
          "id": {
            "type": "string"
          },
          "kind": {
            "type": "string",
            "description": "bill | payment_failed | renewal | document | lease | return | rsvp |\nverify | sign | promise | other"
          },
          "looks_done": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/TodoLooksDoneData"
              },
              {
                "type": "null"
              }
            ]
          },
          "next": {
            "type": [
              "string",
              "null"
            ],
            "description": "What happens next, where it's true: \"When the receipt arrives, the\nrow says it looks done.\""
          },
          "origin": {
            "type": "string",
            "description": "rule | schema | ics | model | handoff | manual"
          },
          "overdue": {
            "type": "boolean",
            "description": "Past the due date."
          },
          "person_label": {
            "type": [
              "string",
              "null"
            ],
            "description": "\"you promised Priya\" on promise rows."
          },
          "relevant_until": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "When it stops mattering."
          },
          "resolution": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/TodoResolutionData"
              },
              {
                "type": "null"
              }
            ]
          },
          "runway": {
            "type": [
              "number",
              "null"
            ],
            "format": "double",
            "description": "How far the runway bar is filled, from surfacing (0) to due (1)."
          },
          "scheduled_for": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "Your own date; wins over `surface_at`."
          },
          "seen_revision": {
            "type": [
              "string",
              "null"
            ],
            "description": "Opaque version to acknowledge with `SetModeRowSeen`."
          },
          "source_date": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "source_filed_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "When the source email left the inbox through a provider sync and is\nstill out: \"filed in Gmail\". Never set for an archive mxr made, and\ncleared when the mail comes back."
          },
          "source_message_id": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/MessageId"
              },
              {
                "type": "null"
              }
            ]
          },
          "state": {
            "$ref": "#/components/schemas/TodoStateData"
          },
          "surface_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "When the row shows up in Now."
          },
          "surfaced_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "thread_id": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/ThreadId"
              },
              {
                "type": "null"
              }
            ]
          },
          "title": {
            "type": "string",
            "description": "\"Pay council tax\"."
          },
          "unread": {
            "type": [
              "boolean",
              "null"
            ],
            "description": "This row revision has not been opened or peeked. Independent of the\nsource email's READ flag. Omitted by older daemons."
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          },
          "user_touched": {
            "type": "boolean",
            "description": "You made or changed it: it never expires and re-runs leave it be."
          },
          "verb": {
            "type": "string"
          },
          "when_label": {
            "type": "string",
            "description": "\"act by Wed 7 Oct · due Fri 9 Oct\", \"was due Fri 9 Oct\", \"shows up\nMon 12 Oct\", \"no date\"."
          },
          "why": {
            "type": "string",
            "description": "\"Here because: \\\"payment due 9 October\\\" (rule).\""
          }
        }
      },
      "TodoEditBody": {
        "type": "object",
        "description": "Body of `POST /api/v1/mail/todos/{todo_id}/edit`.",
        "required": [
          "edits"
        ],
        "properties": {
          "dry_run": {
            "type": "boolean"
          },
          "edits": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TodoEditData"
            },
            "description": "title, due, amount, counterparty or kind; an empty value clears due,\namount and counterparty."
          },
          "time_zone": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "TodoEditData": {
        "type": "object",
        "description": "One edit: `field` is title, due, amount, counterparty or kind; an\nempty value clears due, amount and counterparty.",
        "required": [
          "field",
          "value"
        ],
        "properties": {
          "field": {
            "type": "string"
          },
          "value": {
            "type": "string"
          }
        }
      },
      "TodoFieldData": {
        "type": "object",
        "description": "Where one field came from.",
        "required": [
          "field",
          "source",
          "checked",
          "source_label"
        ],
        "properties": {
          "checked": {
            "type": "boolean",
            "description": "False for a guess to confirm, such as a numeric date that reads\ndifferently in UK and US order. Shown with an open dot."
          },
          "evidence": {
            "type": [
              "string",
              "null"
            ],
            "description": "The words it was read from, or how it was worked out."
          },
          "field": {
            "type": "string",
            "description": "title, kind, counterparty, amount, due_at, act_by_at, surface_at,\nrelevant_until, action_url, event_start"
          },
          "source": {
            "type": "string",
            "description": "schema | ics | rule | table | model | user"
          },
          "source_label": {
            "type": "string",
            "description": "\"a pattern in the email\", \"the lead-time table\", \"you\"."
          }
        }
      },
      "TodoFirstRunData": {
        "type": "object",
        "description": "How far the newest-first first run has got.",
        "required": [
          "complete",
          "scanned"
        ],
        "properties": {
          "complete": {
            "type": "boolean"
          },
          "reached": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "The oldest message date reached."
          },
          "scanned": {
            "type": "integer",
            "format": "int64",
            "description": "Messages classified so far."
          }
        }
      },
      "TodoKindCountData": {
        "type": "object",
        "description": "A kind and how many, for \"Already over, so not shown: 50 past invites\".",
        "required": [
          "kind",
          "count",
          "label"
        ],
        "properties": {
          "count": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "kind": {
            "type": "string"
          },
          "label": {
            "type": "string",
            "description": "\"past invites\"."
          }
        }
      },
      "TodoLooksDoneData": {
        "type": "object",
        "required": [
          "reason"
        ],
        "properties": {
          "message_id": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/MessageId"
              },
              {
                "type": "null"
              }
            ]
          },
          "reason": {
            "type": "string",
            "description": "\"payment received 3 Oct\"."
          }
        }
      },
      "TodoNextData": {
        "type": "object",
        "description": "The next row to show up, for the empty state.",
        "required": [
          "todo_id",
          "title",
          "at",
          "label"
        ],
        "properties": {
          "at": {
            "type": "string",
            "format": "date-time"
          },
          "label": {
            "type": "string",
            "description": "\"Mon 19 Oct\"."
          },
          "title": {
            "type": "string"
          },
          "todo_id": {
            "type": "string"
          }
        }
      },
      "TodoResolutionActionData": {
        "type": "string",
        "enum": [
          "preview",
          "accept",
          "dismiss",
          "undo"
        ]
      },
      "TodoResolutionBody": {
        "type": "object",
        "description": "Body of `POST /api/v1/mail/todos/{todo_id}/resolution`.",
        "required": [
          "suggestion_id",
          "action"
        ],
        "properties": {
          "action": {
            "$ref": "#/components/schemas/TodoResolutionActionData"
          },
          "dry_run": {
            "type": "boolean"
          },
          "suggestion_id": {
            "type": "string"
          }
        }
      },
      "TodoResolutionData": {
        "type": "object",
        "description": "A later message that offers a specific, user-reviewed resolution.",
        "required": [
          "id",
          "message_id",
          "thread_id",
          "source_date",
          "quote",
          "quote_location",
          "source_method",
          "action",
          "status"
        ],
        "properties": {
          "action": {
            "type": "string",
            "description": "complete | revise_date"
          },
          "id": {
            "type": "string"
          },
          "message_id": {
            "$ref": "#/components/schemas/MessageId"
          },
          "proposed_due_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "proposed_due_words": {
            "type": [
              "string",
              "null"
            ]
          },
          "quote": {
            "type": "string",
            "description": "Exact bounded substring of the source subject or cleaned body."
          },
          "quote_location": {
            "type": "string"
          },
          "source_date": {
            "type": "string",
            "format": "date-time"
          },
          "source_method": {
            "type": "string",
            "description": "rule | model"
          },
          "status": {
            "type": "string",
            "description": "pending | accepted | dismissed | undone | superseded"
          },
          "thread_id": {
            "$ref": "#/components/schemas/ThreadId"
          }
        }
      },
      "TodoRunwayData": {
        "type": "object",
        "description": "Returned by `Request::GetTodoRunway`: the bands, ready to draw.",
        "required": [
          "generated_at",
          "header",
          "headline",
          "now",
          "coming_up",
          "later",
          "whenever",
          "done_this_week",
          "catchup_count",
          "expired_since_last_looked",
          "first_run"
        ],
        "properties": {
          "catchup_count": {
            "type": "integer",
            "format": "int32",
            "description": "Rows waiting in the one-time catch-up.",
            "minimum": 0
          },
          "coming_up": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TodoWeekData"
            },
            "description": "Showing up in the next 30 days, by week."
          },
          "done_this_week": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TodoData"
            }
          },
          "empty_state": {
            "type": [
              "string",
              "null"
            ],
            "description": "Set when Now is empty: what lands here, or when the next thing does."
          },
          "expired_since_last_looked": {
            "type": "integer",
            "format": "int32",
            "description": "\"3 expired since you last looked\", when above zero.",
            "minimum": 0
          },
          "first_run": {
            "$ref": "#/components/schemas/TodoFirstRunData"
          },
          "generated_at": {
            "type": "string",
            "format": "date-time"
          },
          "header": {
            "type": "string",
            "description": "`todo_copy::HEADER`."
          },
          "headline": {
            "type": "string",
            "description": "\"3 things need you this week. Council tax first, act by Wed.\" Empty\nwhen Now is."
          },
          "later": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TodoData"
            },
            "description": "Dated, showing up after 30 days."
          },
          "might_need_you": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TodoUncertainData"
            },
            "description": "Eligible ask uncertainty only; collapsed by clients and never a Now task."
          },
          "next_surface": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/TodoNextData"
              },
              {
                "type": "null"
              }
            ]
          },
          "now": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TodoData"
            },
            "description": "Shown now, by act-by; overdue rows after the ones still in time."
          },
          "whenever": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TodoData"
            },
            "description": "No date."
          }
        }
      },
      "TodoScheduleBody": {
        "type": "object",
        "description": "Body of `POST /api/v1/mail/todos/{todo_id}/schedule`.",
        "properties": {
          "dry_run": {
            "type": "boolean"
          },
          "time_zone": {
            "type": [
              "string",
              "null"
            ],
            "description": "The browser's IANA zone, so \"mon 9am\" means the user's Monday."
          },
          "when": {
            "type": [
              "string",
              "null"
            ],
            "description": "\"mon 9am\", \"in 3d\" or RFC3339; omitted clears your date."
          }
        }
      },
      "TodoStateActionData": {
        "type": "string",
        "enum": [
          "done",
          "undo",
          "dismiss"
        ]
      },
      "TodoStateBody": {
        "type": "object",
        "description": "Body of `POST /api/v1/mail/todos/state`.",
        "required": [
          "todo_ids",
          "action"
        ],
        "properties": {
          "action": {
            "$ref": "#/components/schemas/TodoStateActionData"
          },
          "dry_run": {
            "type": "boolean",
            "description": "Preview only: the rows that would change, nothing written."
          },
          "todo_ids": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Full ids or unique prefixes."
          }
        }
      },
      "TodoStateData": {
        "type": "string",
        "enum": [
          "open",
          "done",
          "dismissed",
          "expired"
        ]
      },
      "TodoUncertainData": {
        "type": "object",
        "required": [
          "thread_id",
          "subject",
          "asks"
        ],
        "properties": {
          "asks": {
            "$ref": "#/components/schemas/AskSummary"
          },
          "subject": {
            "type": "string"
          },
          "thread_id": {
            "$ref": "#/components/schemas/ThreadId"
          }
        }
      },
      "TodoWeekData": {
        "type": "object",
        "description": "One week of Coming up.",
        "required": [
          "week_start",
          "label",
          "todos"
        ],
        "properties": {
          "label": {
            "type": "string",
            "description": "\"wk of 12 Oct\"."
          },
          "todos": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TodoData"
            }
          },
          "week_start": {
            "type": "string",
            "format": "date",
            "description": "The Monday the week starts, in the user's zone."
          }
        }
      },
      "TopicStateData": {
        "type": "string",
        "description": "Whose turn it is on one topic.",
        "enum": [
          "your_turn",
          "waiting",
          "quiet",
          "done"
        ]
      },
      "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"
        ]
      },
      "TrimmedData": {
        "type": "object",
        "description": "What `new text` removed from a message.",
        "required": [
          "quote",
          "signature"
        ],
        "properties": {
          "footer": {
            "type": "boolean",
            "description": "A legal disclaimer or a tracking/unsubscribe footer."
          },
          "quote": {
            "type": "boolean"
          },
          "signature": {
            "type": "boolean"
          }
        }
      },
      "TuiKeysData": {
        "type": "object",
        "description": "Keys the TUI binds to an action, and where.",
        "required": [
          "name",
          "keys",
          "contexts"
        ],
        "properties": {
          "contexts": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "keys": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "name": {
            "type": "string",
            "description": "The TUI action its dispatcher returns."
          }
        }
      },
      "UndoPreview": {
        "type": "object",
        "description": "What `UndoMutation` would reverse, read from the undo entry without\nchanging it.",
        "required": [
          "mutation_id",
          "kind",
          "targets",
          "restores_desk_state"
        ],
        "properties": {
          "kind": {
            "type": "string",
            "description": "The mutation's kind, snake_case (`archive`, `labels`, `desk_done`)."
          },
          "mutation_id": {
            "type": "string"
          },
          "restores_desk_state": {
            "type": "boolean",
            "description": "True when the undo also puts back local state beyond messages: a desk\nDone's dismissals, promises, reminders or highlights."
          },
          "targets": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/UndoPreviewTarget"
            },
            "description": "The messages the undo restores, in the order the undo entry holds them."
          }
        }
      },
      "UndoPreviewTarget": {
        "type": "object",
        "required": [
          "message_id",
          "account_id",
          "in_local_store"
        ],
        "properties": {
          "account_id": {
            "$ref": "#/components/schemas/AccountId"
          },
          "in_local_store": {
            "type": "boolean",
            "description": "False when the message is gone from the local store, so the real undo\ncannot restore it."
          },
          "message_id": {
            "$ref": "#/components/schemas/MessageId"
          }
        }
      },
      "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"
            ]
          }
        ]
      },
      "UnsubscribePlanData": {
        "type": "object",
        "description": "What `PlanUnsubscribe` will send for an address. An address sends at most\none request: from the newest message that has a usable method.",
        "properties": {
          "already_unsubscribed": {
            "type": "boolean",
            "description": "True when the chosen message already has a confirmed receipt, so the\nsender is not sent another request."
          },
          "matched_messages": {
            "type": "integer",
            "format": "int32",
            "description": "Messages the address matched that still exist.",
            "minimum": 0
          },
          "request": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/UnsubscribePlanRequestData",
                "description": "The one request to send. `None` when no matched message has a usable\nmethod, or when the chosen message already has a receipt."
              },
              {
                "type": "null"
              }
            ]
          }
        }
      },
      "UnsubscribePlanRequestData": {
        "type": "object",
        "required": [
          "message_id",
          "method"
        ],
        "properties": {
          "message_id": {
            "$ref": "#/components/schemas/MessageId",
            "description": "The message whose List-Unsubscribe header the request uses."
          },
          "method": {
            "$ref": "#/components/schemas/UnsubscribeMethod"
          }
        }
      },
      "UnsubscribePurgeResultData": {
        "type": "object",
        "required": [
          "address",
          "query",
          "dry_run",
          "method",
          "status",
          "message_count",
          "archived_count"
        ],
        "properties": {
          "account_id": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/AccountId"
              },
              {
                "type": "null"
              }
            ]
          },
          "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"
            ]
          },
          "preview_token": {
            "type": [
              "string",
              "null"
            ],
            "description": "A dry run's token: pass it back to commit exactly this preview."
          },
          "query": {
            "type": "string"
          },
          "status": {
            "$ref": "#/components/schemas/UnsubscribePurgeStatusData"
          }
        }
      },
      "UnsubscribePurgeStatusData": {
        "type": "string",
        "enum": [
          "preview",
          "unsubscribed",
          "no_method",
          "archive_only",
          "failed"
        ]
      },
      "UpdateDeltaData": {
        "type": "object",
        "description": "A change computed by code against the previous message of the same\ntemplate, only when both numbers share a unit.",
        "required": [
          "raw",
          "previous_raw",
          "change",
          "text",
          "against"
        ],
        "properties": {
          "against": {
            "type": "string",
            "format": "date-time"
          },
          "change": {
            "type": "number",
            "format": "double",
            "description": "Percent change; points for a percentage."
          },
          "previous_raw": {
            "type": "string"
          },
          "raw": {
            "type": "string"
          },
          "text": {
            "type": "string",
            "description": "\"up 12% on last week\"."
          }
        }
      },
      "UpdateExpiredData": {
        "type": "object",
        "description": "An update whose window closed: it never shows in a cut.",
        "required": [
          "account_id",
          "message_id",
          "thread_id",
          "source_name",
          "fact",
          "kind",
          "expired_at"
        ],
        "properties": {
          "account_id": {
            "$ref": "#/components/schemas/AccountId"
          },
          "expired_at": {
            "type": "string",
            "format": "date-time"
          },
          "fact": {
            "type": "string"
          },
          "kind": {
            "type": "string",
            "description": "\"one-time code\", \"sign-in alert\", \"offer\", \"verify link\"."
          },
          "message_id": {
            "$ref": "#/components/schemas/MessageId"
          },
          "source_name": {
            "type": "string"
          },
          "thread_id": {
            "$ref": "#/components/schemas/ThreadId"
          }
        }
      },
      "UpdateLineData": {
        "type": "object",
        "description": "One line of the briefing: a source's latest fact per template, or one\ntracker.",
        "required": [
          "id",
          "section",
          "account_id",
          "source_key",
          "source_name",
          "fact",
          "fact_source",
          "signal",
          "count",
          "latest_at",
          "todo_title",
          "why",
          "setting"
        ],
        "properties": {
          "account_id": {
            "$ref": "#/components/schemas/AccountId"
          },
          "auto_todo": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/AutoTodoData",
                "description": "Whether mxr made this alert's to-do itself, and if not, why not.\nOnly on alerts (new sign-in, failed payment, delivery problem)."
              },
              {
                "type": "null"
              }
            ]
          },
          "code": {
            "type": [
              "string",
              "null"
            ],
            "description": "The one-time code the newest message gives, to copy: \"482913\".\nOnly while the code is in its window; expired lines never show."
          },
          "count": {
            "type": "integer",
            "format": "int32",
            "description": "Messages the line folds.",
            "minimum": 0
          },
          "delta": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/UpdateDeltaData"
              },
              {
                "type": "null"
              }
            ]
          },
          "fact": {
            "type": "string",
            "description": "The fact, written by rules from the subject or the body's first\nline: \"Run failed: CI - main\"."
          },
          "fact_message_id": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/MessageId",
                "description": "The message `fact` and `todo_title` came from, for `t`. In Changed\nit can be older than the newest."
              },
              {
                "type": "null"
              }
            ]
          },
          "fact_source": {
            "type": "string",
            "description": "\"subject\" or \"body\"."
          },
          "id": {
            "type": "string",
            "description": "Stable within a digest: source, template or tracker."
          },
          "in_todo": {
            "type": [
              "string",
              "null"
            ],
            "description": "`updates_copy::IN_TODO` when `todo_id` is set."
          },
          "latest_at": {
            "type": "string",
            "format": "date-time"
          },
          "latest_message_id": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/MessageId",
                "description": "The newest message, for `o`."
              },
              {
                "type": "null"
              }
            ]
          },
          "latest_message_pinned": {
            "type": "boolean",
            "description": "Whether the exact latest email is pinned in the local store. Older\ndigest payloads omit this and are deliberately treated as unpinned."
          },
          "latest_thread_id": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/ThreadId"
              },
              {
                "type": "null"
              }
            ]
          },
          "link": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/UpdateLinkData"
              },
              {
                "type": "null"
              }
            ]
          },
          "message_ids": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/MessageId"
            }
          },
          "numbers": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/UpdateNumberData"
            }
          },
          "provenance": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/UpdateProvenanceData"
            }
          },
          "section": {
            "$ref": "#/components/schemas/UpdateSectionData"
          },
          "seen_revision": {
            "type": [
              "string",
              "null"
            ],
            "description": "Opaque version to acknowledge with `SetModeRowSeen`."
          },
          "sender_email": {
            "type": "string"
          },
          "setting": {
            "$ref": "#/components/schemas/UpdateSourceSettingData"
          },
          "signal": {
            "$ref": "#/components/schemas/UpdateSignalData"
          },
          "source_filed_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "The newest email left the inbox outside mxr; the update is still here.\nAbsent for parcel trackers, which represent a delivery, not one email."
          },
          "source_key": {
            "type": "string"
          },
          "source_name": {
            "type": "string",
            "description": "\"GitHub acme/api\", \"Strava\"."
          },
          "suggestion": {
            "type": [
              "string",
              "null"
            ],
            "description": "Asked once a month at most: \"You've let go of Strava 8 digests in a\nrow without opening it. Mute it, or changes only?\""
          },
          "thread_ids": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ThreadId"
            }
          },
          "time_label": {
            "type": [
              "string",
              "null"
            ],
            "description": "Only when the time is the fact (a sign-in, a failing build): \"06:12\"."
          },
          "todo_id": {
            "type": [
              "string",
              "null"
            ],
            "description": "The open to-do this line already went to."
          },
          "todo_suggestion": {
            "type": [
              "string",
              "null"
            ],
            "description": "A sign-in alert, failed payment or delivery problem not yet in To\ndo: \"Suggested to-do: new sign-in alert (rule). t adds it.\" mxr\nmakes it automatically only with verified receiver evidence."
          },
          "todo_title": {
            "type": "string",
            "description": "What `t` prefills: \"Check new sign-in to Google\n(accounts.google.com)\", the sending host beside the display name."
          },
          "tracker": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/UpdateTrackerData"
              },
              {
                "type": "null"
              }
            ]
          },
          "unread": {
            "type": [
              "boolean",
              "null"
            ],
            "description": "This line revision has not been opened or peeked, including trackers.\nIndependent of the source email's READ flag. Omitted by older daemons."
          },
          "why": {
            "type": "string",
            "description": "\"Here because: automated sender, not a person (rule). In the 08:00\ndigest.\""
          }
        }
      },
      "UpdateLinkData": {
        "type": "object",
        "description": "The one place a line opens with `L`. Never a pay link.",
        "required": [
          "url",
          "domain"
        ],
        "properties": {
          "domain": {
            "type": "string",
            "description": "Shown before it opens: \"github.com\"."
          },
          "url": {
            "type": "string"
          }
        }
      },
      "UpdateNumberData": {
        "type": "object",
        "description": "A number as the message quoted it.",
        "required": [
          "raw",
          "value",
          "unit"
        ],
        "properties": {
          "raw": {
            "type": "string",
            "description": "Verbatim: \"21.3 km\", \"R 4,210.00\"."
          },
          "unit": {
            "type": "string",
            "description": "\"km\", \"run\", \"%\" or an ISO currency code."
          },
          "value": {
            "type": "number",
            "format": "double"
          }
        }
      },
      "UpdateProvenanceData": {
        "type": "object",
        "description": "Where one field of a line came from.",
        "required": [
          "field",
          "source",
          "evidence"
        ],
        "properties": {
          "evidence": {
            "type": "string",
            "description": "\"the subject\", \"21.3 km quoted from the body\", \"against 30 Sep\"."
          },
          "field": {
            "type": "string",
            "description": "\"fact\", \"numbers\", \"delta\", \"window\", \"state\", \"link\"."
          },
          "source": {
            "type": "string",
            "description": "\"rule\", \"schema\", \"code\" or \"default\"."
          }
        }
      },
      "UpdateSectionData": {
        "type": "string",
        "description": "Where a line sits in the briefing. Sections never reorder.",
        "enum": [
          "needs_a_look",
          "changed",
          "routine"
        ]
      },
      "UpdateSignalData": {
        "type": "string",
        "enum": [
          "routine",
          "changed",
          "new_source",
          "anomaly",
          "needs_you"
        ]
      },
      "UpdateSourceBody": {
        "type": "object",
        "description": "Body of `POST /api/v1/mail/updates/sources`.",
        "required": [
          "source",
          "setting"
        ],
        "properties": {
          "account_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "dry_run": {
            "type": "boolean"
          },
          "setting": {
            "$ref": "#/components/schemas/UpdateSourceSettingData"
          },
          "source": {
            "type": "string",
            "description": "A source key as the digest names it, or a sender address."
          }
        }
      },
      "UpdateSourceChangeData": {
        "type": "object",
        "description": "Returned by `Request::SetUpdateSource`.",
        "required": [
          "dry_run",
          "account_id",
          "source_key",
          "setting",
          "prior",
          "copy"
        ],
        "properties": {
          "account_id": {
            "$ref": "#/components/schemas/AccountId"
          },
          "copy": {
            "type": "string",
            "description": "\"Strava: only when something changes.\""
          },
          "dry_run": {
            "type": "boolean"
          },
          "prior": {
            "$ref": "#/components/schemas/UpdateSourceSettingData",
            "description": "What it was, for undo."
          },
          "setting": {
            "$ref": "#/components/schemas/UpdateSourceSettingData"
          },
          "source_key": {
            "type": "string"
          }
        }
      },
      "UpdateSourceSettingData": {
        "type": "string",
        "description": "How a source is tuned with `K`.",
        "enum": [
          "every_digest",
          "changes_only",
          "muted",
          "breakthrough"
        ]
      },
      "UpdateTrackerData": {
        "type": "object",
        "description": "A thing with a state: a parcel, a build or an incident.",
        "required": [
          "kind",
          "state",
          "state_label",
          "outcome"
        ],
        "properties": {
          "delivery_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "detail": {
            "type": [
              "string",
              "null"
            ],
            "description": "\"Expected by Thu 8 Oct · DHL · 3 emails\"."
          },
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/DeliveryItemData"
            },
            "description": "Available item records are useful identifiers, but may not be the\ncomplete contents of a parcel."
          },
          "kind": {
            "type": "string",
            "description": "`parcel`, `build` or `incident`."
          },
          "order_number": {
            "type": [
              "string",
              "null"
            ]
          },
          "outcome": {
            "type": "string",
            "description": "`good` (ended well), `bad` (ended badly), `progress`, or `quiet`\n(a parcel with no news for too long)."
          },
          "state": {
            "type": "string",
            "description": "As stored: \"out_for_delivery\", \"failed\", \"resolved\"."
          },
          "state_label": {
            "type": "string",
            "description": "\"out for delivery\"."
          },
          "step": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int32",
            "minimum": 0
          },
          "steps": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "A parcel's steps, \"ordered\" to \"delivered\", and where it is."
          },
          "tracking_number": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "UpdatesCutData": {
        "type": "object",
        "description": "The cut a digest shows.",
        "required": [
          "at",
          "label",
          "title",
          "previous_at",
          "next_at",
          "next_label",
          "cuts"
        ],
        "properties": {
          "at": {
            "type": "string",
            "format": "date-time"
          },
          "cuts": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Every cut of the day, from `updates.cuts`: [\"08:00\", \"16:30\"]."
          },
          "label": {
            "type": "string",
            "description": "\"08:00\" in your zone."
          },
          "next_at": {
            "type": "string",
            "format": "date-time"
          },
          "next_label": {
            "type": "string"
          },
          "previous_at": {
            "type": "string",
            "format": "date-time"
          },
          "title": {
            "type": "string",
            "description": "\"This morning's digest\"."
          }
        }
      },
      "UpdatesDigestData": {
        "type": "object",
        "description": "Returned by `Request::GetUpdatesDigest`.",
        "required": [
          "generated_at",
          "header",
          "cut",
          "headline",
          "message_count",
          "source_count",
          "needs_a_look",
          "changed",
          "routine",
          "since",
          "expired_count",
          "selection_token",
          "source_total",
          "muted_total"
        ],
        "properties": {
          "changed": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/UpdateLineData"
            }
          },
          "cut": {
            "$ref": "#/components/schemas/UpdatesCutData"
          },
          "empty_state": {
            "type": [
              "string",
              "null"
            ],
            "description": "Set when the digest is empty: the never-had-any or the clear line."
          },
          "expired": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/UpdateExpiredData"
            },
            "description": "With `expired: true`: every expired update still in the mode."
          },
          "expired_count": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "expired_line": {
            "type": [
              "string",
              "null"
            ],
            "description": "\"3 expired since you last looked.\""
          },
          "generated_at": {
            "type": "string",
            "format": "date-time"
          },
          "header": {
            "type": "string",
            "description": "`updates_copy::HEADER`."
          },
          "headline": {
            "type": "string",
            "description": "\"2 changed, 1 needs a look. 23 routine from 9 sources.\" Empty when\nthe digest is."
          },
          "hidden_line": {
            "type": [
              "string",
              "null"
            ],
            "description": "\"4 from muted sources, 2 from changes-only sources not shown.\""
          },
          "let_go_line": {
            "type": [
              "string",
              "null"
            ],
            "description": "What letting go of this digest would do: \"Let go of 31 updates from\n12 sources; 2 also in To do stay there.\""
          },
          "message_count": {
            "type": "integer",
            "format": "int32",
            "description": "Messages in the digest that are shown.",
            "minimum": 0
          },
          "muted_total": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "needs_a_look": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/UpdateLineData"
            }
          },
          "routine": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/UpdateLineData"
            }
          },
          "selection_token": {
            "type": "string",
            "description": "Pass back to `LetGoDigest` so it acts only on what was shown."
          },
          "since": {
            "$ref": "#/components/schemas/UpdatesSinceData"
          },
          "source_count": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "source_total": {
            "type": "integer",
            "format": "int32",
            "description": "Sources seen in this account's Updates, and how many are muted.",
            "minimum": 0
          }
        }
      },
      "UpdatesLetGoBody": {
        "type": "object",
        "description": "Body of `POST /api/v1/mail/updates/let-go`.",
        "properties": {
          "account_id": {
            "type": [
              "string",
              "null"
            ],
            "description": "Omitted: every account."
          },
          "cut": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "The cut the digest showed; the latest when omitted."
          },
          "dry_run": {
            "type": "boolean",
            "description": "Preview only; nothing changes."
          },
          "selection_token": {
            "type": [
              "string",
              "null"
            ],
            "description": "From the digest or the dry run: the run refuses if the cut changed."
          },
          "source_key": {
            "type": [
              "string",
              "null"
            ],
            "description": "One source only."
          }
        }
      },
      "UpdatesLetGoData": {
        "type": "object",
        "description": "Returned by `Request::LetGoDigest`.",
        "required": [
          "dry_run",
          "cut_at",
          "line",
          "message_count",
          "source_count",
          "hidden_count",
          "in_todo_count",
          "thread_ids",
          "message_ids",
          "selection_token",
          "items"
        ],
        "properties": {
          "cut_at": {
            "type": "string",
            "format": "date-time"
          },
          "dry_run": {
            "type": "boolean"
          },
          "hidden_count": {
            "type": "integer",
            "format": "int32",
            "description": "Of those, hidden from the digest by tuning or past their window.",
            "minimum": 0
          },
          "in_todo_count": {
            "type": "integer",
            "format": "int32",
            "description": "Threads To do also holds: they stay in the inbox.",
            "minimum": 0
          },
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ModeDoneOutcomeData"
            },
            "description": "One per thread, as `SetModeDone` reports it."
          },
          "line": {
            "type": "string",
            "description": "\"Let go of 31 updates from 12 sources; 2 also in To do stay there.\""
          },
          "message_count": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "message_ids": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/MessageId"
            }
          },
          "mutation_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "selection_token": {
            "type": "string"
          },
          "source_count": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "thread_ids": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ThreadId"
            }
          },
          "undo_unavailable": {
            "type": "boolean"
          }
        }
      },
      "UpdatesSinceData": {
        "type": "object",
        "description": "What arrived after the cut: always current, quiet and uncounted.",
        "required": [
          "label",
          "message_count",
          "source_count",
          "lines"
        ],
        "properties": {
          "label": {
            "type": "string",
            "description": "\"arriving for 16:30\"."
          },
          "lines": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/UpdateLineData"
            },
            "description": "One line per source, newest first."
          },
          "message_count": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "source_count": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          }
        }
      },
      "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"
          }
        }
      },
      "VerifiedQuoteData": {
        "type": "object",
        "required": [
          "message_id",
          "text"
        ],
        "properties": {
          "message_id": {
            "$ref": "#/components/schemas/MessageId"
          },
          "text": {
            "type": "string"
          }
        }
      },
      "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": [
              {
                "$ref": "#/components/schemas/WrappedTopList"
              },
              {
                "type": "null"
              }
            ]
          },
          "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": [
              {
                "$ref": "#/components/schemas/WrappedReplyExtreme",
                "description": "Single fastest reply pair in the window."
              },
              {
                "type": "null"
              }
            ]
          },
          "sample_count": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "slowest": {
            "oneOf": [
              {
                "$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."
              },
              {
                "type": "null"
              }
            ]
          }
        }
      },
      "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": [
              {
                "$ref": "#/components/schemas/LargestMessageRow"
              },
              {
                "type": "null"
              }
            ]
          },
          "top_mimetype": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/WrappedStorageBucket"
              },
              {
                "type": "null"
              }
            ]
          },
          "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": [
              {
                "$ref": "#/components/schemas/WrappedReplyDiscipline"
              },
              {
                "type": "null"
              }
            ]
          },
          "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": [
              {
                "$ref": "#/components/schemas/WrappedLongestThread"
              },
              {
                "type": "null"
              }
            ]
          },
          "most_ghosted": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/WrappedMostGhosted"
              },
              {
                "type": "null"
              }
            ]
          }
        }
      },
      "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 the `bridge-token` file in the active profile's config directory, or from `[bridge].token_path` / `MXR_BRIDGE_TOKEN_PATH` when either is set. Send via `Authorization: Bearer <token>` header. Browser WebSocket clients can use the `Sec-WebSocket-Protocol: bearer, <token>` subprotocol. The `?token=<token>` query string is accepted only by `/api/v1/events` for command-line WebSocket fallback."
      }
    }
  },
  "security": [
    {
      "bearer": []
    }
  ]
}
