dsh-peer-sessions: Allowing two peer DSH sessions to communicate under user authorization

Preface

In DeepSeek Harness (DSH), you often run multiple long-lived sessions—for example, one watching a backend API and another watching a frontend client. Changing a contract, waiting for the other side to finish, and then confirming: if this relies entirely on manual copy-pasting or repeatedly switching windows, the cost is high and it’s easy to miss things.

DSH already provides send_message / list_agents based on the “parent owns child” (isOwnedBy) model, which fits the subagent scenario: when one side ends, the other usually should too. But if both sessions are driven by you, neither is subordinate to the other, and you want them to continue working independently, you need a different mechanism.

The following introduces the community plugin dsh-peer-sessions (maintainer OwlNjust, repository OwlNjust/dsh-peer-sessions). It establishes a symmetric, user-authorized channel between same-level sessions, allowing two sessions you drive to message each other—no superior, no subordinate.

What Is This

The current version of the plugin is 1.3.0 (MIT license), requiring Node ≥ 20 and dsh ≥ 0.2.0-0; features like persistent authorization require dsh ≥ 0.2.1 (older hosts still work, but authorization falls back to process lifetime and emits a warning).

The typical use case is two long-lived sessions—for example /srv/orders-api and /srv/web-client—where one notifies the other when it changes the API contract, and the other replies after finishing its changes. The boundary with subagents is stated plainly in the README:

One side ending means the other should also stop—that’s a subagent.
Both can keep living independently—that’s a peer.

The plugin does not declare client code: commands go through the existing chat UI, authorization goes through the user-questions UI, and message origins are rendered via form: 'relay'.

Hard Rule: Visibility

The list of agents a session can talk to must be a subset of the list a human can see in the sidebar; you cannot address sessions invisible to humans.

The addressable set comes from the sidebar visibility rules (sessionVisible in dsh-client-ui-workspace), with implementation details governed by classify in lib/addressable.js. Exclusions include: subagent-originated sessions (origin === 'subagent'), archived sessions, and blank placeholder sessions. Every delivery re-reads the list; archiving a peer immediately cuts off reachability.

Core Features

User Commands

Command Effect
/peers List channels: peer, authorization tier, remaining quota, peer visibility
/peer connect <title> [once\|session] Establish a channel; tier selection goes through a native option card
/peer revoke <title> Disconnect the channel
/peer progress <title> View peer progress

Model Tools

Tool Effect
peer_send Send a message; triggers an authorization card when unauthorized
peer_inbox Read the inbox: summary list, or fetch the full body by id
peer_progress Read peer projection and summary
peer_list View channels and permissions

Loop Protection and Waiting Style

Two sessions replying to each other could continue indefinitely, so the limits are enforced before delivery; rejected deliveries do not consume quota nor advance the chain. Defaults (all overridable via config) include:

Protection Default Description
Per-pair rate 30 messages / 60s Fixed window per channel
Per-pair total 200 messages Total deliveries over a channel’s lifetime (once tier = 1)
Hop limit 3 hops Depth of causal-chain relay across sessions
Request timeout replyWithin Notify the originator once when the deadline passes, no auto-resend

Delivery is “idle-first” in both directions: your message does not interrupt the peer’s current turn; the peer’s reply also does not interrupt your current turn, but starts a new turn instead. Therefore the agent should not sleep, poll, or hang on wait_agent to wait for a peer; it should end the turn and wait for a wakeup, or actively pull delivered content with peer_inbox within the current turn.

During long tasks the same session may send multiple messages; unread queued messages are merged into one batch (each still carrying its sent timestamp), while the inbox still stores them separately by message id. Full behavior is documented in the repository’s README.zh.md.

Data and Persistence (v1.3.0)

Authorization is written into the approving session’s log (plugin record type plugin:dsh-peer-sessions/channel); channels survive a dsh restart until /peer revoke. “In-flight” state such as inbox and rate windows remains in process memory; the boundary for peer_inbox retrieving body content is the host process lifetime. Authorization is recorded on the approving side; if the peer restarts and speaks first, it will ask its human for authorization again.

Installation and Activation

The plugin runs with dsh process privileges; review the source and the MIT license yourself before installing. The community directory SkillHub entry and GitHub have no official DeepSeek / Hithink RoyalFlush affiliation; the DSH ecosystem itself follows the “everything is a plugin” philosophy.

Choose only one of the two installation routes; duplicate installations won’t error, but composition layers may silently shadow a config line, causing some settings to take no effect.

Route A: Bundle (Plugin Manager)

This package declares dsh.bundle, which the dsh 0.2.0+ plugin manager can install as a composition layer; in most cases you don’t need to manually edit profile files.

Desktop: open “Manage Plugins” and fill in the repository URL or npm package name.

CLI (except the desktop profile—officially no CLI plugin management for it):

dsh plugin --profile <profile> add <repo URL or package name>

Desktop installs a git snapshot; after a release you need to update it in the manager.

Route B: Local Directory + install.sh

In the plugin source directory, run:

./install.sh

The script will: link node_modules into the host’s actual deployment, add a profile dependency (link: path), append cordis.patch.yml insert lines as needed, and copy (not symlink) the skill to ~/.dsh/skills/peer-session/. The target can be specified via the environment variables DSH_PROFILE (default web) and DSH_HOME (default ~/.dsh).

After installation, you must restart the corresponding profile and verify with /peers.

To uninstall, run ./uninstall.sh; a profile restart is also required. See the uninstall section of the README for details.

Typical Usage

  1. In two same-level sessions you have open, type /peer connect <peer title> session (or once) in the approving session, and confirm the authorization tier on the option card.

  2. On either side, use /peers or have the model call peer_list to view channels and remaining quota.

  3. When you need to notify the peer, have the model call peer_send; if unauthorized, a consent card will pop up.

  4. If you need to continue other work in the current turn, use peer_inbox to pull delivered replies instead of blocking and waiting.

  5. To check the peer’s working state, use /peer progress <title> or peer_progress.

  6. When interop is no longer needed, run /peer revoke <title>.

Configuration

Set config for the plugin id dsh-peer-sessions in the profile composition line. Example (values are examples from the documentation, not all defaults):

- id: dsh-peer-sessions
  name: dsh-peer-sessions
  config:
    hopLimit: 5
    rateLimit: 60
    rateWindowMs: 60000
    channelBudget: 500
    inboxLimit: 100
    requestMemory: 1000
    pendingGraceMs: 86400000
    hopMemoryMs: 900000
    maxCandidates: 8
    recentTurns: 3
    previewMaxChars: 200

Note: config is replaced wholesale at the composition layer; when multiple layers override, the later object wins entirely as a block; omitting config entirely uses the schema defaults (consistent with the README configuration table). A plugin that fails validation may only warn at startup and silently fail to load.

When to Use and Caveats

Good for: parallel multi-repo, multi-service development where two long-lived sessions need to negotiate interfaces or sync progress, and you want a peer-to-peer relationship rather than a subagent parent-child task.

Not for: one-off delegation requiring strict “child task ends, parent task converges” semantics—continue using subagents and the existing send_message system.

Before diving into code changes or troubleshooting wiring issues, the repository’s MAINTENANCE.md documents four invariants and common pitfalls; the behavioral spec is defined in docs/design.md.

Wrap-up

dsh-peer-sessions fills the “same-level sessions, user-authorized, symmetric interop” layer in DSH: under sidebar visibility constraints, it uses commands and the peer_* tools to let two sessions collaborate, while controlling loop risk with rate, total, hop, and replyWithin limits.

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

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

Xiaoye