@zyfgood/dsh-a2a: Adding A2A Bidirectional Interoperability to DSH

Preface

DeepSeek Harness (DSH) primarily relies on ACP and MCP for in-process interoperability: the former is suited for programmatic driving of agents, while the latter is suited for mounting external tools and resources. To connect an agent in DSH to Google ADK, the a2a-python / a2a-java SDKs, or various A2A gateways, you need a standard Agent2Agent (A2A) protocol surface rather than wrapping another layer of private RPC.

The following introduces the community plugin @zyfgood/dsh-a2a (maintainer: zyfgood; category: workflow). It provides both an inbound A2A server and outbound a2a_* tools on the DSH side, with zero additional npm runtime dependencies (Node ≥20 standard library + global fetch), and is installed the same way as other plugins from the same author, such as dsh-feishu-bot.

What Is This

In one sentence: @zyfgood/dsh-a2a is a DSH plugin for the A2A protocol — it exposes DSH agents as a standard A2A server and registers model tools that let any DSH agent call remote A2A agents.

The current npm version is 0.2.1 (MIT). Community catalog page: skillhub.cn/plugins/zyfgood/dsh-a2a; source code and documentation: github.com/zyfgood/dsh-a2a. SkillHub is an independent community catalog and has no official affiliation with DeepSeek / High-Flyer.

Core Features

Inbound: DSH Agent as an A2A Server

  • Agent Card: /.well-known/agent-card.json (0.3.x) and /.well-known/agent.json (0.2.x compatibility).
  • JSON-RPC 2.0: message/send (synchronous), message/stream (SSE), tasks/get, tasks/cancel, tasks/resubscribe (resume after disconnection), agent/authenticatedExtendedCard.
  • Task lifecycle: submitted → working → completed/failed/canceled; supports pausing with input-required and multi-turn continuation under the same taskId.
  • Operations-related: version negotiation (A2A-Version / X-A2A-Version), optional Bearer authentication, CORS, single-turn timeout, task TTL reclamation.

Outbound: Agent Calling Remote A2A

Four model tools are registered by default (can be disabled with tools: false):

Tool Protocol Purpose
a2a_discover Fetch Agent Card Capabilities / skills / authentication
a2a_send message/stream (can fall back to send + polling) Send a message and wait for the final reply
a2a_task_status tasks/get Query a remote task
a2a_cancel tasks/cancel Cancel a remote task

Outbound targets are constrained by the clientAllowPatterns whitelist.

Visual Operations (since v0.2.0)

In the DSH Web client: a Plugins → @zyfgood/dsh-a2a configuration card, and an A2A tab in the Settings → Plugins section. The panel reads the plugin’s built-in /admin/status and /admin/tasks (same access control as Bearer and JSON-RPC), displaying server status, a recent tasks board, a directory of commonly used remote Agent Cards, and more.

Installation and Activation

Before installing, please review the repository source code and the MIT license yourself; the plugin runs with the permissions of the current DSH profile process, and public exposure requires combining bearerToken with network policies.

The bare npm name dsh-a2a points to an unrelated project (TtTRz/dsh-a2a). This plugin is published under the @zyfgood scope, so the scope must be included when installing.

# One-click install via the official CLI (npm channel, recommended; bundle patch mounted automatically)
dsh plugin --profile <name> add @zyfgood/dsh-a2a

# Or via GitHub
dsh plugin --profile <name> add github:zyfgood/dsh-a2a

# Or via local path
dsh plugin --profile <name> add file:D:/DSHProjects/dsh-a2a

Takes effect after restarting the profile. The default listening address is 127.0.0.1:7310. The repository ships prebuilt lib/ with the package, so no local build is required.

A typical fragment in the profile’s cordis.patch.yml:

- id: a2a
  name: '@zyfgood/dsh-a2a'
  config:
    port: 7310
    mode: agent

Commonly used configuration options (the complete table is in the README) include: host, publicUrl (required external URL for reverse proxy / TLS), bearerToken, mode (agent / llm / echo), provider / model, persistSessions, turnTimeoutMs, clientAllowPatterns, etc.

Typical Usage

Quick Verification of Agent Card and Synchronous Messages

First confirm the service is running, then run locally:

# 1) Agent Card (0.3 path)
curl http://127.0.0.1:7310/.well-known/agent-card.json

# 2) Send a message (synchronous)
curl -X POST http://127.0.0.1:7310/ -H "Content-Type: application/json" -d '{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "message/send",
  "params": {
    "message": {
      "kind": "message",
      "role": "user",
      "parts": [{"kind": "text", "text": "你好,介绍一下你自己"}],
      "messageId": "m-1",
      "contextId": "ctx-demo"
    }
  }
}'

On success, result is an A2A Task: status.state === "completed", and the reply text is in artifacts[0].parts[0].text. Calling again with the same contextId reuses the same DSH agent session (multi-turn memory).

Streaming message/stream

curl -N -X POST http://127.0.0.1:7310/ \
  -H "Content-Type: application/json" -H "Accept: text/event-stream" -d '{
  "jsonrpc": "2.0", "id": 2, "method": "message/stream",
  "params": {"message": {"kind": "message", "role": "user",
    "parts": [{"kind": "text", "text": "流式演示"}], "messageId": "m-2", "contextId": "ctx-demo"}}
}'

The SSE stream pushes, in order, status-update(working) → artifact-update → status-update(completed, final=true) and then ends.

Three Inbound Modes

  • agent (default): Each A2A contextId corresponds to a persistent DSH agent session (with full tools, skills, and working directory); the mapping can be persisted to $DSH_HOME/a2a/ and restored on restart.
  • llm: Responds directly via ctx.llm, without creating an agent session; short-term memory is controlled by maxHistory.
  • echo: Echoes the original text; used for pipeline verification.

The agent mode requires an available model: the plugin resolves the configured provider / model, or falls back to the profile’s default model; if neither is available, the task fails explicitly rather than returning an empty reply.

Outbound Conversation Example

You can express this naturally in a DSH agent conversation, for example: use a2a_send to call the agent at http://其它机器:7310/, ask about its skills, and summarize the results. The actual reachable address must fall within clientAllowPatterns.

How to Choose Among DSH Built-in Capabilities

Requirement Recommendation
Driving DSH agents programmatically from outside the process Built-in ACP (dsh-acp)
Mounting external tools / resources Built-in MCP client
Interoperating with the A2A ecosystem (ADK, A2A SDK, gateways) @zyfgood/dsh-a2a

Conclusion

If your workflow requires standard A2A inbound exposure or multi-agent interconnection via the protocol, you can install @zyfgood/dsh-a2a in your profile, verify with curl or the Web panel, and then connect external clients. Details and the configuration table are based on the GitHub README: https://github.com/zyfgood/dsh-a2a; catalog entry: https://www.skillhub.cn/plugins/zyfgood/dsh-a2a.

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

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

Xiaoye