dsh-telegram
消息通讯 活跃维护

dsh-telegram

alchemistwu/dsh-telegram

极简稳定的Telegram桥接组件,支持零依赖手写长轮询机制实现消息双向同步,无需额外运行时依赖,部署后可直接在Telegram端与后端代理服务交互,通信稳定轻量。

0
Stars 标星
0
Forks 分支
0
Watchers 关注
0
Open Issues
TypeScript
主要语言
None
开源协议
132 KB
仓库大小
3 个月前
最后推送
一键安装扩展 / 插件指令
dsh plugin --profile web add github:alchemistwu/dsh-telegram
git clone https://github.com/alchemistwu/dsh-telegram.git
git clone git@github.com:alchemistwu/dsh-telegram.git
README.md main

dsh-telegram

Minimal, robust Telegram bridge for DSH — chat with your agent from your phone.

Zero runtime dependencies: hand-rolled long-polling transport over fetch,
plain cordis plugin, strip-only TypeScript. ~800 lines.

Features

  • Inbound → agent turn: messages create/resume sessions and deliver via the
    agent-loop API (followup), with preset mounting, workspace attachment, and
    automatic TG MM-DD HH:mm <hint> titles
  • Outbound: typing indicator on turn start, 🔧 <tool> progress events,
    final assistant text on turn end
  • ask_user_question answerer: agent questions render as numbered Telegram
    messages; reply with a number (multi: 1,2) or free text. Without this the
    agent blocks forever — the only other answerer lives in the web UI
  • Commands: /new [hint], /sessions (numbered menu, newest first),
    /use <n|title word|id prefix> (resumes offline sessions), /status, /stop
  • Safety: allowedChatIds allowlist (fail-closed), durable update offset,
    429 retry_after backoff

Config

- id: telegram
  config:
    allowedChatIds: [123456789]
    workspacePath: /path/to/workspace   # optional; defaults to first registered workspace
    model:                              # optional
      provider: modal
      model: zai-org/GLM-5.3-Flash

Bot token resolution: config.token → TELEGRAM_BOT_TOKEN env →
.telegram-token file next to the package.

Development

npm test          # 28 tests: unit + e2e (real apply() through a fake network)
probe/            # runtime contract probe — boots in a real profile and
                  # executes every service call the plugin makes, because
                  # mocks encode the author's beliefs; the probe encodes nothing

License

MIT