Repository navigation
Conversation
…or watched entities Ports the deliver/session-mode feature to the standalone plugin. Two closed core PRs carried this work and are embedded here: #96930 (configurable deliver target for watch_entities/watch_domains, DavidMetcalfe) and #112136 (session-mode delivery integrated on top, with silent-session markers and identifier hardening). Both were closed as no-longer-applicable when Home Assistant left hermes-agent core in #132469 and the bundled adapter moved to this standalone plugin (the plugin's adapter predates both). - deliver: per-entity/domain cross-platform target override (tag grammar ha_events:<platform>[;session]); default target configurable - deliver_mode: broadcast (default) or session — session injects the EVENT into the target chat's session via admit_internal_event (one agent turn inside that chat's history) instead of broadcast-shipping the reply - never-mint invariant: derived keys must match an existing session (lookup, never get_or_create); unresolvable chat shapes fail closed - chat-type resolution: persisted chat_type -> platform chat-id formats -> None (fail closed) - injection budget: per-CHAT rolling-window cap, slot spent only on admission - canonical silence-marker strip + untrusted-data framing on injected payloads - fail-safe broadcast routing: private core APIs used only inside guarded blocks; any incompatibility degrades to the HA notification - backport #71206 (_connect_error_detail) + NOTIFICATION_TITLE from the plugin extraction - tests/test_homeassistant_adapter_ported.py: the full adapter suite (82 tests) ported to the plugin layout (homeassistant_plugin imports); mutation-verified: never-mint, budget, and marker-strip mutations each flip specific tests to failed - README documents deliver/deliver_mode and the dict-form watch entries Co-authored-by: DavidMetcalfe <80915+DavidMetcalfe@users.noreply.github.com>
The ported suite asserts PlatformConfig.token == "env-token", but that credential propagation row left core with the Home Assistant extraction (NousResearch/hermes-agent#132469). The plugin's adapter reads the token from the environment itself, so assert it at the layer that owns it now. Platform and extra["url"] assertions are unchanged. No production code changes.
|
Thanks for the salvage — both commits carried over cleanly, authorship intact. CI note for reviewers: 63/64 checks pass on On the private-API flag: that's the right call to surface. On a live install the wrapped calls degrade to the HA notification, so a core rename ( I can also run this branch against a real config (watch entities + #199 and #5 can be closed from my side whenever you merge; say the word. Prepared with AI assistance (Hermes agent), reviewed by the account owner. |
|
To keep the pending decision concrete, here is the only part of this PR that is a policy question rather than a code question — the flag already named in the description. The routing path calls six symbols that are not plugin-facing surface:
So the decision I can see is: does a first-party plugin get to depend on gateway internals, and if so which shape?
My recommendation is A now, B as the follow-up: A is a documentation/compat decision that does not block this merge, and it is reversible; B needs its own core PR and should not gate a feature that already runs in production. Two clarifications that may or may not be what the label is tracking:
If the label is tracking something else about this feature (product scope, delivery semantics, session injection as a capability), say which and I will answer it directly instead of guessing. Prepared with AI assistance (Hermes agent), reviewed by the account owner. |
|
Heads-up on the conflict: #447 merges Merge #447 here and this PR becomes mergeable with the fixes already inside. Suite on that tree: 323 passed, 2 skipped, zero failures; AST parity with If you would rather rebase yourself, that is fine too — the resolution above is the whole of it, and #440 can be re-pointed afterwards. Prepared with AI assistance (Hermes agent), reviewed by the account owner. |
…er uses is missing Cross-platform deliver and deliver_mode: session call six gateway internals that are not in the published plugin API (_authorization_adapter, admit_internal_event, _profile_runtime_scope, build_session_key, SessionStore.lookup_by_session_key, LIVE_GATEWAY_SILENT_MARKERS). Each call already falls back to the HA notification, so a core rename read as deliver quietly stopping. connect() now checks them once per process, only when a deliver target other than homeassistant is configured, and logs one warning naming every missing symbol and the fallback. Suggested by @Bendak on #433.
Salvage of #199 by @Bendak (itself the community re-submission of #5, the port of NousResearch/hermes-homeassistant#2), rebased onto current
main. Both of Bendak's commits cherry-picked, authorship kept.Adds, for watched entities/domains:
deliver(per entity/domain + top-level default): route a state-change alert to another platform's home channel (tagha_events:<platform>[;session]).deliver_mode: session: inject the event into that chat's existing session (never mints one; unmatched → broadcast), with a silence contract and a per-chat rolling injection budget.Rebase notes: only conflicts were next to main's newer
ws_heartbeat_seconds(adapter__init__+ README table); both kept, the duplicate_last_event_timeinit dropped. #199 vs #5: identical adapter/README; #199 adds the HASS_TOKEN test fix from #194.Tests:
test_homeassistant_adapter_ported.pyover main's adapter: 51 failed / 31 passed; here: homeassistant suite 296 passed, 2 skipped.Review flag: the routing reaches gateway internals not in
plugin_api.json(gateway_runner._authorization_adapter,gateway.wake.admit_internal_event,gateway.run._profile_runtime_scope,gateway.session.build_session_key). Each call is wrapped to degrade to the HA notification if core changes, but it is a private-API dependency.Supersedes #199 and #5.