Repository navigation
cmux-imessage: read-only Messages database reader for the opt-in Messages mirror - #32891
Conversation
Adds the cmux-imessage crate with its API stubbed and the fixture-database tests that the reader must pass: threads (1:1 and group chats), messages with attributedBody text and attachments, live-update watermark, and the missing/not-permitted/schema errors. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Agent-Session: https://cmux.com/deeplink/agent?id=aid-9bf3963ac29d9d619047 Co-authored-by: Codex <199175422+chatgpt-codex-connector[bot]@users.noreply.github.com>
Opens ~/Library/Messages/chat.db read-only and lists threads (1:1 and group chats, newest first, with participants and a last-message preview), pages a thread's messages (text from message.text or decoded from the attributedBody typedstream, attachment metadata; tapbacks and group events left out) and returns messages past a rowid watermark for live updates. A TCC denial maps to NotPermitted so the UI can ask for Full Disk Access. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Agent-Session: https://cmux.com/deeplink/agent?id=aid-9bf3963ac29d9d619047 Co-authored-by: Codex <199175422+chatgpt-codex-connector[bot]@users.noreply.github.com>
Bugbot needs on-demand usage enabledBugbot uses usage-based billing for this team and requires on-demand usage to be enabled. A team admin can enable on-demand usage in the Cursor dashboard. |
|
cmux status (one comment, edited in place; each line is updated by the job that owns it) Review App of this head (app.zip, kept 1 day)
Shipped in:
|
|
Review (subagent claude-opus-5-5 medium): SHIP at 3fc8115 Checked the schema assumptions (style 43 group, ns-since-2001 dates with seconds fallback, typedstream Follow-ups:
|
Leo's ask: "i mean like obviously we already are in an imessage type zone im saying like actual imessage chats with contacts/group chats" ... "hm. could we mirror it?"
This is the first step of an opt-in, off-by-default Messages mirror in cmux NEXT: a read-only reader of the macOS Messages database. It adds no UI and nothing calls it yet. The daemon ops and the page come in the next PR.
What it does
New crate
cmux-tui/crates/cmux-imessage:Reader::open(path)opens~/Library/Messages/chat.dbwithSQLITE_OPEN_READ_ONLY. It never writes. A TCC denial (no Full Disk Access) returnsNotPermitted, a missing fileMissing, and a database without the Messages tablesSchema.threads(limit): 1:1 and group chats, newest activity first. Each one carries its title (the group name, else the participants),is_group, its participants and a last-message preview.messages(chat_id, before_rowid, limit): one thread's messages, oldest first, paged back by rowid. Text comes frommessage.text, or is decoded from theattributedBodytypedstream that recent macOS versions use instead. Attachment names and MIME types are included; tapbacks and group events are left out.since(rowid, limit)andlatest_rowid(): the watermark that live updates will use.Nothing leaves the Mac. The crate has no network code, and attachment files are never copied.
Tests
Two commits: the failing tests against stubs (9 of 10 red), then the reader (10 of 10 green, clippy
-D warningsclean). The fixture databases are built from the Messages schema: group naming and fallback, preview skipping tapbacks, attributedBody short/long/unicode/garbage, paging, the watermark across chats, and the missing/schema/not-permitted errors.Follow-ups (next PRs): the daemon resource
messages.mirror.*with a file-watch change event, the webview page and the off-by-default setting; then sending through Messages.app. Contact names are a follow-up too.Agent session: agent session
🤖 Generated with Claude Code
Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.Summary by cubic
Adds the
cmux-imessagecrate: a read-only reader of the macOS Messages database (~/Library/Messages/chat.db) that backs an opt-in, off-by-default Messages mirror in cmux NEXT. Nothing calls it yet; the daemon resource, live-update file watcher, and UI come in the next PRs.New Features
SQLITE_OPEN_READ_ONLY, never writes, never copies attachment files, and has no network code.NotPermittedso the UI can ask for Full Disk Access, a missing file toMissing, and an unfamiliar schema toSchema.attributedBodytypedstream whenmessage.textis empty; includes attachment names and MIME types.since()andlatest_rowid()as the watermark live updates will use.attributedBodyvariants, paging, the watermark, and all three open errors.Written for commit 3fc8115. Summary will update on new commits.