mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-12-03 15:42:16 +00:00
Connects the Hermes gateway to X's end-to-end encrypted direct messages via the official X Chat API. All plaintext stays local: inbound encoded_event blobs are decrypted with the Chat XDK (chatxdk) and outbound replies are encrypted + signed before they reach X. - plugins/platforms/xchat/: adapter (polling inbound, encrypted send, typing, group mention gating, allowlist/pairing, cron standalone sender), async httpx API client with OAuth2 refresh-token rotation, Chat XDK crypto wrapper, and a resume-safe 'hermes xchat setup' CLI (token -> user id -> keygen -> rate-limit-aware key registration) - tools/lazy_deps.py + pyproject.toml: chatxdk lazy-install entry (platform.xchat) + xchat extra for packagers - hermes_cli/main.py: resolve a deferred bundled platform's CLI subcommand when invoked as 'hermes <platform>' — also fixes 'hermes photon' being unreachable since the lazy-load perf change (#54448) - docs: messaging guide, env-var reference, sidebar, platform tables - tests: 24 offline unit tests (dispatch, dedup, backlog seeding, KeyChange handling, mention gating, registry parity, crypto wrapper)
80 lines
3.7 KiB
YAML
80 lines
3.7 KiB
YAML
name: xchat-platform
|
|
label: X Chat (encrypted DMs)
|
|
kind: platform
|
|
version: 0.1.0
|
|
description: >
|
|
X Chat gateway adapter for Hermes Agent.
|
|
Connects the agent to X's end-to-end encrypted direct messages via the
|
|
official X Chat API. Message bodies are encrypted/decrypted locally with
|
|
the Chat XDK (chatxdk) — X only ever routes ciphertext. Inbound messages
|
|
arrive through a polling loop over the conversation-events endpoint;
|
|
outbound replies are encrypted, signed, and POSTed back.
|
|
|
|
One-time onboarding runs through `hermes xchat setup`: it stores the
|
|
OAuth2 user token, derives the bot's user id, generates + registers the
|
|
E2EE keypairs, and persists the private-key blob under
|
|
``~/.hermes/xchat/`` (mode 600).
|
|
author: NousResearch
|
|
requires_env:
|
|
- name: XCHAT_ACCESS_TOKEN
|
|
description: "OAuth2 user access token with dm.read, dm.write, users.read, tweet.read scopes (set by `hermes xchat setup`)"
|
|
prompt: "X OAuth2 user access token"
|
|
url: "https://developer.x.com/en/portal/dashboard"
|
|
password: true
|
|
optional_env:
|
|
- name: XCHAT_REFRESH_TOKEN
|
|
description: "OAuth2 refresh token — lets the adapter renew the ~2h access token automatically (requires XCHAT_CLIENT_ID)"
|
|
prompt: "X OAuth2 refresh token (or empty)"
|
|
password: true
|
|
- name: XCHAT_CLIENT_ID
|
|
description: "OAuth2 app client id — required for automatic token refresh"
|
|
prompt: "X app OAuth2 client id (or empty)"
|
|
password: false
|
|
- name: XCHAT_CLIENT_SECRET
|
|
description: "OAuth2 app client secret — only for confidential clients"
|
|
prompt: "X app OAuth2 client secret (or empty)"
|
|
password: true
|
|
- name: XCHAT_USER_ID
|
|
description: "The bot account's numeric X user id (derived automatically by `hermes xchat setup`)"
|
|
prompt: "Bot X user id (or empty to derive)"
|
|
password: false
|
|
- name: XCHAT_SIGNING_KEY_VERSION
|
|
description: "Registered public-key version for signing (written by `hermes xchat setup`)"
|
|
prompt: "Signing key version (default 1)"
|
|
password: false
|
|
- name: XCHAT_PRIVATE_KEYS_B64
|
|
description: "Base64 private-key blob from the Chat XDK export — overrides the blob file under ~/.hermes/xchat/"
|
|
prompt: "Private-key blob (or empty to use the blob file)"
|
|
password: true
|
|
- name: XCHAT_ALLOWED_USERS
|
|
description: "Comma-separated numeric X user ids allowed to talk to the bot"
|
|
prompt: "Allowed user ids (comma-separated)"
|
|
password: false
|
|
- name: XCHAT_ALLOW_ALL_USERS
|
|
description: "Allow any sender to trigger the bot (dev only — disables allowlist)"
|
|
prompt: "Allow all users? (true/false)"
|
|
password: false
|
|
- name: XCHAT_CONVERSATION_IDS
|
|
description: "Comma-separated conversation ids to poll (omit to auto-discover all conversations)"
|
|
prompt: "Pinned conversation ids (or empty)"
|
|
password: false
|
|
- name: XCHAT_POLL_INTERVAL
|
|
description: "Seconds between event polls per cycle (default 10)"
|
|
prompt: "Poll interval seconds (default 10)"
|
|
password: false
|
|
- name: XCHAT_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?"
|
|
password: false
|
|
- name: XCHAT_MENTION_PATTERNS
|
|
description: "Mention wake-word regexes for group chats (JSON list or comma/newline-separated; defaults to Hermes wake words)"
|
|
prompt: "Group mention patterns"
|
|
password: false
|
|
- name: XCHAT_HOME_CHANNEL
|
|
description: "Default X Chat target for cron / notification delivery: conversation id or bare numeric user id"
|
|
prompt: "Home conversation/user id (or empty)"
|
|
password: false
|
|
- name: XCHAT_HOME_CHANNEL_NAME
|
|
description: "Human label for the home channel (defaults to the id)"
|
|
prompt: "Home channel display name (or empty)"
|
|
password: false
|