Foreword

DeepSeek Harness (DSH) adopts a plug-in architecture. Integrating Zhipu BigModel capabilities (search, reading, vision) typically requires fragmented configuration. dsh-zhipu consolidates these capabilities into a single plugin and provides a unified entry point through one ZAI_API_KEY, serving DSH’s web and headless profiles.

Core Features

The plugin provides the following capabilities:

  • Web Search: Integrates web_search_prime MCP and supports the zhipu-prime engine.
  • Web Page Reading: Integrates webReader MCP with server-side rendering (SSR) support, without directly accessing target URLs.
  • Visual Understanding: Provides the vision_analyze tool based on the GLM-4.6V model.
  • Image Attachment Recognition: Uses the agent/pre-step hook to automatically convert image attachments in conversations into text descriptions.

Installation and Enablement

Use the following command to install the plugin:

dsh plugin --profile web add github:<you>/dsh-zhipu

After installation, add the package name to the profile’s bundle list (for example ~/.dsh/profiles/web/package.json):

"dsh": { "profile": { "bundles": ["@deepseek-ai/dsh-base", "@deepseek-ai/dsh-web-app", "dsh-zhipu"] } }

The plugin automatically configures the search, reading, and vision tools via cordis.patch.yml. Restart the dsh web process to apply the changes.

Prior Configuration

  1. API Key: Ensure that ZAI_API_KEY is configured in ~/.dsh/.env (the key for Zhipu GLM Coding Plan).
  2. Image Input Declaration: In ~/.dsh/settings.yaml, declare image input support for the chat model; otherwise, the attachment hook cannot intervene:
llm-pi-ai:
  providers:
    zai-coding-cn:
      models:
        - id: glm-5.3
          input: [text, image] # 关键配置

Feature Description

  • Search and Reading:
    • Outbound requests point only to open.bigmodel.cn.
    • Search results come from the same source as the official search and cannot be directly cited as facts.
    • The web_fetch tool retrieves target page content, and URLs are recorded on the Zhipu side.
  • Visual Analysis:
    • The vision feature must use the Coding Plan endpoint (default codingBaseURL); pay-as-you-go endpoints return 429 errors.
    • content[0].text in MCP responses has a double JSON encoding issue; the plugin includes fault-tolerant handling.
  • Image Attachment Recognition:
    • The hook converts images into text descriptions and replaces the original image block.
    • Descriptions prefixed with attachmentId are the single source of truth in the session log.
    • If the description fails, the original image block is retained (honest failure).

Configuration Override

You can override cordis.patch.yml to adjust behavior:

# ~/.dsh/profiles/<name>/cordis.patch.yml
- id: zhipu
  config:
    apiKeyEnv: ZAI_API_KEY
    enableTool: false    # 关闭 vision_analyze
    enablePreStep: false # 关闭贴图钩子
    passthroughModels: [] # 原生吃图的模型列表

Data and Known Behaviors

  • Outbound Data: Search terms, target URLs, and image bytes (base64) are sent to open.bigmodel.cn; image bytes are not written to disk and do not appear in session logs.
  • Search Limitation: The search_pro engine ignores the count parameter and always returns 10 results, truncated by maxResults and marked with truncated: true.
  • Session Recovery: Old sessions containing images may report errors under text-only models; use vision_analyze with attachmentId to re-analyze them.

Development and Testing

A test script is provided to verify functionality (approximately 3 credits consumed):

node "$env:USERPROFILE\.dsh\plugins\dsh-zhipu\test\smoke.mjs" web

After modifying the code, delete the old node_modules and reinstall to trigger an update.