Open
Conversation
Adds a new iMessage integration via Photon SDKs, supporting two modes: - **Local mode**: reads the iMessage SQLite DB directly on macOS via @photon-ai/imessage-kit (no server needed) - **Remote mode**: connects to a Photon iMessage server via Socket.IO + REST, enabling edit, unsend, tapbacks, effects, typing indicators, polls, and group chat management Changes: - New `IMessageChannel` class with full Channel interface implementation - Orchestrator wired to configure, start, and route iMessage messages - Router extended with `im:` prefix for iMessage group routing - Settings UI for mode selection, server URL, and API key - Config keys for iMessage mode/server/API key in IndexedDB - `ChannelType` union extended with 'imessage' - Module-level Orchestrator singleton to prevent duplicate instances under React StrictMode - Store init guard to prevent duplicate event listener registration - PWA service worker disabled in dev mode to avoid stale cache issues - README updated with setup instructions for both modes
… server - Strip all local-mode code (LocalSDK, startLocal, local types/methods) - Simplify IMessageConfig to just serverUrl + apiKey - Remove IMESSAGE_MODE config key (no mode selector needed) - Rename settings section from "Photon iMessage" to "iMessage" - Mode label shows "Remote (Photon managed)" as static text - Settings UI simplified: just server URL + API key fields
iMessage conversations are direct chats — requiring @mention for every message is unnecessary friction. Messages from im: prefixed groups now always trigger the agent, matching the browser chat behavior. Other channels (Telegram) still require the @mention pattern.
- Remove default null value for imessage param in Router constructor - Remove all dev-only console.log statements from orchestrator and imessage channel - Replace "Photon managed" branding with neutral "remote" / "HTTPS + Socket.IO" - Simplify iMessage server requirement description in README - Fix security section to list Telegram and iMessage plaintext storage consistently - Revert unrelated devOptions.enabled change in vite.config.ts
Remove editMessage, addReaction, removeReaction, getMessages, getChatInfo, createPoll — all defined but never called from anywhere. Also remove unused RemoteChat type, MESSAGE_EFFECTS, MessageEffect, and the now-orphaned _get helper. Update SettingsPage and README to not claim unsupported features.
- Add typing timer tracking to prevent overlapping POST/DELETE calls - Guard send/setTyping with enabled check after disable - Filter empty-text messages (attachment-only) before triggering agent - Reset running flag if _startRemote() throws during startup - Stop channel on auth-error instead of retrying with bad credentials - Enable Socket.IO reconnection with exponential backoff (1s–30s) - Catch router.send() failures in deliverResponse so state resets to idle - Replace Photon placeholder URL with generic example.com
…dup TTL - Reject socket events without a valid chat GUID instead of emitting groupId "im:" which collapses messages into a fake conversation - Add 15s AbortController timeout to REST helpers (_post, _delete) via shared _request method so hung servers don't block state indefinitely - Fix dedup cache to actually respect 60s TTL by checking stored timestamp on lookup, not just map membership
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.
Adds iMessage as a new channel so the agent can receive and respond to iMessages. Messages automatically trigger the agent without requiring an @mention.
Changes
New channel (
src/channels/imessage.ts)•
IMessageChannel— Socket.IO client for real-time inbound messages, REST for outbound send and typing indicators• GUID-based dedup with 60s TTL to prevent double-processing
• Exponential reconnection backoff (1s–30s) on disconnect
• 15s timeout on all REST calls so a hung server doesn’t block state
• Filters attachment-only messages before they reach the agent
Orchestrator (
src/orchestrator.ts)• iMessage init/teardown lifecycle alongside existing Telegram
•
im:prefixed group IDs auto-trigger the agent without @mention• Delivery error handling so state resets cleanly on failure
Router (
src/router.ts)• Routes
im:-prefixed group IDs toIMessageChannelSettings UI (
src/components/settings/SettingsPage.tsx)• Server URL and API key fields for the iMessage bridge
Config & types
•
IMESSAGE_SERVER_URLandIMESSAGE_API_KEYadded tosrc/config.ts•
ChannelTypeunion extended with'imessage'insrc/types.tsOther
•
src/App.tsx— module-level Orchestrator singleton to avoid duplicate instances under React StrictMode•
src/stores/orchestrator-store.ts— guard against duplicate event listener registration•
README.md— setup instructions and updated architecture diagram•
package.json— addedsocket.io-clientc50a732f185407f3194bade313058b8c.2.mp4