Skip to content

fix(photon): migrate user API to Spectrum backend + send-path & status follow-ups - #42615

Merged
teknium1 merged 6 commits into
mainfrom
hermes/hermes-4614d221
Jun 9, 2026
Merged

teknium1 merged 6 commits into
mainfrom
hermes/hermes-4614d221

Conversation

@teknium1

@teknium1 teknium1 commented Jun 9, 2026

Copy link
Copy Markdown
Collaborator

Summary

Salvage of #42602 (@underthestars-zhy) onto current main. Moves the Photon plugin's user/management API off the Dashboard API (Bearer) and onto the Spectrum API (Basic auth with project credentials), which is the correct backend for user management, plus four follow-ups on the send path and status command.

Changes (plugin-only — plugins/platforms/photon/)

  • Spectrum user API migrationlist_users, find_user_by_phone, create_user, register_user_if_absent, refresh_user_numbers now hit {spectrum_host}/projects/{id}/users/ with Basic auth; new _spectrum_host() / _basic() / _raise_for_status() helpers; nested data.users envelope unwrap; create_user sends type: shared. New PHOTON_SPECTRUM_HOST env var (default https://spectrum.photon.codes). — auth.py, cli.py, plugin.yaml
  • Send path — outbound text passed through strip_markdown() so iMessage renders plain text; _send_with_retry() adds exponential backoff + plain-text fallback. — adapter.py
  • Group flatteningoptions: { flattenGroups: true } in the sidecar Spectrum config. — sidecar/index.mjs
  • Statussetup persists operator phone / assigned iMessage line / user id; hermes photon status surfaces and auto-refreshes them. — cli.py, auth.py
  • Voice messages — sidecar + adapter handle voice content (base64 inline, MessageType.VOICE, optional duration fallback marker). — adapter.py, sidecar/index.mjs
  • SDK bumpspectrum-ts^1.18.0; setup runs npm install spectrum-ts@latest. — sidecar/package.json, lockfile
  • Docs: plugin README + website/docs/user-guide/messaging/photon.md.

Validation

Result
tests/plugins/platforms/photon/ + send_message suites 200 passed
Scope plugin + tests + docs only, no core touches

All 6 commits cherry-picked with @underthestars-zhy's authorship preserved. Closes #42602.

Infographic

spectrum-migration

Store operator and assigned iMessage numbers in `auth.json` after
setup, and surface them in `hermes photon status`. When numbers are
missing, status auto-refreshes from the dashboard without provisioning
new lines.
Switch `list_users`, `find_user_by_phone`, `create_user`,
`register_user_if_absent`, and `refresh_user_numbers` from the
Dashboard API (Bearer token) to the Spectrum API (Basic auth with
project credentials). Update response unwrapping to handle the nested
`data.users` envelope returned by Spectrum, add `_spectrum_host()`
resolver, `_basic()` header helper, and structured error helpers.
Update tests, docs, and plugin.yaml accordingly.
Extend the sidecar and Python adapter to handle `voice` content
alongside `attachment`. Voice notes are inlined as base64 (same
size-cap logic), surfaced as `MessageType.VOICE`, and include an
optional `duration` field in fallback markers when bytes are
unavailable.
@teknium1
teknium1 requested a review from a team June 9, 2026 05:18
@github-actions

github-actions Bot commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

🔎 Lint report: hermes/hermes-4614d221 vs origin/main

ruff

Total: 0 on HEAD, 0 on base (➖ 0)

🆕 New issues: none

✅ Fixed issues: none

Unchanged: 0 pre-existing issues carried over.

ty (type checker)

Total: 10569 on HEAD, 10569 on base (➖ 0)

🆕 New issues: none

✅ Fixed issues: none

Unchanged: 5557 pre-existing issues carried over.

Diagnostics are surfaced as warnings — this check never fails the build.

@teknium1
teknium1 merged commit dbf2470 into main Jun 9, 2026
24 checks passed
@teknium1
teknium1 deleted the hermes/hermes-4614d221 branch June 9, 2026 05:53
@alt-glitch alt-glitch added type/bug Something isn't working P3 Low — cosmetic, nice to have comp/plugins Plugin system and bundled plugins platform/email Email (IMAP/SMTP) adapter labels Jun 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/plugins Plugin system and bundled plugins P3 Low — cosmetic, nice to have platform/email Email (IMAP/SMTP) adapter type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants