Preface

This is a host plugin for DeepSeek Harness (DSH). It pushes session notifications through a Telegram bot and supports users replying to messages on Telegram to continue a session, meeting the need to access DSH session status from mobile devices or via instant messaging tools.

Installation and Activation

The plugin is included in the official catalog. Use the following commands to install it:

dsh plugin --profile web add dsh-telegram-bridge
dsh --profile web --dump-config
# 重启 dsh web 进程

Initial Configuration

The following steps are required the first time you use it:

  1. Create a bot in Telegram by contacting @BotFather and obtain the token.
  2. Configure the token. You can set botToken in data/config.json, or set the environment variable DSH_TELEGRAM_BOT_TOKEN. The environment variable must be visible to the dsh web process.
  3. Restart dsh web.
  4. Send /start to the bot in Telegram (the current chat is registered automatically if no allowlist is configured).
  5. Send /status to confirm the bridge status.

Core Features

The plugin provides the following capabilities:

  • Session completion notifications: When a session returns to the idle state, send a notification to Telegram. The notification includes the sidebar icon name, session ID, session name, notification type, and content summary. Reply to the message to continue the session.
  • Confirmation-required notifications: When the model requests confirmation (ask_user_question) or permission approval is required (sandbox approval), push the question or approval request. Handle it by replying with an option number, text, or the /approve command.
  • Message routing:
    1. Replying to a notification message: goes directly to the corresponding session.
    2. The message body includes #sess:<session ID>: goes directly to that session.
    3. Exactly one unanswered confirmation question exists globally: the message is treated as the answer to it.
    4. Application routing: if the message does not carry a sessionId, identify the application by keywords. Calendar-related items (schedule/todo/reminders, etc.) are sent to dsh-calendar-todo; other messages default to dsh-chat-app and create a new session.

Telegram Commands

  • /start: Register the current chat.
  • /list: List sessions (numbers).
  • /s <number|session ID> <content>: Send a message to the specified session.
  • /q <number> <answer>: Answer the pending confirmation question in the specified session.
  • /approve <number> allow|deny|ask: Set the automatic approval policy for the session.
  • /status: Bridge status.
  • /help: Help.

Approval Policy and Data Persistence

  • Approval policy: Only approval policies set with the /approve command are persisted to data/state. The “Allow for this session” policy from the web permission elevation card exists only in memory and becomes invalid after a restart.
  • Environment variables: Supports DSH_TELEGRAM_BOT_TOKEN, DSH_TELEGRAM_ALLOWED_CHATS, DSH_TELEGRAM_APPROVAL_DEFAULT, and DSH_TELEGRAM_PREFIX.
  • Configuration file: Supports setting botToken, allowedChats (empty means no restriction), and calendarKeywords in data/config.json.