Skip to content

imessage_daemon

diapason.channels.imessage_daemon

iMessage daemon — polls chat.db and routes to DeepResearchAgent.

Monitors a designated iMessage conversation for new messages, routes them to the agent, and sends responses back via AppleScript.

Requires macOS with Full Disk Access for chat.db reading and Accessibility permission for AppleScript Messages control.

is_running()

Check if the daemon is currently running.

poll_new_messages(*, db_path=_DEFAULT_DB_PATH, last_rowid=0, chat_identifier='')

Return new incoming messages since last_rowid.

run_daemon(*, chat_identifier, db_path=_DEFAULT_DB_PATH, handler=None, poll_interval=_POLL_INTERVAL, max_iterations=0)

Run the iMessage polling daemon.

send_imessage(chat_identifier, message)

Send an iMessage via AppleScript.

chat_identifier is the recipient handle: - phone number in E.164 format (e.g. +15551234567) - or email address registered with iMessage

Internally addresses the recipient via the iMessage service's participant lookup — the previous chat id "..." form expected an internal chat handle (e.g. iMessage;-;+1555...) and silently failed on raw phone numbers, returning success while no message was actually sent.

stop_daemon()

Stop the running daemon. Returns True if stopped.