Conversation
The service asked for chat.db alone. Messages keeps that database in WAL mode: every new message is committed to chat.db-wal first and only reaches chat.db when SQLite checkpoints the log, every few MB of writes. With a grant on the single file the log was unreadable, so Madrid opened the database with immutable=1 and messages_fetch could not see anything newer than the last checkpoint, often hours behind, then everything at once. The file picker now asks for ~/Library/Messages (directories only, constrained to a folder named Messages) and the bookmark covers the folder, which lets SQLite read chat.db together with its -wal and -shm companions (Madrid's Database.AccessMode.live). The security scope now stays open until the fetch is done, since SQLite opens the log lazily. A bookmark stored by an earlier version (chat.db alone) keeps working in immutable mode; the first fetch of a launch offers to re-select the folder, and declining is remembered for that launch. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0187kUP2mjhwMfJkwRbP5DG7
- attachments: true on messages_fetch returns each message's attachments
({@id, name, encodingFormat, contentSize, sticker}, hidden ones excluded)
and keeps attachment-only messages (U+FFFC / at_<n>_<UUID> placeholders
stripped from the text)
- messages_attachment_read {id, maxBytes}: base64 bytes of one attachment,
only from under the granted Messages folder
- RawDatabase: read-only sqlite3 access for the attachment join
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ARr1A7UfPmRfBS2NYynnvA
Owner
Owner
|
Hi @zeke! 1.6.0 is out, and |
|
Thanks for the update! That's probably enough to unblock me if I can get the filenames.🤞 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
messages_fetchreturns text only. Photos, voice memos, PDFs and other files that arrive over iMessage are invisible to a client: a message that is just a picture is dropped (its text is the empty string or the U+FFFC placeholder), and there is no way to get at the bytes at all. For anything that indexes or summarises a conversation, that is a large part of the history missing.Change
messages_fetchtakes a new optionalattachments: true. Each message then carries anattachmentarray (@id,name,encodingFormat,contentSize,sticker), hidden attachments excluded, and attachment-only messages are kept instead of being filtered out. The U+FFFC placeholder and theat_<n>_<UUID>guid lines Messages writes into the body are stripped fromtext. Without the flag the tool behaves exactly as before.messages_attachment_read {id, maxBytes}: returns one attachment as base64 with its name, type and size. It resolves the stored path against the granted Messages folder and refuses anything outside it, so the grant cannot be turned into a general file reader. Files not yet downloaded from iCloud produce a clear error.message_attachment_join/attachment) is not exposed by Madrid, so it is read with a small read-onlysqlite3wrapper over the sameDatabaseAccess(one query per fetched page).Dependency
Stacked on #198: reading attachment files needs the folder grant that PR introduces (the single-file
chat.dbgrant cannot reach~/Library/Messages/Attachments). Only the last commit is new here.Testing
swift format lint --strictclean.🤖 Generated with Claude Code
https://claude.ai/code/session_01ARr1A7UfPmRfBS2NYynnvA