Skip to content

The agent that grows with you

feat(photon): read-receipt toggle, receipt-type alias, docs

Tekniumd63f996a757f
diff --git a/plugins/platforms/photon/README.md b/plugins/platforms/photon/README.md
index f9a78fb3832..9f83cd2bc4c 100644
--- a/plugins/platforms/photon/README.md
+++ b/plugins/platforms/photon/README.md
@@ -166,7 +166,8 @@ All env vars are documented in `plugin.yaml`. The most important:
- **Read receipts are supported.** The sidecar marks an inbound iMessage read
after forwarding it to Hermes, so the sender sees `Read` without waiting for
a model/tool turn. Inbound receipts for Hermes-sent messages are consumed as
- presence telemetry and never create an agent turn.
+ presence telemetry and never create an agent turn. Set
+ `PHOTON_READ_RECEIPTS=false` to keep messages at `Delivered`.
- **Native polls are supported.** Hermes posts poll content through
`spectrum-ts`' `poll(...)` builder via the sidecar's `/send-poll` endpoint.
- **Message effects are supported.** Text can be sent with native iMessage
diff --git a/plugins/platforms/photon/adapter.py b/plugins/platforms/photon/adapter.py
index 9317b5a1958..ddc32c569d7 100644
--- a/plugins/platforms/photon/adapter.py
+++ b/plugins/platforms/photon/adapter.py
@@ -1292,7 +1292,7 @@ class PhotonAdapter(BasePlatformAdapter):
)
ctype = content.get("type")
- if ctype == "read":
+ if ctype in {"read", "read_receipt"}:
# Read receipts are presence signals, not a user turn. The sidecar
# only forwards receipts for messages we sent, so logging the
# target is enough for observability without waking the agent.
diff --git a/plugins/platforms/photon/plugin.yaml b/plugins/platforms/photon/plugin.yaml
index a39193a81bf..eb23356ba80 100644
--- a/plugins/platforms/photon/plugin.yaml
+++ b/plugins/platforms/photon/plugin.yaml
@@ -58,6 +58,10 @@ optional_env:
description: "Allow any sender to trigger the bot (dev only — disables allowlist)"
prompt: "Allow all users? (true/false)"
password: false
+ - name: PHOTON_READ_RECEIPTS
+ description: "Mark inbound iMessages read after forwarding to Hermes (true/false, default true)"
+ prompt: "Send read receipts? (true/false)"
+ password: false
- name: PHOTON_REQUIRE_MENTION
description: "Ignore group-chat messages unless they match a mention wake word (true/false, default false)"
prompt: "Require a mention in group chats?"
diff --git a/plugins/platforms/photon/sidecar/index.mjs b/plugins/platforms/photon/sidecar/index.mjs
index 4acb7de1394..1c68c666b03 100644
--- a/plugins/platforms/photon/sidecar/index.mjs
+++ b/plugins/platforms/photon/sidecar/index.mjs
@@ -601,7 +601,12 @@ async function normalizeContent(content) {
// the event has crossed the sidecar boundary: this means the gateway has
// actually received it, while a transient agent/tool delay does not leave the
// sender staring at Delivered. Receipt events themselves must never recurse.
+const readReceiptsEnabled =
+ (process.env.PHOTON_READ_RECEIPTS || "true").trim().toLowerCase() !==
+ "false";
+
async function acknowledgeInboundRead(message) {
+ if (!readReceiptsEnabled) return;
if (message?.content?.type === "read") return;
if (typeof message?.read !== "function") return;
try {
diff --git a/tests/plugins/platforms/photon/test_inbound.py b/tests/plugins/platforms/photon/test_inbound.py
index 3edb9557692..8987a8b428c 100644
--- a/tests/plugins/platforms/photon/test_inbound.py
+++ b/tests/plugins/platforms/photon/test_inbound.py
@@ -85,6 +85,25 @@ async def test_dispatch_read_receipt_does_not_wake_agent(
assert captured == []
+async def test_dispatch_read_receipt_alias_does_not_wake_agent(
+ monkeypatch: pytest.MonkeyPatch,
+) -> None:
+ """Some spectrum-ts streams label receipts ``read_receipt`` — same drop."""
+ adapter = _make_adapter(monkeypatch)
+ captured = _capture(adapter, monkeypatch)
+ receipt = _dm_event("", msg_id="spc-read-2")
+ receipt["content"] = {
+ "type": "read_receipt",
+ "targetMessageId": "bot-msg-2",
+ "targetDirection": "outbound",
+ }
+
+ await adapter._dispatch_inbound(receipt)
+
+ assert captured == []
+
+
# A real 1x1 transparent PNG (passes base.py's _looks_like_image magic check).
_PNG_1X1_B64 = (
"iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYPhf"
diff --git a/website/docs/reference/environment-variables.md b/website/docs/reference/environment-variables.md
index 11eaa30a155..dd8ef3bffbc 100644
--- a/website/docs/reference/environment-variables.md
+++ b/website/docs/reference/environment-variables.md
@@ -697,6 +697,7 @@ Connect Hermes to [Photon](https://photon.codes/) / Spectrum (iMessage and other
| `PHOTON_HOME_CHANNEL_NAME` | Human label for the home channel. |
| `PHOTON_MARKDOWN` | Send agent replies as markdown — iMessage renders it natively, other Spectrum platforms degrade to plain text (`true`/`false`, default `true`). |
| `PHOTON_REACTIONS` | Tapback 👀/👍/👎 on messages as processing status and route tapbacks on bot messages to the agent (`true`/`false`, default `false`). |
+| `PHOTON_READ_RECEIPTS` | Mark inbound iMessages read after forwarding to Hermes (`true`/`false`, default `true`). |
| `PHOTON_TELEMETRY` | Enable Spectrum SDK telemetry in the sidecar (`true`/`false`, default `false`; toggle with `hermes photon telemetry on|off`). |
| `PHOTON_SIDECAR_PORT` | Loopback port for the Node sidecar control + inbound channel (default `8789`). |
| `PHOTON_SIDECAR_AUTOSTART` | Spawn the Node sidecar on connect (`true`/`false`, default `true`). |
diff --git a/website/docs/user-guide/messaging/photon.md b/website/docs/user-guide/messaging/photon.md
index ee85f313e14..04e79d5d444 100644
--- a/website/docs/user-guide/messaging/photon.md
+++ b/website/docs/user-guide/messaging/photon.md
@@ -208,6 +208,11 @@ Common issues:
media.
- **Native polls are supported.** Hermes sends poll content through
spectrum-ts' `poll()` builder via the sidecar's `/send-poll` endpoint.
+- **Read receipts are supported.** The sidecar marks an inbound iMessage
+ read after forwarding it to Hermes, so the sender sees `Read` without
+ waiting for a model/tool turn. Inbound receipts for Hermes-sent messages
+ are consumed as presence telemetry and never create an agent turn. Set
+ `PHOTON_READ_RECEIPTS=false` to keep messages at `Delivered`.
- **Message effects are supported.** Hermes sends text with native iMessage
bubble/screen effects through spectrum-ts' iMessage `effect()` builder
via the sidecar's `/send-effect` endpoint.