dsh-telegram-bridge: Driving DSH Headless Agent in Telegram Private Chats

Preface

The common way to connect DSH to instant messaging is to spin up a separate Web service, SessionController, or upload endpoint, and also handle pairing, approval callbacks, and streaming output. If the goal is only “running an Agent inside a private chat window of an already authorized user”, the capability boundary can be narrowed considerably: a Host-side plugin, fixed slash commands, credentials and state stored outside the profile directory, and no approvals through Telegram.

Below is an introduction to the community plugin dsh-telegram-bridge (maintainer: yoggu; category: networking tool). It is a Host-only Cordis bundle aimed at a single pre-authorized Telegram private chat; it depends on DSH’s headless Agent/Session service, persists offset, session and schedule state, and rejects Telegram-based approval flows.

What Is This

  • Positioning: Host-only DSH plugin for authorized private chat scenarios (consistent with the README and package.json descriptions).
  • Repository: https://github.com/yoggu/dsh-telegram-bridge
  • Current version (package.json): 0.1.2, MIT license.
  • Runtime environment: Node >=22.19.0; DSH 0.1.7-rc.2 or ^0.2.0-rc.1; requires Cordis Agent, Session, SessionQuery, preset registry, and other peer dependencies.

The plugin does not include application-specific personas or workspace paths; the DSH profile consuming this bundle defines its own agentPreset, tools, model adapters, sandbox, and approval policies.

Core Features

The capabilities and limitations stated explicitly in the README are as follows.

Messages and Commands

  • Supports plain text, as well as /start, /help, /status, /new, /compact, /stop.
  • Not supported: pairing, attachments, callback approvals, streaming output.
  • During interactive prompts with the authorized user, it does its best to show Telegram’s “typing” indicator until completion, cancellation, or timeout.

Sessions and Models

  • /new immediately persists a newly created session.
  • /compact only runs on the current idle session and does not blindly retry partially committed operations; automatic compaction is provided by the consuming profile’s agent preset, not built into the bridge.
  • /status only reports whether the current session is ready/working and the configured model; it does not expose chat/session identifiers.
  • On startup, it registers the slash menu for the authorized private chat via Telegram’s setMyCommands (separated from the text command handler).

Scheduling (Optional)

  • After enabling enableSchedules, an IANA timeZone, and jobs in the configuration, scheduling is done internally by the adapter (not the DSH reminder plugin).
  • Slots that are more than two minutes late are skipped and not re-run; each slot is pinned before model work begins, and generation happens at most once.
  • Completion text or failure notifications are written to a durable outbox; Telegram sends are chunked with retries, and transport errors may cause a chunk to be duplicated.

Relationship with Other Hosts

  • If a Web GUI shares the same session storage, the README suggests only using the Web Host side with the optional workspace-reconciliation.js to group external Telegram sessions, and not mounting two workspace registries on the same JSON store.

Language

  • The command menu, help, status, errors, and scheduled failure notifications default to English; setting language: de in this Host’s plugin configuration preserves German wording. The public schema accepts en and de; model answers and operator-provided prompt/job labels are not translated.

Installation and Enablement

The official recommendation is to install from GitHub with a version tag into the DSH profile that owns the Telegram bot (the example profile is named telegram; use the profile you actually run). The bridge should use a Dedicated DSH process/profile and should not be shared with unrelated Agents.

dsh plugin --profile telegram add 'https://github.com/yoggu/dsh-telegram-bridge.git#v0.1.2'

Local checkout linking method (the link directory must be kept in place; also specify v0.1.2):

git clone --branch v0.1.2 --depth 1 https://github.com/yoggu/dsh-telegram-bridge.git
cd dsh-telegram-bridge
pnpm install
dsh plugin --profile telegram add "link:$(pwd)"

Uninstall:

dsh plugin --profile telegram remove dsh-telegram-bridge

Before installing, review the repository source code and the MIT license yourself; the plugin runs with the permissions and sandbox policy of the current DSH process, and the deployment side should configure a sandbox/permission preset to forbid privilege escalation (the bridge cannot prevent direct mode switching in other Host integrations).

Configuration Highlights

After installing the bundle, provide an overlay in the consuming profile, for example:

- id: telegram-bridge
  config:
    cwd: /absolute/agent/workspace
    dataDir: /absolute/private/telegram/data
    agentPreset: existing-agent-preset
    permissionPreset: workspace-write
    provider: existing-local-provider
    model: exact-model-id
    reasoningEffort: low
    timeZone: Europe/Zurich
    enableSchedules: false
    jobs: []

Credentials (do not write into YAML)

Place credentials.json inside dataDir beforehand, with directory permissions 0700 and file permissions 0600:

{ "botToken": "<token>", "allowedUserId": <numeric-id> }

The Host does not auto-pair. This bot token can only be polled by this one bot and its DSH profile; DSH state, the schedule outbox, and the exclusive poller socket also live in this data directory.

Permissions and cwd

  • Agents created within this process are all pinned to the configured cwd and workspace-write.
  • All LLM streams (including auxiliary calls and resumed sessions) are restricted to the configured exact provider/model.
  • workspace-write also allows temporary writes to /tmp, global reads, and network access; the trusted Host writes its own state outside the agent workspace.

Scheduled Job Example

    enableSchedules: true
    timeZone: Europe/Zurich
    jobs:
      - id: daily-report
        label: Daily report
        hour: 7
        minute: 0
        prompt: /daily-report
        permissionPreset: read-only

Each jobs entry requires a unique id, plus label, hour (0–23), minute (0–59), optional weekday (Mon…Sun), prompt, and permissionPreset (read-only or workspace-write). A job configured as read-only explicitly switches the permission preset before the prompt.

Typical Usage

  1. Start a separate DSH profile/process and install the v0.1.2 bundle.
  2. Specify cwd, dataDir, agentPreset, provider, model, etc. in the overlay; write credentials.json into dataDir.
  3. Send text or slash commands in the authorized private chat with the bot on Telegram to drive the Agent; use /new to start a new session, /compact to tidy up the current idle session, and /status to check readiness and the model.
  4. If scheduled skill prompts are needed, enable enableSchedules and configure jobs; for the first scheduled run it is recommended to observe manually (the README notes this is not exactly-once: a crash may lose an inbound update, and transport anomalies may cause chunk duplication).

When sharing storage with the Web GUI, follow the README and use only the Web Host-side reconciliation plugin to manage sessions, avoiding dual registries.

Use Cases and Cautions

Suitable for

  • Deployments that only need one private chat entry point with a pre-known Telegram user id, want to run Agents via DSH headless, and do not need Telegram approvals/attachments/streaming.
  • Deployments willing to give the bridge an exclusive profile and exclusive bot token polling, and to place credentials and runtime state in a private directory outside the repository.

Be sure to note

  • Interactive inbound requests are acknowledged before business execution; a crash may lose an update, so this is not exactly-once.
  • Telegram-based approvals are rejected; sensitive operations still depend on the DSH-side sandbox and permission presets—review the source code and policies before installing.
  • The community catalog SkillHub plugin page and GitHub are independent sources of information and have no official affiliation with DeepSeek / 幻方 (High-Flyer); stars and versions are subject to the repository.

Conclusion

dsh-telegram-bridge narrows the DSH Agent/Session down into a Host-only, single-user private-chat Telegram channel: a clear command surface, externalized credentials, and optional internal scheduling. If your need is lightweight private-chat operations rather than a full-featured IM gateway, you can follow the README’s installation commands and profile overlay to get it deployed.

羽毛球分组比赛记分
小程序二维码

欢迎使用《羽毛球分组比赛记分》微信小程序

Xiaoye