//! The message-archive WRITE verbs the owner's own app authors. //! //! What is in here is everything a person does to their OWN COPY of an //! imported conversation: read and unread, mute, pin, archive, clear, delete, //! star a line, hide a line. Nothing here composes or relays a message — //! the multi-person sharing data plane that made that meaningful was removed //! (the code is on the branch `archive/sharing-v1`), and with it //! `send_message`, the edit / delete-for-everyone / forward / react verbs and //! every group verb. //! //! WHY THEY ARE OWNER-SCOPE, all of them. The verb grid already refuses chat //! editing to an assistant, in writing: *"clearing or archiving a chat is the //! owner's private state, written only by their devices"*. That is an argument //! about who the author is, not against the OWNER'S OWN APP doing it, and //! [`crate::mcp::protocol::McpScope::Owner`], a word no token carries, is //! exactly how both sentences stay true at once. //! //! ## Private state, and who writes it //! //! Every column this module touches is the owner's own: `starred_at`, //! `hidden_at`, `read_seq`, `unread_marked_at`, `muted_until`, `pinned_at`, //! `archived`, `cleared_before`. The archive's shared content — a message's //! `body`, its media, a group's title — is written by the IMPORT //! (`cotton-client/src/ingest/`) and by nothing else; no verb here edits it. //! //! "Delete this conversation from my phone" IS a delete and is right to be: //! it erases this file's copy of rows the import can bring back. use serde_json::{Map, Value}; use crate::mcp::dispatch::HandlerGroup; pub mod messages; pub mod shared; pub mod threads; pub fn handlers() -> HandlerGroup { &[ // ── the message ──────────────────────────────────────────────── ("hide_chat_messages", messages::hide_chat_messages), ("star_message", messages::star_message), // ── the thread, all private state ────────────────────────────── ("mark_thread_read", threads::mark_thread_read), ("mark_thread_unread", threads::mark_thread_unread), ("set_thread_muted", threads::set_thread_muted), ("set_thread_pinned", threads::set_thread_pinned), ("set_thread_archived", threads::set_thread_archived), ("clear_thread", threads::clear_thread), ("delete_thread", threads::delete_thread), // ── the thread, filed in a shared database ───────────────────── ] } /// `{ id: … }` and whatever else a verb has to say — the shape every answer in /// this module takes, so a Swift model reads one envelope. pub(crate) fn answer(pairs: Vec<(&str, Value)>) -> Value { let mut out = Map::new(); for (key, value) in pairs { out.insert(key.to_string(), value); } Value::Object(out) }