feat(photon): upgrade sidecar to spectrum-ts v8 and correlate tapbacks to bot messages - #53333
Closed
underthestars-zhy wants to merge 3 commits into
Closed
feat(photon): upgrade sidecar to spectrum-ts v8 and correlate tapbacks to bot messages#53333underthestars-zhy wants to merge 3 commits into
underthestars-zhy wants to merge 3 commits into
Conversation
Update the Photon platform plugin's Node.js sidecar from spectrum-ts 3.1.0 to 7.0.0, which splits the SDK into scoped `@spectrum-ts/*` packages with `spectrum-ts` as the umbrella re-export. - Bump exact pin in package.json/package-lock.json to 7.0.0 - Update mixed-attachments patch script to target the new `@spectrum-ts/imessage/dist/index.js` path and tab-indented output - Rewrite test fixture to match v7.x mapper shape (tab-indented, `const ... = async` declarations, single-line builder calls) and point at `@spectrum-ts/imessage/dist/index.js` - Update README upgrade guide to document the v5 package split and the postinstall patch validation step - Update comments in cli.py and index.mjs to reference v5/v7 changes
v8 made `richlink` outbound-only; inbound rich links now arrive as plain `text`. Remove the `getBalloonBundleId`/`toRichlinkMessage` branches from the iMessage mapper patch and update the fixture, lockfile, and README accordingly.
Populate `reply_to_message_id`, `reply_to_text`, and `reply_to_is_own_message` on reaction events so the gateway injects `[Replying to your previous message: "..."]` when the agent receives a tapback. The sidecar now extracts a capped text preview from the hydrated reaction target (plain text and mixed group messages; null for attachment/voice-only targets), emitting it as `targetText` in the NDJSON reaction payload. The Python adapter reads this field and sets the reply correlation fields on the `MessageEvent`.
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.
What does this PR do?
Two related changes to the Photon (iMessage) platform plugin — its Node.js sidecar and Python adapter.
1. Upgrade the
spectrum-tsSDK 3.1.0 → 8.0.0. The SDK ships breaking majors, so it's pinned exactly and migrated deliberately (never@latest):@spectrum-ts/*packages, withspectrum-tsas an umbrella re-export. The mixed-attachments postinstall patch now targets@spectrum-ts/imessage/dist/index.js(tab-indented output to match the new build).richlinkoutbound-only — inbound rich links now arrive as plaintext— so thegetBalloonBundleId/toRichlinkMessagebranches were removed from the iMessage mapper patch.2. Correlate tapbacks to the message they reacted to. Previously the agent received
reaction:added:❤️with no idea what was tapped back. Now:nullfor attachment/voice-only targets) and emits it astargetTextin the NDJSON reaction payload — no extra round trip.reply_to_message_id,reply_to_text, andreply_to_is_own_messageon theMessageEvent, so the gateway injects[Replying to your previous message: "…"]when the agent receives a tapback on one of its own messages.Related Issue
N/A — no linked issue.
Type of Change
spectrum-ts3.x → 8.x (deliberate pinned SDK migration)Changes Made
Tapback correlation
plugins/platforms/photon/sidecar/index.mjs— addreactionTargetText()(capped preview of the hydrated reaction target) and emittargetTextfromnormalizeContent().plugins/platforms/photon/adapter.py— populatereply_to_message_id/reply_to_text/reply_to_is_own_messageon reactionMessageEvents; documenttargetTextin the payload contract.tests/plugins/platforms/photon/test_reactions.py— new tests covering the reply-correlation fields.spectrum-ts v7 → v8 upgrade
plugins/platforms/photon/sidecar/package.json/package-lock.json— bump exact pin to8.0.0.plugins/platforms/photon/sidecar/patch-spectrum-mixed-attachments.mjs— retarget the postinstall patch at@spectrum-ts/imessage/dist/index.js; drop therichlinkmapper branches (v8 made it outbound-only).plugins/platforms/photon/sidecar/index.mjs/cli.py— update version references/comments (3.x → 8.x; note the v5 package split).plugins/platforms/photon/README.md— document the v5 package split, the v8 richlink change, and the postinstall patch-validation step.tests/plugins/platforms/photon/test_spectrum_patch.py— rewrite fixtures to the v7/v8 mapper shape and new@spectrum-ts/imessagemodule path.How to Test
pytest tests/plugins/platforms/photon/ -q→ 108 passed (includes the new reaction tests and the rewritten spectrum-patch fixtures).npm ciinplugins/platforms/photon/sidecar/) and confirm the postinstall patch applies cleanly against@spectrum-ts/imessage@8.0.0.[Replying to your previous message: "<original text>"].Checklist
Code
fix(scope):,feat(scope):)pytest tests/plugins/platforms/photon/ -q(the affected suite) and all 108 tests passDocumentation & Housekeeping
README.md, sidecar/adapter docstrings)cli-config.yaml.example)Screenshots / Logs