hermes-agent/plugins/platforms/photon/sidecar
Teknium 87fe75fde4 test(photon): replace source-grep URL-routing tests with behavior tests
Follow-up to the URL markdown fix: extract the /send builder decision into
sidecar/send-format.mjs and rewrite test_url_send_path.py to execute the real
module under node (format+text in -> chosen builder out) instead of regex-
grepping index.mjs source, which is a banned test pattern in this repo.
2026-07-28 22:22:42 -07:00
..
.gitignore fix(photon): surface npm install failures in check_requirements() diagnostic chain 2026-07-28 18:20:06 -07:00
index.mjs test(photon): replace source-grep URL-routing tests with behavior tests 2026-07-28 22:22:42 -07:00
package-lock.json fix(photon): upgrade spectrum-ts sidecar to v8.0.0 2026-06-27 00:51:34 -07:00
package.json fix(photon): upgrade spectrum-ts sidecar to v8.0.0 2026-06-27 00:51:34 -07:00
patch-spectrum-mixed-attachments.mjs feat(photon): upgrade spectrum-ts sidecar to v7.0.0 2026-06-27 00:51:34 -07:00
README.md feat(photon): support rich link previews 2026-07-28 22:10:57 -07:00
send-format.mjs test(photon): replace source-grep URL-routing tests with behavior tests 2026-07-28 22:22:42 -07:00

Photon sidecar

Small Node helper that bridges Hermes Agent to Photon's Spectrum SDK (spectrum-ts). Hermes is Python; Photon has no public HTTP send-message endpoint today; replies therefore go through this sidecar.

The sidecar:

  • runs Spectrum({ projectId, projectSecret, providers: [imessage.config()] })
  • exposes a loopback-only HTTP control channel for the Python adapter to push send/typing requests (auth via X-Hermes-Sidecar-Token)
  • drains the inbound message stream so spectrum-ts keeps its reconnect/heartbeat machinery alive and Hermes can receive inbound messages over the adapter's loopback GET /inbound stream

Install

cd plugins/platforms/photon/sidecar
npm install

The Hermes plugin's hermes photon setup command runs npm install here automatically.

Run standalone

For debugging:

PHOTON_PROJECT_ID=... PHOTON_PROJECT_SECRET=... \
PHOTON_SIDECAR_PORT=8789 PHOTON_SIDECAR_TOKEN=$(openssl rand -hex 16) \
node index.mjs

In normal use, the Python adapter supervises this process — start, restart on crash, kill on shutdown — and never asks the user to run it by hand.

Why a sidecar at all?

Photon's Spectrum send path is exposed through the TypeScript SDK's Space.send(...) API. Hermes is Python, so replies go through this sidecar until Photon ships a public HTTP send endpoint.

When Photon ships an HTTP send endpoint, the plan is to retire this sidecar entirely and call it directly from Python. The plugin's outbound code path is already isolated behind small helpers (_sidecar_send, _sidecar_send_richlink, and _sidecar_send_attachment in adapter.py) to make that swap localized.