OSS Telegram connector for the Terrene Delegate substrate (kailash.delegate).
Reason this release was yanked:
re-architect to plugins
Project description
delegate-connector-telegram
An OSS Python connector for the Terrene Delegate substrate. Implements the
shipped kailash.delegate.Connector ABC (kailash 2.26.2) for Telegram via the
Bot API. It mirrors the email connector's shape and differs only in transport
(HTTP-only Bot API) and identity model (integer user_id / chat_id).
The connector contract (the shipped ABC — authenticate / read / write / invoke
plus the auth_verifier / ledger / revocation trust properties) is:
write—actionis a thunk wrapping a Bot APIsendMessagePOST, executed under audit, returning a realSignedActionEnvelope. The send is the auditable external side-effect.read—queryis a thunk wrapping a Bot APIgetUpdateslong-poll fetch, executed under audit, returning(updates, AttestedReadReceipt).authenticate— resolves the dispatch identity'sdelegate_idto aPrincipalagainst a dual-keyed resolver (by stringified integeruser_idandchat_id). An unknown identity resolves toReject(fail-closed); a@usernamehandle is never a resolution key (ref-unsafe and mutable).invoke— single-method dispatch entry: authenticate FIRST (fail-closed, before any Bot API call), then dispatch a send, returning aConnectorInvocationResult(external_side_effect=True).- Trust properties —
auth_verifierreturns the wiredEd25519Verifier;ledger/revocationreturn shipped concretes (framework-first; no custom trust primitives).
It subclasses Connector directly (ADR-1) — NOT LegacyInvokeConnector,
whose proxied read / write emit empty, unverifiable receipts. There is no
stale connect() / identify() / normalize() surface; those methods do not exist
in the shipped ABC.
Components
transport.py— thehttpx-backed Bot API transport (sendMessageoutbound +getUpdatesinbound long-poll). A Bot API429raises a typedRateLimitedErrorcarryingretry_after; the caller decides backoff.connector.py— theTelegramConnectoritself (the four ABC members + the three trust properties) plus theverify_action_envelope/verify_read_receipthelpers that re-derive identity-bound signing bytes.directory.py— the dual-keyed principal resolver + the closed-enumUnknownSenderDisposition(unknown sender →Reject).validation.py— pure message-content validation (control-character reject,text≤ 4096 UTF-16 code units,chat_idshape), invoked at theOutboundMessageconstruction boundary so every send route is covered.compose.py—build_telegram_runtime, which composes a realDelegateRuntimearound the connector with the shipped trust / audit / verifier concretes (no mocks).
Install
pip install -e connectors/telegram
Configure
All credentials come from the environment (see .env.example):
TELEGRAM_BOT_TOKEN and TELEGRAM_API_BASE. Nothing is hardcoded; nothing is
logged. The token is part of the request URL, so the transport logs the method +
chat, never the URL.
Test
pip install -e "connectors/telegram[test]"
# Tier 1 (unit)
python -m pytest connectors/telegram/tests/unit -q
# Tier 2/3 (integration — REAL TelegramTransport over a REAL httpx.AsyncClient
# whose byte stream terminates at an in-process protocol-faithful Bot API
# double; NO mock at the connector boundary, so these RUN in CI)
python -m pytest connectors/telegram/tests/integration -q
# Conformance (canonical conformance vector set)
python -m pytest connectors/telegram/tests/conformance -q
# Regression (behavioral security-property guards; NEVER deleted)
python -m pytest connectors/telegram/tests/regression -q
The opt-in Tier-3 live test (test_live_telegram) skips with a clear "cannot
execute" reason unless real TELEGRAM_* credentials are present — it never falls
back to a mock. The end-to-end runtime.execute() outcome assertions are
strict-xfail gated on an SDK fix (kailash-py#1182); the connector's own
read / write receipts verify today.
License
Apache 2.0. All open-source IP is owned by the Terrene Foundation.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file delegate_connector_telegram-0.1.0.tar.gz.
File metadata
- Download URL: delegate_connector_telegram-0.1.0.tar.gz
- Upload date:
- Size: 57.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5b5952440d6ea7c2036a07b6aadda8c6ab86e9ea9620c6d42d267e5aacf548b3
|
|
| MD5 |
bfbd5288135f6c3ca15467fb1a80740e
|
|
| BLAKE2b-256 |
563c2d196ce53f6037d3989880db9349593f86b00af84c241df8c250599f27c7
|
File details
Details for the file delegate_connector_telegram-0.1.0-py3-none-any.whl.
File metadata
- Download URL: delegate_connector_telegram-0.1.0-py3-none-any.whl
- Upload date:
- Size: 29.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6d587b8334076785163bb821d5a2e8dadf2abedd8603067eb9d3a1f994f6e325
|
|
| MD5 |
d83cb2da2829f5ba35f15831d4ae35b6
|
|
| BLAKE2b-256 |
4e34620dd1bfd50e0e47c7ee9a7ccd4657dbb4706468ce9085b63fe22e0d7f7e
|