LoserFox/telegram
Telegram Bot API 桥接插件:长轮询、按聊天会话、HTML 格式化
Project Overview项目介绍
This is a DSH-native plugin that bridges Telegram chats to DeepSeek Harness (DSH) agent sessions via Telegram Bot API long polling, with one independent agent session per active Telegram chat. To install the plugin, users run the command dsh plugin --profile web add <dir|git-url> from the official DSH CLI, which automatically adds the bundle declaration to the DSH composite layer. After installation completes, users must restart the DSH process for the target profile, because composite layer changes do not support hot module replacement in current DSH versions, and there is no incremental update path for this type of plugin.
This plugin is designed for DSH users who want to access DSH agent capabilities directly from a Telegram client, whether for personal testing or daily casual use. After configuring your bot token obtained from @BotFather and setting up an allowed user ID whitelist to control access, users can chat with the configured DSH agent directly from their Telegram mobile or desktop app. Built-in commands let users manage their chat sessions: /start shows a welcome message, /new and /clear reset the current conversation session, and /help outputs command documentation, and none of these control commands are passed to the underlying LLM model.
The plugin requires the agents service from @deepseek-ai/dsh-agent to be already mounted in the DSH composite layer, and pulls all LLM adapter, session, and tool configurations from the outer project's cordis.yml file. Currently, it only supports plain text messages and one-on-one private chats, ignoring media files, group messages, mentions, and other content types, and only supports long polling instead of webhook deployment. Delivery failures for outgoing messages are only logged to DSH's logger and not retried, and the plugin itself does not add any extra system prompts or tool schemas to the agent's context window.
这是专为 DeepSeek Harness (DSH) 开发的原生插件,作用是将 Telegram 聊天通过 Bot API 长轮询桥接到 DSH 的 agent 会话,每个 Telegram 聊天对应一个独立的 DSH agent 会话。该插件带有 DSH 专属的 bundle 清单,仅需一行命令即可完成安装与配置挂载,安装完成后需要重启对应 profile 的 DSH 进程,因为组合层变更不参与热更新。
该插件面向需要在 Telegram 端直接使用 DSH agent 能力的开发者与普通用户,配置好 Bot Token 和允许访问的用户 ID 白名单后,即可在 Telegram 端直接和 DSH agent 对话。用户可通过预设命令管理会话:/start 触发欢迎语、/new 或 /clear 清除旧会话新建会话、/help 获取帮助,所有命令均不会转发给后端模型处理。
本插件要求 DSH 组合必须已挂载 agents 服务,所有 LLM 适配器、会话配置与工具能力均来自外围 cordis.yml,插件本身不添加额外系统提示词或工具规则。当前仅支持文本私聊,不处理群聊、多媒体消息,仅支持长轮询模式不支持 webhook,投递失败仅记录日志不重试。
请帮我安装这个 DSH 插件。安装前先完成【兼容性检查 + 安全性检查】,检查通过再动手。
插件:telegram(LoserFox/telegram)
仓库:https://github.com/LoserFox/telegram
本站详情页:https://www.yhbd.top/plugins/loserfox-telegram/
本站登记:类型 plugin · 归类 原生 DSH 插件 · 许可证未声明 · ⭐ 6 · 最近提交 2026-08-13 · 主语言 TypeScript
按下面顺序执行,每步先把结论告诉我,再进入下一步:
【1 兼容性检查】
① 我这边:DSH 版本、Node 版本、操作系统、当前 profile(web / desktop)。
② 读它的 README、package.json、插件 manifest,列出它要求的 DSH 版本 / Node 版本 / 操作系统 / 外部依赖 / 需要另外先装的运行时。
③ 逐条比对,结论只写「满足 / 不满足 / 未知」三种;不满足的给出可行替代方案。
④ 检查是否和我已装的插件冲突:命令名重复、skill / tool 重名、端口占用、重复注册的 MCP server。
【2 安全性检查】
① 仓库可信度:和上面「本站登记」是否一致;star / fork 数、创建时间、最近提交,是否归档或长期停更。
② 安装脚本:逐行看 package.json 的 preinstall / install / postinstall,以及 install.sh、setup.ps1 之类脚本。出现 curl|bash、下载后直接执行、混淆代码、访问与插件功能无关的域名,立刻停下来告诉我,不要继续装。
③ 依赖:列出新增依赖,标出无人维护、或与知名包拼写近似的可疑包(typosquatting)。
④ 权限与副作用:它会读写哪些目录、访问哪些域名、需要哪些 DSH 权限(filesystem / network / shell / clipboard 等),以及怎么卸载和回滚。
⑤ 如果它要求 sudo / 管理员权限,或权限明显超出功能所需,先停下来问我。
【3 安装】
上面两步没有「不满足」和「高危项」时才执行;用官方推荐方式安装,不要自行提权。
【4 汇报】
用表格输出:检查项 / 结论 / 依据 / 是否需要我决策。拿不准的一律写「未知」并说明要我怎么确认——不要猜,也不要替我决定。
Send this message to DSH in your current session: it verifies compatibility and security first (answering met / not met / unknown item by item) and only installs once everything checks out — it will stop and ask you if it finds a high-risk item. The box scrolls; the copy is the full prompt. CLI install commands may not be accurate across systems, so DSH is the safer route.把上面这条消息直接发给当前会话里的 DSH:它会先核对兼容性与安全性(逐条给「满足 / 不满足 / 未知」),确认没问题再安装,有高危项会停下来问你。框内可滚动,复制到的是完整提示词;安装命令不一定准确,发给 DSH 更稳。
- No license declared - all rights reserved by default; ask the author before commercial use or redistribution未声明开源许可证 —— 默认「保留所有权利」,商用或再分发前先问作者
- Only 6 stars - very few users, little community feedback星标只有 6,几乎没人在用,遇到问题缺少社区反馈
DSH walks through these 9 checksDSH 会逐条核对这 9 项
Compatibility兼容性
- DSH, Node, OS and profile requirementsDSH 版本 / Node 版本 / 操作系统 / profile 是否满足要求
- External dependencies and runtimes (Electron / Python / Docker, ...)外部依赖与运行时(Electron / Python / Docker 等)是否齐备
- Conflicts with installed plugins: command names, skill / tool names, ports, duplicate MCP registration与已装插件是否冲突:命令名、skill / tool 重名、端口占用、重复 MCP 注册
Security安全性
- Repo matches the facts registered here; archived or abandoned?仓库是否与页面登记一致,是否归档或长期停更
- Safety of preinstall / install / postinstall and install.sh / setup.ps1preinstall / install / postinstall 与 install.sh、setup.ps1 是否安全
- curl|bash, download-then-execute, obfuscation, unrelated domains → stop immediatelycurl|bash、下载即执行、混淆代码、无关域名 → 立刻停止
- Typosquatting or unmaintained packages among the new dependencies新增依赖里有没有 typosquatting 或无人维护的包
- Requested permissions vs. what the feature actually needs申请了哪些权限、是否超出功能所需(filesystem / network / shell / clipboard)
- Any sudo / admin requirement, plus uninstall and rollback是否要求 sudo / 管理员权限,以及卸载与回滚方式
Anything uncertain must be marked unknown with a note on how to confirm it. This site's signal screen is a static snapshot, not a security audit.拿不准的必须标「未知」并说明要我怎么确认。本站的信号筛查是静态快照,不能替代安全审计。
Or use CLI install (for developers)或使用命令行安装(适合开发者)
CLI Install命令行安装
dsh plugin --profile web add github:LoserFox/telegram
把 LoserFox/telegram 加入你的 DSH 配置(web profile)即可启用。
READMEREADME
telegram
安装(DSH profile bundle)
# 从本仓库 checkout 安装到 profile(web / headless 等),bundle 声明自动加入组合层
dsh plugin --profile web add <dir|git-url>
# 验证
dsh --profile web --dump-config | grep telegram
- 插入行 id:
telegram(cordis.patch.yml);不声明模型面工具或技能——它是把 Telegram 聊天桥接到 agent 会话的后台服务插件。 - 加载即需要 token:缺少 bot token(配置
token或环境变量DSH_TELEGRAM_TOKEN)时apply直接报错;没有 token 不会惰性启动。 - 宿主前置条件:dsh 组合必须挂载
agents服务(@deepseek-ai/dsh-agent);LLM 适配器、会话与工具来自外围cordis.yml(见telegram-agent示例)。 - 卸载:
dsh plugin --profile web remove telegram。 - 安装后需重启目标 profile 的 DSH 进程(组合层变更不参与 HMR 热更新)。
概述
telegram 插件通过 Bot API 长轮询把 Telegram 聊天桥接到 harness agent 会话,每个聊天一个 agent 会话。设计参照 Hermes 的 telegram 平台适配器——每聊天会话、用户白名单、HTML 格式化、4096 字符分片、typing 指示——裁剪为 harness 的纯文本接缝。telegram-agent 是可运行的 cordis.yml 应用。
接线
inject: ['agents']。每条已授权文本消息为每个聊天创建或复用 agent(ctx.agents.create),经 followup 以用户消息转发文本,并把每条 assistant/message 文本作为分片的 HTML 格式 Telegram 消息送回聊天。命令:/start(欢迎)、/new 与 /clear(新会话,旧 agent 释放)、/help。LLM 适配器、会话与工具来自外围 cordis.yml。
配置
| 键 | 默认 | 含义 |
|---|---|---|
token |
'' |
@BotFather 创建的 bot token;为空时回退到 DSH_TELEGRAM_TOKEN |
allowedUserIds |
[] |
允许与 bot 对话的 Telegram 用户 id;空列表拒绝所有人 |
allowAllUsers |
false |
允许任意用户(仅开发用) |
provider |
deepseek-official |
传给每个创建 agent 的 LLM provider id |
model |
deepseek-v4-flash |
传给每个创建 agent 的模型 id |
maxMessageLength |
4096 |
每条 Telegram 消息的长度上限 |
pollingTimeoutSec |
30 |
长轮询超时(秒) |
缺少 token 时加载即报错(fail loud)。未配置白名单时 bot 拒绝所有用户(fail closed)。TelegramConfig 还接受仅运行时使用的 client 与 sleep 接缝供测试使用;生产环境使用全局 fetch 与真实定时器。所有错误经 ctx.logger 记录且 bot token 被脱敏。
投递语义
- assistant 文本按保守的 Markdown 子集转换(围栏代码 →
<pre>、行内代码 →<code>、**粗体**→<b>,其余 HTML 转义),并按maxMessageLength分片,优先在换行、中文句号、句点+空格处断行。 - Telegram 拒绝 HTML 正文(分片后实体不完整)时,该片回退为纯文本发送。
turn/start发送typing聊天动作;投递为 fire-and-forget,逐片记录日志。- 单条长轮询循环服务所有聊天;空批次休眠 50ms 节奏下限,避免即时空传输让事件循环空转。
模型体验
Telegram 用户消息
模型看到什么
每条入站聊天消息,模型在该聊天会话中收到逐字的一条用户消息。本包不添加系统提示词或工具 schema;它们来自外围 cordis.yml 的插件。命令(/start、/new、/clear、/help)不会到达模型。
Token 影响
数据相关的用户消息 token 进入保留的会话历史,后续回合会重发,直到其它包压缩它们。轮询帧、聊天簿记与投递调用不增加模型上下文 token。
KV Cache 影响
仅追加;新可见内容跟在可复用请求前缀之后,不会使既有 KV-cache 条目失效。
已知限制与待办
- 仅文本消息——照片、文档、语音、贴纸与 caption 被忽略。
- 仅私聊——群聊 @ 提及与话题(topics)未处理。
- 每条 assistant 输出一条消息——工具中间进度不会作为独立可编辑 Telegram 消息流式发送。
- 仅长轮询——无 webhook 模式,主机需可出站访问 Telegram API。
- 除纯文本回退外无重试——投递失败记录日志后丢弃;Hermes 风格的发送重试与投递账本留待后续。
whiteguo233/dsh-openbiliclaw
hanshanyike/dsh-yolo
AX1202/ax-feishu-bridge
amlyczz/dsh-lark-link
MichengAI/dsh-im-connect
caoyiwei850/dsh-ssh-ops
jiezeng2004-design/dsh-chatgpt-bridge