feat: add typing indicator support via IMCore private framework #41
+303
−0
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
Implements typing indicators for outgoing messages (closes #22) using runtime dynamic loading of Apple's IMCore private framework. This is the only way to programmatically send typing indicators — AppleScript has no equivalent capability.
What's included
1.
IMsgCore—TypingIndicatorstructstartTyping(chatIdentifier:)— show the "..." typing bubble on the recipient's devicestopTyping(chatIdentifier:)— dismiss the typing bubbletypeForDuration(chatIdentifier:duration:)— show for N seconds, then auto-stopdlopento load/System/Library/PrivateFrameworks/IMCore.frameworkat runtimeIMDaemonController, resolves chat viaIMChatRegistry, then calls[IMChat setLocalUserIsTyping:]2. CLI —
imsg typingcommandSupports all the same chat targeting as
send:--to,--chat-id,--chat-identifier,--chat-guid.3. RPC —
typing.start/typing.stopmethods{"jsonrpc":"2.0","id":1,"method":"typing.start","params":{"to":"+14155551212"}} {"jsonrpc":"2.0","id":2,"method":"typing.stop","params":{"to":"+14155551212"}}Also supports
chat_identifier,chat_guid,chat_id, andserviceparams.How it works
The implementation uses the same approach as BlueBubbles — loading IMCore at runtime via
dlopen/objc_getClass/sel_registerName. The core call is:No new dependencies are required. The private framework is available on all macOS versions that support Messages.app.
Files changed
Sources/IMsgCore/TypingIndicator.swiftSources/IMsgCore/Errors.swifttypingIndicatorFailederror caseSources/imsg/Commands/TypingCommand.swiftSources/imsg/CommandRouter.swifttypingcommandSources/imsg/RPCServer.swifttyping.start/typing.stopRPC methodsCaveats
send).Testing
swift buildpasses with zero errors and zero warningsimsg typing --to <number>shows the typing bubble on the recipient's iPhoneTestingframework issue on non-Xcode-16 environments)