replica-omnisciente/telminal/telminal/__init__.py
Aurelio 8f36dce783
Some checks failed
Aurélio Sync & Conscience Upgrade / Upgrade Réplica Conscience (push) Has been cancelled
feat(telminal): add hardened Terminal-in-Telegram bot to aurelio
Port fristhon/telminal (MIT) into the aurelio monorepo as a self-hosted
Telegram shell bot for the fleet gateway (CT-217).

- telminal/ package: config (env + state file, refuses empty admins),
  core orchestrator (event handlers, router, watchers, interactive mode,
  file up/download, xterm.js image render), process (pexpect PTY + streaming
  + inline control buttons), telegram (Telethon wrapper, swappable for tests),
  cli (entry point reading TELEGRAM_* env), utils, values.
- aurelio hardening vs upstream: no first-run random token auth (explicit
  admin allowlist required); cd sandbox validated against working root;
  secrets from env mirroring the CT-217 gateway .env.
- 35 real tests (pty capture/control-char, router, watchers, perms, sandbox,
  fake-client orchestration) -- all green.
- deployment: systemd/telminal.service, .env.example entries, README, AGENTS.md.

Verified: pytest 35 passed; CLI refuses start with missing env / no admins.
2026-07-15 23:41:44 +01:00

29 lines
1.2 KiB
Python

"""telminal — A Terminal in Telegram, hardened for the aurelio/Portugal Futurista fleet.
This is a clean re-implementation of fristhon/telminal (MIT) ported into the
aurelio monorepo. It keeps the original feature set (PTY shell, streaming output
with inline control buttons, interactive mode, file up/download, watcher tasks,
optional xterm.js image rendering) while adopting aurelio conventions:
* secrets come from the environment (``TELEGRAM_API_ID``/``API_HASH``/``TOKEN``),
matching the shape used by the CT-217 gateway ``.env``;
* the admin allowlist and working directory are sourced from a JSON state file
(``config.json``) that lives beside the package, never committed;
* no first-run random token auth (avoid surprise privilege grants) — admins are
configured explicitly; an empty admin list refuses to start.
"""
from __future__ import annotations
from pathlib import Path
# PACKAGE_PATH must be defined before submodules import it, to avoid a
# circular import when config.py does ``from . import PACKAGE_PATH``.
PACKAGE_PATH = Path(__file__).parent
from .core import Telminal # noqa: E402
from .process import TProcess # noqa: E402
__version__ = "1.0.0"
__all__ = ["Telminal", "TProcess", "PACKAGE_PATH", "__version__"]