From f58da7c156d2a0fc430704d7c1cb7e80385a45db Mon Sep 17 00:00:00 2001 From: Teknium <127238744+teknium1@users.noreply.github.com> Date: Wed, 2 Sep 2026 22:32:44 -0700 Subject: [PATCH] refactor(sms,google_chat): compact module docstrings (env tables kept) --- plugins/platforms/google_chat/oauth.py | 23 +++++++---------------- plugins/platforms/sms/adapter.py | 25 ++++++++----------------- 2 files changed, 15 insertions(+), 33 deletions(-) diff --git a/plugins/platforms/google_chat/oauth.py b/plugins/platforms/google_chat/oauth.py index 58530995db..4265069a11 100644 --- a/plugins/platforms/google_chat/oauth.py +++ b/plugins/platforms/google_chat/oauth.py @@ -1,22 +1,13 @@ """User OAuth helper for the Google Chat gateway adapter. Google Chat's ``media.upload`` rejects service-account auth, so for native file -attachments each user grants the bot ``chat.messages.create`` ONCE in their own -DM; the bot stores per-user refresh tokens and uploads *as the user* -(https://developers.google.com/chat/api/guides/auth/users). - -Library: load_user_credentials(email=None), refresh_or_none(creds, email=None), -build_user_chat_service(creds), list_authorized_emails(). -CLI (driven by ``/setup-files``): --check | --client-secret PATH | --auth-url | ---auth-code CODE | --revoke | --install-deps [--email EMAIL] (legacy single-user -mode when --email is omitted). - -Token storage layout (all under ``${HERMES_HOME}``): -- Per-user tokens: ``google_chat_user_tokens/.json`` -- Legacy single-user: ``google_chat_user_token.json`` -- Per-user pending PKCE: ``google_chat_user_oauth_pending/.json`` -- Legacy pending state: ``google_chat_user_oauth_pending.json`` -- OAuth client secret: ``google_chat_user_client_secret.json`` +attachments each user grants the bot ``chat.messages.create`` ONCE in their own DM; +the bot stores per-user refresh tokens and uploads *as the user* +(https://developers.google.com/chat/api/guides/auth/users). Library API for the +adapter plus a CLI driven by ``/setup-files`` (``--help``; ``--email`` omitted == +legacy single-user mode). Files under ``${HERMES_HOME}``: ``google_chat_user_tokens/ +.json`` (per-user) / ``google_chat_user_token.json`` (legacy); pending PKCE state +in ``google_chat_user_oauth_pending[/].json``; ``google_chat_user_client_secret.json``. """ from __future__ import annotations diff --git a/plugins/platforms/sms/adapter.py b/plugins/platforms/sms/adapter.py index fb8e42cfa6..ba94db17d6 100644 --- a/plugins/platforms/sms/adapter.py +++ b/plugins/platforms/sms/adapter.py @@ -2,19 +2,11 @@ Outbound SMS via the Twilio REST API; inbound via an aiohttp webhook server. -Shares credentials with the optional telephony skill — same env vars: - - TWILIO_ACCOUNT_SID - - TWILIO_AUTH_TOKEN - - TWILIO_PHONE_NUMBER (E.164 from-number, e.g. +15551234567) - -Gateway-specific env vars: - - SMS_WEBHOOK_PORT (default 8080) - - SMS_WEBHOOK_HOST (default 127.0.0.1) - - SMS_WEBHOOK_URL (public URL for Twilio signature validation — required) - - SMS_INSECURE_NO_SIGNATURE (true to disable signature validation — dev only) - - SMS_ALLOWED_USERS (comma-separated E.164 phone numbers) - - SMS_ALLOW_ALL_USERS (true/false) - - SMS_HOME_CHANNEL (phone number for cron delivery) +Env vars — shared with the telephony skill: TWILIO_ACCOUNT_SID, TWILIO_AUTH_TOKEN, +TWILIO_PHONE_NUMBER (E.164 from-number). Gateway-specific: SMS_WEBHOOK_PORT (8080), +SMS_WEBHOOK_HOST (127.0.0.1), SMS_WEBHOOK_URL (public URL for Twilio signature +validation — required), SMS_INSECURE_NO_SIGNATURE (true disables validation — dev only), +SMS_ALLOWED_USERS (comma-separated E.164), SMS_ALLOW_ALL_USERS, SMS_HOME_CHANNEL (cron). """ import asyncio @@ -284,11 +276,10 @@ class SmsAdapter(BasePlatformAdapter): return _twiml_response() -# -- Plugin registration ----------------------------------------------------- -# TWILIO_* env→PlatformConfig seeding stays in core (gateway/config.py). +# -- Plugin registration (TWILIO_* env→PlatformConfig seeding stays in gateway/config.py) -# Standalone-send markdown stripping (looser than helpers.strip_markdown: no -# word-boundary guards on underscores, ``[a-z]*`` fence tags — kept for parity). +# Standalone-send markdown stripping: looser than helpers.strip_markdown (no +# word-boundary guards on underscores, ``[a-z]*`` fence tags) — kept for parity. _SMS_MARKDOWN_SUBS = ( (re.compile(r"\*\*(.+?)\*\*", re.DOTALL), r"\1"), (re.compile(r"\*(.+?)\*", re.DOTALL), r"\1"),