Commit Graph

213 Commits

Author SHA1 Message Date
alt-glitch
c4635985a0 refactor(core): delete unreached send_message actions, clarify/session helpers and backend aliases
Removed. A search for callers by name, attribute and string (Python, TypeScript,
docs, the plugin API list and the frozen old-updater list) finds no supported
path that reaches any of them:
- tools/send_message_tool.py: _handle_list, _handle_react and the action
  dispatch in send_message_tool (every caller, including the external
  hermes-snooze plugin, passes action="send")
- tools/bot_failure_reasons.py: is_auto_retryable
- tools/clarify_gateway.py: _notify_cbs, _coerce_text_response,
  attempt_text_response_for_session, resolve_text_response_for_session
- tools/cronjob_tools.py: the unused task_id parameter of cronjob()
- tools/interrupt.py: is_thread_yield_requested
- toolsets.py: create_custom_toolset
- tools/tool_backend_helpers.py: prefers_gateway, REMOVED_BACKENDS,
  removed_backend_note, normalize_modal_mode (callers use coerce_modal_mode)
- hermes_cli/config_value_checks.py: _validate_web_backends (only read the
  always-empty REMOVED_BACKENDS map)

Tests that existed only for these symbols are deleted; tests that also
cover live behaviour now call the canonical live names
(attempt_text_response, _coerce_text_response_detailed, consume_yield).

The shared-bot route-gate tests that reached the gate through the deleted
react action now call _shared_bot_target_allowed directly, so the origin
rules (guild-only, thread-under-channel and user_id routes, Telegram topics,
the turn's sender in a shared channel) keep their coverage. The two error
hints and one comment that named send_message(action='list') now name
`hermes send --list`; the stale send_message row in the zh-Hans tools
reference goes.

Also:
- test_messaging_slash_command_fifo spies on clarify_gateway.attempt_text_response,
  the name gateway/run_inbound.py calls, so its [clarify] case can fail again
- send_message_tool: an action other than 'send' returns an error that names
  `hermes send --list` for listing targets
- multi-profile-gateways.md no longer says send_message sends reactions; the zh-Hans
  simplex.md and tools-reference.md match the English pages
2026-11-16 15:40:08 +05:30
Maciej Lisiewski
4554919b1c docs(photon): say when the mirrored .npmrc gate actually applies
npm ci from a lockfile never consults min-release-age; the mirrored
.npmrc only matters for the npm install fallback's fresh resolve.

Refs #134019

Co-authored-by: BearHuddleston <196404565+BearHuddleston@users.noreply.github.com>
2026-11-14 13:24:16 +01:00
Maciej Lisiewski
c0ef1ccba4 test(photon): pin the sidecar .npmrc mirror behaviourally; fix gate wording
Follow-up to the salvaged #134062 commit. Drop its repo-walking
structural test (banned shape per tests/AGENTS.md) and instead assert the
read-only-tree mirror actually carries .npmrc to where npm ci runs. The
.npmrc comments now say what the gate mirrors: the root .npmrc carries
only engine-strict; the 14-day floor lives in pnpm-workspace.yaml's
minimumReleaseAge, which npm never reads.

Fixes #134019
2026-11-14 13:24:16 +01:00
liuhao1024
203e533631 fix(security): give standalone npm packages their own release-age gate
npm reads project config only from the directory that owns the
package.json, so scripts/whatsapp-bridge and plugins/platforms/photon/
sidecar never inherited the root .npmrc's min-release-age=14 and their
lockfiles resolved without the cooldown - pinning versions published
days earlier (#134019).

The bridge holds WhatsApp session credentials, parses inbound messages
from arbitrary senders, and the gateway npm-installs exactly the locked
versions for every user (_ensure_bridge_deps), so the gate cannot be
applied user-side.

- add scripts/whatsapp-bridge/.npmrc and plugins/platforms/photon/
  sidecar/.npmrc with min-release-age=14, matching the root
- include .npmrc in the photon sidecar _MIRROR_FILES whitelist so the
  read-only-tree mirror keeps the gate where npm ci actually runs
- add a structural guard test: every directory with a package-lock.json
  must carry a .npmrc with the same floor
2026-11-14 13:24:16 +01:00
Maciej Lisiewski
62149277bb fix(gateway): salt hash_for_log per install; photon preview label to DEBUG
An unsalted sha256 prefix of a phone number or guessable email is
recoverable from a shared log by hashing candidates. Key the digest with
a 32-byte per-install salt (HERMES_HOME/log_hash_salt, 0600, created
atomically); fall back to a process-random salt so a log call never raises.

Refs #46006
2026-11-13 13:59:40 +01:00
Teknium
c8033b5516 fix(photon): a threaded-reply /stop never waits behind an earlier voice note's gate STT
Re-review P1 "Threaded stop/approve/deny waits behind gate STT": _on_inbound_line read the
escape-hatch command from the top-level content only, so a /stop sent as an iMessage threaded
reply ({type: reply, content: {type: text}}) queued behind the chat's pending gate transcription.
The lane choice now unwraps the reply once (_reply_inner), the same unwrap _gate_stt_chat uses.
2026-11-13 00:54:14 -08:00
Teknium
4d42fe9e22 fix(photon): a .caf voice note sent as octet-stream reaches STT like the voice it counts as
Delta review Should fix 3: an attachment named .caf with MIME application/octet-stream passed
_is_voice_payload and was cached as audio, but kept the generic MIME as its media type, so the
gate's audio filter dropped it (0 STT calls, note rejected). A voice payload's media type now
says audio (audio/x-caf for a .caf, audio/mp4 otherwise), so classification and STT input agree.
2026-11-13 00:54:14 -08:00
Teknium
3f348f4dce fix(gateway): a group control command never waits on an earlier voice note's gate STT
Bot finding "Voice checks delay control commands" (also the review's minor item 4): on
Photon and WhatsApp, a message in a chat whose earlier voice note was still at gate STT
queued behind it, so a same-group /stop or /deny waited for the STT. A slash command the
base adapter dispatches mid-run (should_bypass_active_session) now skips that wait;
ordinary messages keep their order. Telegram's per-chat update processor predates
this PR and is unchanged.
2026-11-13 00:54:14 -08:00
Teknium
db63b880e8 fix(photon): a speech-admitted envelope whose first item is a document still gets transcribed
Bot finding "Mixed messages lose spoken requests": _normalize_group_content keeps the
first attachment's type, and the runner never sends DOCUMENT audio to STT, so a group
envelope of a PDF then a voice note woke the bot without its transcript. A note the
spoken wake word admitted is dispatched as VOICE.
2026-11-13 00:54:14 -08:00
Teknium
77ba305179 fix(photon): a CAF voice-note attachment can wake the bot by its spoken wake word
Bot finding "CAF notes cannot wake Hermes": iMessage voice notes also arrive as
`attachment` payloads named .caf / audio/x-caf, which normalisation already treats as
voice but the gate did not. Both now read _is_voice_payload().
2026-11-13 00:54:14 -08:00
Teknium
0a9f77583b fix(photon): a voice note inside a group envelope reaches the spoken wake-word gate
Photon normalizes a `group` envelope holding a voice item, but the gate (and the
off-reader FIFO check) only recognised a top-level `voice` payload, so a spoken wake word
in a grouped message was dropped before STT. Both now use _carries_voice(); a typed
wake word in the envelope keeps the text path, only the envelope's audio is transcribed,
and a rejected envelope's other cached files are deleted with it.

Reported and first fixed by kvnloo (kvnloo/hermes-agent@86fc181e, review comment on
#153207); rebuilt on the current head.

Co-authored-by: Kevin Rajan <7121943+kvnloo@users.noreply.github.com>
2026-11-13 00:54:14 -08:00
Teknium
1ef99ae8d8 fix(gateway): the spoken wake-word gate transcribes in the routed profile, honours stt.enabled, keeps bridge files and never holds the inbound reader
Review findings on #153207 (Greptile):
- Wake checks use wrong profile: the gate's STT now runs inside the routed profile's runtime
  scope (runner._async_profile_scope_for_source), the scope the turn enters.
- Disabled STT still runs: stt.enabled: false in that profile skips gate transcription, so the
  local fallback never runs either.
- Rejected notes lose quoted audio: WhatsApp bridge-cached clips are never deleted on a
  rejection; the bridge's quotedMediaCache still points at them.
- One note delays every chat: Photon and WhatsApp run a group voice note that may transcribe
  (and anything after it in that chat) off their single reader, FIFO per chat, at most 4 gate
  transcriptions at once.
2026-11-13 00:54:14 -08:00
Teknium
0d32db6a72 fix(gateway): a spoken wake word can wake the bot from a group voice note
In a group with require_mention + mention_patterns, a captionless voice
note was dropped before speech-to-text ran: the mention gate only reads
text, and STT happens later in the runner, so saying the wake word could
never match (#102330). Typing it worked; saying it did not.

With the new opt-in `voice_mention_patterns: true`, a group voice note
that only a wake word could admit is transcribed at the gate and admitted
when the transcript matches. It is off by default because every
unaddressed voice note in the group would then go to the STT provider.

- One shared helper (gateway.platforms.helpers.spoken_mention_clips) and
  one transcriber (run_inbound_transcription.transcribe_one_clip, the
  runner's own per-clip STT + local fallback).
- Each gate takes a `spoken_mention` flag, so every other rule
  (allowed_chats, topics, exclusive mentions, bot loop breaker,
  free-response) still applies exactly as before.
- Wired on every adapter whose group gate reads mention_patterns from
  text and receives voice: Telegram (new telegram_voice_mention sibling),
  WhatsApp (Baileys), Photon and BlueBubbles.
- The turn reuses the gate's transcript by clip content (native admission
  re-captures the clip under a new path), so STT runs once per note. A
  note that does not match has its clip deleted.

Live on the Telegram stand-in with a real gateway and a local_command
STT: base drops the voice note (0 STT calls, no turn); head transcribes
once, admits it, and the model receives the spoken words. Non-matching
speech and the not-opted-in case stay dropped.

Based on #102369 by @astraltrekkin; not cherry-picked because its commits
conflict with current main on 5 files, and it turned the check on by
default.

Fixes #102330

Co-authored-by: astraltrekkin <164521089+rainbowgits@users.noreply.github.com>
2026-11-13 00:54:14 -08:00
Teknium
b00948a767 fix(cron): a report the standalone lane may have delivered is never queued for replay
Finding "lost-answer and partial standalone sends are queued for replay" (#153474 review).

The queue gate keyed on the ABSENCE of an uncertainty flag that only one Telegram path set, so a
rich-message timeout, a failure after chunk 1 landed, and every non-Telegram sender's plain error
dict (QQBot read timeout) were queued and the redelivery sweep posted the report a second time.

Inverted to positive proof: cron queues only when the standalone result carries an explicit
`retryable: True`, which a sender sets only when nothing reached the chat (no credential, a
refusal before any byte, or a connect/pool failure before the request left). Anything else,
including an exception escaping the sender that does not prove the request never left, is
treated as possibly delivered and not queued.

- gateway/platforms/_shared.py: `send_error(..., nothing_sent=True)` and `request_never_left()`
  (connect/pool failure classes, chained causes included).
- Telegram: `retryable` only when no chunk landed and the error is a refusal, flood wait or
  UNSENT; rich failures are never marked.
- QQBot, Discord, Slack, Teams: marked on missing credentials / pre-message token failures and
  connect failures before anything landed. Photon no longer forwards the sidecar's own
  retryable flag (it covers timeouts that may have delivered).
- `_send_chunks`: an error after a landed chunk drops `retryable`.
2026-11-12 01:49:28 -08:00
Maciej Lisiewski
b9621cd0b2 fix(deps): bump zod to 4.6.7
Moves the tests-js direct pin (which the root lock hoists for
@assistant-ui/react and eslint-plugin-react-hooks) and the photon
sidecar's transitive copy from 4.6.5 to 4.6.7, the newest 4.6 patch.
4.6.7 was published 2026-10-12, past the 14-day npm release-age gate.

Advisory: GHSA-mrhx-c7xc-m3w5
2026-11-03 21:06:29 +01:00
Maciej Lisiewski
e3085ec023 fix(deps): bump undici to 6.29.1 and 7.30.1
Moves the ui-tui direct pin and the root undici@^6/@^7 overrides, plus
the photon sidecar's direct pin and override, to the patched releases
in each line. Both were published 2026-10-15, past the 14-day npm
release-age gate.

Advisories: GHSA-2m5v-pch6-74hx, GHSA-4qv8-2p9j-2685,
GHSA-4w7w-5xrc-9h26, GHSA-55wc-3pg8-jfw6, GHSA-9fm3-97px-rjf6,
GHSA-f72v-6w45-q472, GHSA-qrxm-fqhp-jwvm, GHSA-xjj6-f33q-929c
2026-11-03 21:06:29 +01:00
Teknium
95d0629df4 fix(photon): a misshapen lines payload keeps the iMessage line lookup best-effort
The lookup moved before the opt-in wait and its except was narrowed; an
unexpected `lines` shape then raised AttributeError and aborted setup before
access was configured. Catch AttributeError/TypeError again, as main did.
2026-10-31 22:09:38 -07:00
Teknium
ce02e4686d fix(photon): photon status routing row gives up after 5 s on an unreachable API
The live opt-in row reused list_users' 30 s timeout, so a black-holed API stalled
`hermes photon status` (previously offline-only) for 30 s. Thread a timeout through
list_users/find_user_by_phone and use 5 s for the status row only.
2026-10-31 22:09:38 -07:00
Teknium
a97f13ff3f fix(photon): setup without a phone number ends on saved-not-live, not "complete"
routing_live defaulted to True, so skipping the phone prompt still printed
"Photon setup complete. Start the gateway" although nothing can route. Start from
False (only an opted-in number flips it) and give the no-phone path its own ending
naming the command that finishes setup.
2026-10-31 22:09:38 -07:00
Teknium
9bc94eb21d fix(photon): look up the iMessage line before the opt-in wait; skip the wait when there is none
A user row without assignedPhoneNumber started a 5-minute wait that told the user only
"text the line Photon assigns": the dedicated-line lookup ran after the wait. Look the
line up first; with still no line, skip the wait and say how to finish (text the line
once it shows up, then `hermes photon status`).
2026-10-31 22:09:38 -07:00
Teknium
d47a49d46c fix(photon): setup only says "complete" once the number can route; bound the opt-in wait
The opt-in step let setup end on "✓ Photon setup complete" even when the
wait timed out, was interrupted with Ctrl-C, or was skipped on a non-TTY
run, so the user was told to start the gateway for a number Photon still
refuses ("Target not allowed for this project").

- setup: when the number is not opted in, the closing line says the setup
  was saved but routing is NOT live, names the line to text, and points at
  `hermes photon status`; exit code stays 0 (config was written).
- wait_for_opted_in_user: add a wall-clock deadline next to the attempt
  cap, so slow list calls (30 s HTTP timeout each) cannot stretch the
  advertised 5-minute wait to half an hour.
2026-10-31 22:09:38 -07:00
Teknium
5d9b27cd23 feat(photon): gate setup success on iMessage opt-in via first message
Photon's delivery plane only routes numbers whose user row carries
meta.opt_in, and that flag is set server-side when the human sends ONE
message from their phone to the row's assignedPhoneNumber. A registered
row without it looks configured everywhere but never sends or receives:
outbound fails with 'Target not allowed for this project'. Client-supplied
meta is ignored on create, so the API cannot produce the flag.

- auth.py: user_opted_in(), find_routable_user() (an opted-in duplicate
  wins over list order; find_user_by_phone uses it, so setup re-runs and
  status refreshes reuse the routable row), wait_for_opted_in_user() poll
  (rides out transient list failures).
- cli.py setup step [4/5]: prints the assigned line to text and waits for
  the opt-in to land (Ctrl-C skips; non-TTY runs skip the wait).
- status: live 'routing' row (opted in / not opted in, with the line to
  text), emitted from auth.py like the credential summary.
2026-10-31 22:09:38 -07:00
emozilla
f413c2ee9a fix(secrets): delete old secret-store copies instead of moving them
The agent can write cache/ and runtime/, so a file there may be a link or a
forged record. Hermes now deletes a Bitwarden or 1Password cache in cache/, or
a Photon sidecar record in runtime/, on first use without reading it, and
reads and writes only the copy at the top of the profile home. All four stores
are regenerated on use.

- Remove utils.adopt_legacy_file and the paths built on it.
- home_data_layout: split SECRET_CACHE_STORES into SECRET_CACHE_FILES and
  LEGACY_SECRET_CACHE_PATHS.
- Backups leave out the four top-level names; the old slashed entries never
  matched a root entry.
- The dashboard Files API takes its hidden names from the shared list.
2026-10-30 13:46:07 -04:00
emozilla
2bed5b2258 fix(secrets): move secret caches and the Photon token to the profile home root
The Bitwarden and 1Password disk caches (bws_cache.json, bws_cache.enc.json,
op_cache.json) and the Photon sidecar runtime record (photon-sidecar.json) now
live directly in the profile home instead of cache/ and runtime/. A sandbox
that hides credential files by path can only hide them safely at the top of
the home: the agent can rename a folder it writes, such as cache/ or runtime/,
and read a hidden file below it at the new path.

The first read moves a copy from the old path with a rename, so the file keeps
its permissions. When both copies exist, Hermes removes the old one; when the
move fails, Hermes keeps reading and writing the old copy, so only one copy is
ever live. Clearing a cache or deleting the record removes both locations.

SECRET_CACHE_STORES in hermes_cli/home_data_layout.py lists these stores at
both locations, and every guard that keeps a list of credential stores uses
it: PROFILE_CREDENTIAL_PATHS (profile export and distribution), the file
tools' read and write denies, and the gateway's media-delivery deny. The
1Password cache was missing from all of them. The dashboard Files API blocks
the new basenames, backups leave the top-level stores out, and the flat-install
.gitignore ignores them.

A new test takes each store's path from its writer and checks that every guard
covers it at the current and the old location.
2026-10-29 22:21:46 -04:00
kshitijk4poor
6ff702ec0d chore(process): mark the agent/plugin detached spawns that are not owned children, with the reason
The detached-spawn check (scripts/check_detached_spawns.py, from the owned-child API) flags every
start_new_session outside spawn_owned. Five sites in this family are deliberately not owned. Each
now carries a `detached-spawn: ok — <why>` marker, so the check passes without a baseline entry:

- iron-proxy daemon: meant to outlive the CLI that started it; `hermes egress stop` ends it
  through the pidfile + nonce.
- google_meet bot: reached through files across turns and stopped by meet_leave (pid in
  .active.json).
- photon sidecar: exits on stdin EOF (PHOTON_SIDECAR_WATCH_STDIN). kill -9 probe with that exact
  watch block: 0 of 1 survived; the same probe with the watch off: 1 of 1 survived.
- ddgs search worker: awaited under a 30 s cap that kills its group. Blocked reading its request
  on a stdin pipe, it exits when the owner dies (kill -9 probe: 0 of 1 survived).
- secret_sources command helper: awaited under a hard timeout (default 3 s) that kills its group.

Comments only; no behaviour change.
2026-10-29 16:58:09 +05:30
Maciej Lisiewski
48217bc858 chore(deps): bump spectrum-ts to 12.10.1 (plugins/platforms/photon/sidecar)
spectrum-ts: 12.7.0 -> 12.10.1 (pins edited: 1; also: {'@opentelemetry/resources': "['2.10.0']->['2.12.0']", '@opentelemetry/sdk-trace': "['2.10.0']->['2.12.0']", '@opentelemetry/sdk-trace-base': "['2.10.0']->['2.12.0']", '@spectrum-ts/core': "['12.7.0']->['12.10.1']", '@spectrum-ts/imessage': "['12.7.0']->['12.10.1']", '@spectrum-ts/slack': "['12.7.0']->['12.10.1']", '@spectrum-ts/telegram': "['12.7.0']->['12.10.1']", '@spectrum-ts/terminal': "['12.7.0']->['12.10.1']", '@spectrum-ts/whatsapp-business': "['12.7.0']->['12.10.1']", 'es-module-lexer': "['2.3.2']->['3.0.3']", 'import-in-the-middle': "['3.3.3']->['3.5.2']"})
2026-10-23 22:00:12 +02:00
Maciej Lisiewski
9b53c4d2fb chore(deps): bump protobufjs to 8.8.0 (plugins/platforms/photon/sidecar)
protobufjs: 8.7.1 -> 8.8.0 (pins edited: 1; also: {})
2026-10-23 22:00:12 +02:00
Maciej Lisiewski
069f15795e chore(deps): bump @opentelemetry/otlp-transformer to 0.223.0 (plugins/platforms/photon/sidecar)
@opentelemetry/otlp-transformer: 0.218.0 -> 0.223.0 (pins edited: 1; also: {'@opentelemetry/resources': "['2.7.1']->['2.12.0']"})
2026-10-23 22:00:12 +02:00
Maciej Lisiewski
c88d3a492c chore(deps): bump @opentelemetry/otlp-exporter-base to 0.223.0 (plugins/platforms/photon/sidecar)
@opentelemetry/otlp-exporter-base: 0.218.0 -> 0.223.0 (pins edited: 1; also: {})
2026-10-23 22:00:12 +02:00
Maciej Lisiewski
85938b8b63 chore(deps): bump @opentelemetry/exporter-trace-otlp-http to 0.223.0 (plugins/platforms/photon/sidecar)
@opentelemetry/exporter-trace-otlp-http: 0.218.0 -> 0.223.0 (pins edited: 1; also: {'@opentelemetry/resources': "['2.7.1']->['2.12.0']"})
2026-10-23 22:00:12 +02:00
Maciej Lisiewski
bf02f6133d chore(deps): bump @opentelemetry/exporter-logs-otlp-http to 0.223.0 (plugins/platforms/photon/sidecar)
@opentelemetry/exporter-logs-otlp-http: 0.218.0 -> 0.223.0 (pins edited: 1; also: {})
2026-10-23 22:00:12 +02:00
Maciej Lisiewski
a42905d0e7 chore(deps): bump @opentelemetry/core to 2.12.0 (plugins/platforms/photon/sidecar)
@opentelemetry/core: 2.10.0 -> 2.12.0 (pins edited: 1; also: {})
2026-10-23 22:00:12 +02:00
Maciej Lisiewski
d0b2d6bb71 chore(deps): bump indirect npm dependencies within existing ranges (photon)
- @bufbuild/protobuf: 2.14.0 -> 2.16.0
- @opentelemetry/context-async-hooks: 2.10.0 -> 2.12.0
- @opentelemetry/sdk-metrics: 2.10.0 -> 2.12.0
- @photon-ai/advanced-imessage: 2.1.0 -> 2.2.0
- @photon-ai/otel: 3.7.0 -> 3.8.1
- cjs-module-lexer: 2.2.1 -> 2.3.0
- lru-cache: 11.5.2 -> 11.5.3
- marked: 18.0.11 -> 18.1.0
- zod: 4.5.4 -> 4.6.5
2026-10-23 22:00:12 +02:00
David Dudok de Wit
de526521ab fix(gateway): let a serial reader return once a busy burst input is held
Signal and IRC await handle_message before they read their next input.
A busy photo or queue-mode text was held for the burst window and the
call returned only after the durable commit, so the burst's next input
could arrive only once the burst had committed alone: two turns where
main merged one, and the reader stalled about 0.38 s per busy input.

An adapter now declares serial_receive_loop when it delivers a chat's
next input only after handle_message returns and returning triggers no
acknowledgement. For it, dispatch_busy_burst returns as soon as the
input is held, as main returned once the input was merged into the
pending slot. The burst still commits once and in order, and a failed
commit is logged. Every other adapter keeps commit-before-return.

The reader still never runs ahead of what it returned on:
- a command first waits until every earlier input of that reader has
  committed (/stop, /new and /reset drop their own chat's held burst),
  so /restart cannot close admission under a held input and /new
  cannot miss one still committing;
- a chat holds at most one uncommitted burst: the next one waits for
  that commit, as main's reader waited at its first commit.

Flagged: Signal, IRC, email, Matrix, Mattermost, ntfy, Photon, SimpleX,
WeCom, WhatsApp and Feishu. Buzz is left out: it saves its cursor only
after the call returns.

Refs #134889
Fixes #140538

(cherry picked from commit e72e05a1e6e415ff54426b205dcc6b6f408417cf)
2026-10-18 03:15:07 -07:00
Teknium
28e4da48fe refactor(dashboard): channel cards and env-value checks read the plugin's PlatformEntry
The Channels page catalog (_PLATFORM_OVERRIDES) and the PUT env-value validators
(_ENV_VALUE_RULES) duplicated per-platform data the bundled platform plugins can
declare. Each plugin now declares its card on its PlatformEntry (new dashboard
block: dashboard_label, dashboard_description, docs_url, dashboard_env_vars,
dashboard_required_env, env_value_rules); core keeps static rows only for the
core-only platforms (api_server, webhook, msgraph_webhook, relay).

Telegram/Slack validators move into their plugins. The PUT route resolves the
rules right after _require_platform (catalog build already materialized every
entry, so nothing extra is imported) and before entering _profile_scope, where
the registry's profile overlay may not hold the entry.

Adapters over their size cap (discord, feishu, matrix, slack, telegram) keep the
card in a sibling dashboard_card.py, imported relatively so no second canonical
copy of the adapter module loads; surplus blank lines offset the two added lines.

Behaviour identity: differential oracle over the real route handlers (GET
/api/messaging/platforms root + profile, PUT valid/invalid per rule root +
profile) is byte-identical to base.
2026-10-16 19:42:34 -07:00
Teknium
e24f12c69f refactor(send): read send_message target syntax and standalone routing from the plugin registry
Delete the per-platform tables in tools/send_message_targets.py (_PLATFORM_PARSERS, 14 rows) and
tools/send_message_tool.py (_PLUGIN_STANDALONE_MEDIA, _TEXT_SENDERS, plus the discord-always and
whatsapp-mentions ladders). Each bundled plugin now declares them on its PlatformEntry:

- target_ref_syntax_fn: the old parser, body unchanged. A new field rather than parse_target_ref_fn
  because that field is an authority (strict under pass_unresolved_references, no "not explicit"
  sentinel, not re-applied to channel-directory hits) and reusing it would change react/cron
  behaviour for ntfy/buzz/photon.
- standalone_send: StandaloneSendPolicy (label, media, all_sends, captionable,
  empty_list_between_chunks, forward_force_document, mentions, text_direct).

Shared builders and the NOT_EXPLICIT sentinel live in gateway/platforms/send_targets.py so plugins
import no core-private helpers. Lookups discover plugins first when the name is not registered yet
(fresh CLI/cron process). Differential oracle (33 platforms x 48 refs, 10 send cases each): base and
head output identical.
2026-10-16 19:42:34 -07:00
Teknium
3d21ec1294 refactor(platforms): plugin PlatformEntry carries its prompt hint and display defaults
PLATFORM_HINTS (agent/prompt_builder.py) and _PLATFORM_DEFAULTS (gateway/display_config.py)
duplicated per-platform data for every bundled messaging plugin. Both consumers already fell
back to the registry (PlatformEntry.platform_hint / display_tier), so the plugin rows move onto
each plugin's register() call and the core tables keep only core surfaces (cron, cli, tui,
desktop, api_server hints; webhook, api_server display rows).

New PlatformEntry field display_overrides: per-key defaults layered over display_tier (telegram,
discord, slack, wecom had tier + tweaks). Hint text is copied byte-for-byte (the shared
_MEDIA_NATIVE fragment is inlined); a base-vs-head oracle of platform_hint() and
resolve_display_setting()/resolve_tool_progress() for every platform, with and without user
display overrides, is byte-identical. Oversize adapters keep the hint in adapter_hint.py.
2026-10-16 19:42:34 -07:00
Maciej Lisiewski
428f2e0202 fix(deps): bump @grpc/grpc-js 1.14.4 → 1.14.6 in photon sidecar (high, GHSA-482/481)
Latest 1.14.x release older than 3 days; clears the 1.14.5 floor.
2026-10-16 17:26:41 +02:00
Maciej Lisiewski
4bcf60191a fix(deps): bump undici 7.29.0 → 7.30.0 in photon sidecar (high, GHSA undici alerts)
7.30.1 is < 3 days old, so pin the override at 7.30.0 — the latest
release older than 3 days that clears the 7.29.1 floor.
2026-10-16 17:26:35 +02:00
Maciej Lisiewski
c57fbf4584 ci: fix remaining ASYNCXXX linter errors 2026-10-10 15:20:14 +02:00
Maciej Lisiewski
bda3aea496 ci: remove unused variables (linter) 2026-10-10 15:20:14 +02:00
Maciej Lisiewski
2ff58849f4 ci: ruff UP037 fixes 2026-10-09 17:34:38 +02:00
Maciej Lisiewski
9eab688b42 ci: ruff UP017 fixes 2026-10-09 17:34:36 +02:00
Maciej Lisiewski
32b70e9733 ci: FURB188, FURB192 linter fixes 2026-10-09 17:31:52 +02:00
Maciej Lisiewski
d76cce4f11 ci: apply all automatic linter fixes available 2026-10-08 17:22:54 +02:00
kshitijk4poor
149f39fc9f fix(photon): log the sent-text lookup failure instead of swallowing it
The code-health ratchet (BLE001) rejects a blind except Exception that
neither re-raises nor logs the traceback. The record path already logs
at debug with exc_info; give the lookup path the same.
2026-10-07 13:18:15 +05:30
kshitijk4poor
cb71296ebd fix(photon): a threaded reply to our bubble stays "own" after a restart
Cloud spectrum targets carry no direction and _sent_message_ids is
in-memory, so after a gateway restart a swipe-reply to one of our
bubbles hydrated the quoted text from the sent-text index but was
marked as not ours: the agent saw [Replying to: "..."] instead of
[Replying to your previous message: "..."]. Only our sends are indexed,
so an index hit is itself proof the target was ours.
2026-10-07 13:18:15 +05:30
David Uche
aba1f72ef2 fix(photon): record sent text at the _post_send choke point
Polls (clarify), the plain-text fallback resend and standalone attachment
sends reached the sidecar without recording what they sent, so a threaded
reply to those bubbles lost its quoted context. Record once in _post_send
(plus the standalone attachment leg, which has its own HTTP client) and
reuse _normalize_chat_key instead of a duplicate regex.
2026-10-07 13:18:15 +05:30
David Uche
348a68bb4e fix(photon): keep the user's words when they reply in an iMessage thread (#100663)
spectrum-ts 12.x delivers a threaded (swipe) reply as
{type: 'reply', content, target}. The sidecar had no branch for it, so
the agent received '[Photon content type not handled: reply]' and the
message text was lost.

- sidecar: normalize 'reply' to its inner content plus the target's id,
  direction and text
- adapter: unwrap it and set reply_to_message_id / reply_to_text /
  reply_to_is_own_message on the MessageEvent
- adapter: record outbound text (send, attachments, standalone send) in
  gateway.rich_sent_store and use it when spectrum can't hydrate the
  quoted text, which is the usual case for our own bubbles. DM GUIDs
  and bare E.164 share one key.
2026-10-07 13:18:15 +05:30
alt-glitch
1b8bd66b7f fix(lint): stdin guard catches calls whose arguments start on the next line (review)
Greptile 4198572811: the guard now finds subprocess/os/asyncio calls as ast.Call nodes, so multi-line calls are checked, and the 27 calls it newly flagged (pixel-art ffmpeg and 26 others) pass stdin=DEVNULL.
2026-10-07 01:03:03 +05:30