Preface

When running agents locally using DeepSeek Harness (DSH), common issues extend beyond “can it execute” to include: where tasks are dispatched, who can execute them, how to monitor progress during execution, how high-risk operations are approved, and how results and files are returned.

yangzhaofeng496/dsh-feishu-plugin is a community DSH plugin that bridges a Feishu/Lark bot to DeepSeek Harness. After users send text tasks in Feishu, the plugin delegates the task to a specified dsh profile for execution and replies with progress updates, approval requests, and execution results back to the original conversation.

Positioning

  • Plugin Name: yangzhaofeng496/dsh-feishu-plugin
  • Maintainer: yangzhaofeng496
  • License: MIT
  • One-line positioning: Feishu/Lark bot bridge for DeepSeek Harness with approvals, progress updates, context, and file transfer.

It is designed for developers who need to connect local DSH tasks into Feishu conversations, rather than replacing DSH itself.

Core Capabilities

The plugin covers the main workflow from message reception, user authorization, execution feedback, permission approvals, to file transfer back.

  1. Feishu Connection
    Receives messages via a long connection from the Feishu Open Platform, eliminating the need for a public callback address. Currently, only text messages are supported.

  2. User Authorization
    Uses an open_id whitelist to restrict users who can execute tasks. Supports users applying for authorization within Feishu, with administrators able to approve, revoke, and query these requests. Dynamic authorizations are persisted and remain effective after restart.

  3. Execution Feedback
    During execution, the same Feishu message is updated periodically to show the running duration and latest output. The current Provider and Model are displayed in queue, execution, and result messages. Replies that are too long are automatically split.

  4. Context Management
    Isolates recent conversation contexts per Feishu conversation and user, and persists them. Subsequent tasks can continue processing based on previous contexts.

  5. Permission Approval
    The plugin can handle Harness’s native one-time permission approvals. After the task initiator or administrator approves or rejects the request in Feishu, the approval result returns to the execution flow.

  6. File Transfer
    Supports authorized users sending files from Feishu to Harness, and automatically transferring files generated by Harness back to the original Feishu conversation. Both inbound and outbound transfers are subject to workspace boundaries, file size, and file count limits.

  7. Runtime Stability
    Uses a serial task queue to prevent multiple tasks from operating on the same workspace simultaneously. The plugin logs task receipt, start, completion, failure, and queue depth, automatically filters duplicate messages, and maintains control in scenarios like execution timeout, output length limits, and plugin stoppage.

Installation & Enabling

Install the Plugin

First, ensure you have a working DSH environment and a Feishu enterprise self-built application on your machine. Then, execute the official installation command to add the plugin to the web profile:

dsh plugin --profile web add github:yangzhaofeng496/dsh-feishu-plugin#main

After installation, the main plugin is disabled by default, and the user whitelist is empty. Next, you need to save Feishu credentials, configure the administrator and workspace, and then manually enable the plugin.

Configure the Feishu Application

Create an enterprise self-built application on the Feishu Open Platform and complete the robot capability configuration. The key point is to use a long connection to receive events instead of a public callback.

Typically, you need to do the following:

  1. Add the “Bot” capability.
  2. Enable the instant messaging permissions required to receive and send messages.
  3. Select “Long Connection” in the Event and Callback configuration.
  4. Add the event im.message.receive_v1 to receive messages.
  5. Create a version and publish the application to make the bot and permission configurations take effect.

Specific permission names may vary with updates to the Feishu Open Platform interface. Before publishing, confirm that the bot can receive user messages and send messages back to the original conversation.

Save Credentials

Do not write the App Secret into a Git repository or cordis.patch.yml. Save it to the Harness credentials file:

FEISHU_APP_ID: cli_xxxxxxxxxxxxxxxx
FEISHU_APP_SECRET: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

After saving, restrict the file to be readable only by the current user:

chmod 600 ~/.dsh/.credentials.yaml

Enable the Plugin

Edit ~/.dsh/profiles/web/cordis.patch.yml to add or override the feishu configuration:

- id: feishu
  disabled: false
  config:
    appIdEnv: FEISHU_APP_ID
    appSecretEnv: FEISHU_APP_SECRET
    adminOpenIds:
      - ou_admin_xxxxxxxxxxxxxxxxxxxxxxxxxx
    allowedOpenIds:
      - ou_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
    authorizationFile: ~/.dsh/feishu-authorizations.json
    contextFile: ~/.dsh/feishu-contexts.json
    workspace: /absolute/path/to/your/workspace
    attachmentDirectory: .dsh-feishu/inbox
    maxInboundFileBytes: 31457280
    maxOutboundFileBytes: 31457280
    maxOutboundFiles: 5
    timeoutMs: 900000
    maxOutputChars: 50000

There are a few fields that need special attention:

  • adminOpenIds: A list of administrator open_ids who can approve and revoke authorizations.
  • allowedOpenIds: A list of regular Feishu user open_ids allowed to dispatch tasks.
  • authorizationFile: The persistence file for dynamic authorizations and pending approval requests.
  • contextFile: The persistence file for conversation context.
  • workspace: The working directory used when executing tasks.

allowedOpenIds is empty by default, so no regular users can execute tasks. Administrators in adminOpenIds always have execution permissions. Unauthorized users can initiate authorization requests in Feishu for administrator approval, without restarting the plugin.

Typical Usage

Start the Service

After completing the configuration, start the DSH Web service:

dsh web --port 3081

After successful startup, you can send text tasks to the bot directly in Feishu, or send /help to see a brief description.

Authorization Management

Unauthorized users can send:

申请授权

or:

/request

The bot will record the request and reply with the requester’s open_id.

Administrators can use the following commands:

/requests
/approve ou_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
/revoke ou_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
/users

The commands function as follows:

  1. 申请授权 (Request Authorization) or /request: Create or update your own authorization request.
  2. /requests: View pending approval requests.
  3. /approve <open_id>: Approve a user to execute tasks.
  4. /revoke <open_id>: Revoke permissions for a regular user.
  5. /users: View administrators and authorized users.

Dynamic authorizations are saved by default to ~/.dsh/feishu-authorizations.json. The file is created with 0600 permissions and should not be committed to Git. Administrators in the configuration file cannot be revoked via Feishu commands; they must be modified by the local administrator and the service restarted.

Context Management

The plugin isolates context per Feishu conversation and user and persists recent conversation content. This makes expressions like “continue the previous task” or “modify the last version” easier for subsequent tasks to understand.

Failed or timed-out tasks are not written to the context.

You can use the following commands in Feishu to manage context:

/new
/clear
/history
/context

Description:

  1. /new: Create a new conversation and clear previous context.
  2. /clear: Clear the current context.
  3. /history: View a summary of recent context.
  4. /context: View context turns and character usage.

Context is saved by default to ~/.dsh/feishu-contexts.json, created with 0600 permissions. This file may contain sensitive content from tasks and responses; do not commit it to Git or send it to others.

One-time Permission Approval

When tool execution requires higher privileges, Harness initiates a one-time permission approval. The plugin provides an approval ID in Feishu, and the task initiator or administrator can approve or reject it:

/allow a1b2c3d4
/deny a1b2c3d4

Approval is only valid for that specific tool call and does not permanently elevate permissions. Other regular users cannot approve tasks that are not their own. If the approval wait times out, the plugin will treat it as a rejection to prevent tasks from hanging indefinitely.

File Transfer

Authorized users can send files, images, audio, or videos directly to the bot. The plugin saves inbound files to a directory within the workspace:

<workspace>/.dsh-feishu/inbox/<message_id>/<safe_filename>

The plugin then creates a task and passes the workspace relative path to Harness.

File limits:

  1. Inbound files must be located inside the workspace.
  2. Files larger than maxInboundFileBytes or empty files will be rejected.
  3. Outbound files only accept paths inside the workspace.
  4. Symlinks that resolve outside the workspace will be rejected.
  5. By default, a single task automatically sends up to 5 files, with each file not exceeding 30 MB.

Users can also manually ask the bot to send existing files:

/send outputs/report.pdf

Runtime Limits & Logs

The plugin implements several types of limits during runtime to prevent Feishu messages and the execution environment from getting out of control.

  1. Serial Task Queue
    Prevents multiple tasks from operating on the same workspace simultaneously.

  2. Duplicate Message Filtering
    Automatically filters duplicate messages to reduce duplicate triggers.

  3. Execution Timeout
    A single task will be terminated after exceeding timeoutMs.

  4. Output Length Limit
    Captured output is limited by maxOutputChars.

  5. Long Message Splitting
    Feishu replies that are too long will be automatically split.

  6. Clean up child processes on stop
    When the plugin stops, it terminates any child processes still running.

Runtime logs display information such as task receipt, start, completion, failure, and queue depth. Logs do not output the App Secret but may contain user open_id, Feishu message IDs, and task execution errors. Please sanitize logs before sharing.

Applicable Scenarios & Notes

Suitable scenarios:

  1. Want to trigger local DSH tasks directly in Feishu.
  2. Need to handle authorization and approvals for Feishu users.
  3. Need to see progress and latest output during execution.
  4. Need to preserve cross-task context.
  5. Need to transfer files back and forth between Feishu and the Harness workspace.

Pre-use notes:

  1. The plugin executes tasks within the local dsh process environment. Before installing, check the source code and MIT license, and confirm the permissions of the configured workspace, profile, and credentials.
  2. Do not write FEISHU_APP_SECRET into a Git repository or cordis.patch.yml.
  3. ~/.dsh/.credentials.yaml, ~/.dsh/feishu-authorizations.json, and ~/.dsh/feishu-contexts.json may all contain sensitive information; do not commit them to Git or send them to others casually.
  4. The main plugin is disabled by default, and allowedOpenIds is empty by default. Enable it manually after configuring credentials, administrators, and workspaces.
  5. Currently, only text messages are supported.
  6. The DSH community directory is an independent site with no official affiliation with DeepSeek / Hypi.

Links

GitHub:

https://github.com/yangzhaofeng496/dsh-feishu-plugin

Directory Page:

https://www.skillhub.cn/plugins/yangzhaofeng496/dsh-feishu-plugin