dsh-email: Reading and Writing Local Mail.app Messages in DSH

Introduction

DeepSeek Harness (DSH) follows a “everything is a plugin” philosophy, enabling developers to extend agent capabilities through plugins. In DSH, giving an agent the ability to read and write local emails typically requires IMAP/SMTP credentials, which introduces challenges around password management, credential leakage, and account isolation. The built-in Mail.app on macOS already has your email account logged in, so reading and writing emails directly through it allows you to reuse the existing login session without handing credentials over to a plugin.

What Is This

dsh-email is a DeepSeek Harness plugin provided by maintainer Lzm1645, categorized under “Client.” It communicates with the local Mail.app via AppleScript, providing DSH agents with the ability to list, read, search, and send emails. The send functionality is disabled by default and must be explicitly enabled.

Core Features

The plugin provides the following tools, each with corresponding parameters:

Tool Purpose Key Parameters
email_list List inbox emails (id/sender/subject/time) limit, unreadOnly, mailbox
email_read Read the body by message id id
email_search Search by subject/sender substring query, limit
email_send Send via Mail.app to, subject, body, cc, confirm

Installation & Activation

Using the desktop profile as an example, follow these steps in order:

  1. Clone the repository to your local machine, e.g., ~/code/dsh-email.
  2. Add the following to the dependencies in ~/.dsh/profiles/desktop/package.json:
   "dsh-email": "link:/Users/<you>/code/dsh-email"
  1. Append "dsh-email" to the end of dsh.profile.bundles.
  2. Create a symlink (the desktop profile is exclusively managed by Electron, so pnpm install is not available):
   cd ~/.dsh/profiles/desktop
   ln -sfn ../../../../code/dsh-email node_modules/dsh-email
  1. Fully quit DSH (⌘Q) and then relaunch it — plugins are only loaded at startup.

Configuration

Send behavior is controlled via an environment variable:

Environment Variable Default Description
DSH_EMAIL_ALLOW_SEND Not set Set to 1 to allow email_send; otherwise the send tool will be rejected outright

When sending, confirm: true must also be passed as a second layer of protection.

Security Boundaries

  • Only interacts with Mail.app via AppleScript; does not read the Keychain and does not store email content;
  • Sending is disabled by default; confirm: true is mandatory;
  • Reading the body is truncated to 20k characters to avoid stuffing oversized emails into the context;
  • Attachments are not handled (out of scope for v0.1).

Use Cases & Caveats

  • Only supports macOS + Mail.app;
  • Only supports plain-text bodies (HTML emails are read as text);
  • The message id is provided by Mail.app; switching to a different email client would require rewriting the corresponding implementation.

Please review the source code and license before installing. The plugin runs with the permissions of the current DSH process; it is recommended to use it only in trusted environments.

Conclusion

dsh-email enables DSH agents to read and write local Mail.app emails directly, with the send feature disabled by default and requiring both explicit configuration and environment variable confirmation. It is well-suited for scenarios where a local email capability needs to be integrated into an agent on macOS.

Directory Page | GitHub Repository

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

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

Xiaoye