dsh-plugin-agnes-image: Integrating Agnes Image Generation and Settings Console in DSH

Preface

When building agents in DeepSeek Harness (dsh), models often need to “generate an image and obtain a local path or readable summary,” rather than merely describing the image in conversation. If you stuff the API Key, default model, output directory, and history into the parameters of every tool call, the interface becomes heavy, and it is inconvenient for humans to modify configuration in the UI.

Below is an introduction to the community plugin dsh-plugin-agnes-image (maintainer zhp282515-wq): it registers the agnes_image tool with the model and embeds the Agnes Image console into the dsh settings page, separating model switching, keys, presets, and the history gallery from tool parameters. The upstream image API is POST https://apihub.agnes-ai.com/v1/images/generations; the README states that, at the time of writing, all tiers and reference images are free, but actual billing is subject to the official Agnes policy.

What is this

dsh-plugin-agnes-image belongs to the “Model Inference” category of plugins in the DSH community directory (SkillHub Directory Page). A package works collaboratively in two halves:

  • Host half: registers the agnes_image tool and provides a small HTTP API on the local loopback (settings, key, history, generation).
  • Browser half: adds a section under Settings → Agnes Image (shows as Agnes 生图 when the shell is in Chinese), embedding the console page provided by the Host.

There are no additional npm dependencies at runtime; only Node built-in modules and global fetch are used. It requires Node ≥ 22. The current package version is 1.1.0, license MIT (see GitHub Repository).

Core Features

Models and Capabilities

Item Description
Default Model agnes-image-2.5-flash
Optional Models agnes-image-2.1-flash, agnes-image-2.0-flash
Capabilities Text-to-image, Image-to-image, Multi-image composition

The agnes_image Tool

After the model calls agnes_image, it gets a real PNG on disk and returns JSON that can be processed further; the summary contains a Markdown image reference.

Parameter Type Required Description
prompt string Yes Recommended structure: Subject + Scene + Style + Lighting + Composition + Quality
size string No Tiers: 1K / 2K / 3K / 4K, default 2K
ratio string No 1:1 3:4 4:3 16:9 9:16 2:3 3:2 21:9, default 1:1
model string No Override the configured default model for a single call
images string[] No Reference images: local absolute path, http(s)://, or data: URI
out string No Output absolute path; default is agnes-<timestamp>-<prompt slug>.png in the configured directory

Return fields include: ok, path, url, bytes, model, size, ratio, nativePixels, prompt, revisedPrompt, keySource.

Settings Page Console

The console supports English / 中文 (switched in the top bar; default Auto follows the shell and browser). The functions of each section are as follows:

Section Function
Active model Select one of the three image models as the tool default
Defaults Size tier and aspect ratio, with a preview of corresponding pixels
Output PNG output directory; “Open Folder” supported
API key Masked fingerprint and source; replace or clear key; connection test and real generation test
Advanced Timeout, retries, endpoint override, history toggle
Prompt presets Save, reuse, delete prompt templates
Generate Workbench: presets, prompt, size, ratio, model, reference image upload, result preview
History Thumbnail gallery of generation records from the tool and console

Configuration takes effect on the next generation, without needing to restart dsh. Effective order (high to low): configuration by the operator in the patch line, settings saved in the console, built-in defaults.

Installation and Activation

This package is not published on npm. According to the README, you need to clone the repository and mount it into the dsh profile you actually use via a local link, and register the bundle name in dsh.profile.bundles.

1. Clone the repository to any path

git clone https://github.com/zhp282515-wq/dsh-plugin-agnes-image.git /path/to/dsh-plugin-agnes-image

2. Link it into the profile using pnpm

link: must use an absolute path. The example profile is desktop; replace it with the profile you actually use:

cd ~/.dsh/profiles/desktop
pnpm add "link:/path/to/dsh-plugin-agnes-image"

The README suggests using the form link:D:/dsh-plugin/dsh-plugin-agnes-image for cross-drive cases on Windows. If you don’t use pnpm, you can use a directory junction (see the repository README for a PowerShell example).

3. Register the bundle in the profile’s package.json

Only pnpm add link: is not enough; you must write the package name into dsh.profile.bundles, otherwise the plugin will not load and dsh will not prompt the reason:

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

4. Restart dsh once

The Host half can be hot-reloaded later; the Browser half is compiled into the boot graph at startup.

Uninstall: remove the entry from bundles, delete the dependency and link; on Windows, use cmd /c rmdir <link> to delete the junction, do not use Remove-Item -Recurse (it would delete the source directory).

API Key Configuration

lib/agnes.js resolves the key in the following order:

  1. Explicit apiKey in plugin configuration
  2. Environment variable AGNES_AI_API_KEY, then AGNES_API_KEY
  3. Key file specified in configuration
  4. Default key files (takes the first one that exists): ~/.dsh/agnes_key.txt, ~/.agnes/api_key.txt

The key file is plain text, and leading/trailing whitespace will be trimmed. At startup, the log outputs [agnes-image] API key source: … (only the source, not the key). The console can write the key (mode 0600); the page obtains only a masked fingerprint (e.g., sk-Wsd********J8FR) and source description via GET /agnes-image/state. You can also set the environment variable AGNES_AI_API_KEY and restart dsh; do not commit the key to the repository or take screenshots of it.

Typical Usage

Script calls to the loopback HTTP API

Everything the console can do can be scripted. README example (the port depends on your local dsh; the documentation example uses 19387):

curl -s http://127.0.0.1:19387/agnes-image/state

curl -s -X POST http://127.0.0.1:19387/agnes-image/generate \
  -H 'content-type: application/json' \
  -d '{"prompt":"a red paper lantern over still black water","size":"1K","ratio":"16:9"}'

Common routes include: GET /agnes-image/state, POST /agnes-image/settings, POST /agnes-image/key, POST /agnes-image/test (mode:"auth" or mode:"generate"), POST /agnes-image/generate, GET /agnes-image/history, etc. The plugin validates that the Host is loopback and restricts the path range of GET /agnes-image/image to avoid arbitrary file reads.

Model calling the tool in conversation

After the agent enables this bundle in dsh, the model can call agnes_image according to the task, passing in prompt and optional size, ratio, model, images, out; the returned path and Markdown summary can be used for subsequent steps (e.g., writing into documents or as reference for further image-to-image generation).

Applicable Scenarios and Notes

Who it is for: Developers already using dsh who want to integrate Agnes text-to-image / image-to-image / multi-image composition into the Agent toolchain, and wish to manage models, keys, and history centrally in the settings page.

Permissions and Security: The plugin runs with the current dsh process permissions and can read/write the configured output directory and key files; please review the source code and MIT License yourself before installation, and only install from trusted sources.

Ecosystem Note: The DSH community plugin directory (such as SkillHub) is an independent site, with no official affiliation with DeepSeek / High-Flyer; the facts in this article are all from the README and package metadata of the repository mentioned above.

Links

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

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

Xiaoye