Add dedicated-outbound iMessage group chats - #13
Merged
Conversation
Mirrors the Hermes bridge's group flow so the two behave the same on the wire. Inbound: a group is one shared context, so the conversation - not the sender - is the chat, and every participant's message lands in the same session. The prompt carries a group marker with the participant list and reply_mode=conversation_id, plus the response policy the group SMS path already uses: reply only when the latest message actually addresses the agent, treat the rest as context, and return [SILENT] otherwise. Group flags and participants are read from the event, falling back to a conversation lookup for events that omit them. Outbound: `to` now accepts one recipient or a list of 2-8 to open a group. Starting a group needs a dedicated outbound iMessage line, so the tool checks for one and returns a specific error code rather than letting the send fail at the API. Shared and dedicated inbound lines stay recipient-first, which is why conversation_id remains the documented reply path. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The SDK has typed `to` as `string | string[]` since 0.5.6, which is the floor this plugin already pins. The cast came from reading a stale local node_modules (0.4.24) rather than the pinned range. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
dimavrem22
marked this pull request as ready for review
July 29, 2026 03:59
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.
Summary
Brings iMessage groups into line with the rest of the plugin fleet (inkbox-ai/hermes-agent-plugin#76).
This bridge already had a channel-agnostic group path —
countParticipants,group: { participantCount, participants }, andgroupReminder's reply-only-when-addressed +[SILENT]policy — so iMessage groups partly worked already. Three gaps kept them from behaving like the other four plugins.1. A group is one shared context
chatKeyForpreferscontactId, so in a group each participant got their own chat. The agent saw N disconnected 1:1s instead of one conversation it could follow. The conversation now keys the chat whenever there is more than one participant; 1:1 keeps its per-contact chat.2. Groups were only detected from resolved event contacts
countParticipantscounteddata.contacts/data.agent_identities. A conversation that names its participants inline on the message, or is simply flaggedis_group, was treated as 1:1. It now also reads the message's ownparticipantsandis_group.3. The frame did not say how to reply
Phone-channel group frames now carry
reply_mode=conversation_id, matching the other plugins. Two existing tests pinned the exact frame string and were updated.Outbound
toaccepts one recipient or 1–8 distinct recipients. Opening a group requires a dedicated outbound iMessage line — checked locally so the failure names the reason rather than surfacing as an API error. Existing recipient allowlist and approval flows apply per recipient.Tests
661 pass,
tscclean against SDK 0.5.7. Two new: an iMessage group frame carrying participants, reply mode and the silent policy; and a 1:1 that gets none of it.Version
0.2.6 → 0.2.7, matching the rest of the fleet.