dsh-rea-gate: Session-Based Control of REA Tool Visibility

Introduction

DSH registers approximately 263 mcp__rea__* tools in every session, most of which go unused, and their schemas still consume context. If REA is already installed in the host, this plugin allows REA to expose its tools only in sessions that actually need them, keeping them hidden in all others.

What It Is

dsh-rea-gate is a DSH plugin maintained by MistRipple, categorized under admin-security. Its core purpose: keep the REA installation in the host while deciding on a per-session basis whether its tools are visible to the model.

Core Features

  • Per-session REA tool visibility control: Achieved by restricting the agent’s toolset, rather than uninstalling REA.
  • Global default + per-session toggle: Sets a default value for all new sessions, while each running session has its own independent switch.
  • Mid-session activation: No need to restart DSH; you can toggle directly within a session.
  • Multiple management surfaces: Control panels are available in the sidebar REA panel, the plugin detail page (Plugins → dsh-rea-gate), and the REA dropdown beneath each session’s input box.
  • Agent tool: Registers the rea_gate tool, supporting status, on, and off actions. Install, update, and uninstall operations are performed exclusively through the admin panel.

Installation

In DSH Desktop, go to Plugins → Discover, search for REA, and install. A DSH restart is required after installation for the plugin to take effect.

In a CLI profile, the corresponding command is:

dsh plugin --profile <profile> add dsh-rea-gate

Enabling & Configuration

Opening the Control Panel

  • Find the REA row in the sidebar.
  • Locate the dsh-rea-gate detail page under Plugins.
  • The REA dropdown located at the bottom-left of each session input box, to the right of the permission controls.

The panel and the plugin detail page control the default behavior for new sessions; the dropdown only affects the current session.

Per-Session Toggle

  • Use the REA dropdown below the session input box, or the agent tool:
rea_gate status
rea_gate on
rea_gate off

Default Configuration

State is persisted in $DSH_HOME/rea-gate.json with the following content:

{ "default": false }
  • default controls the initial state of newly created sessions.
  • Only applies to new sessions; already-running sessions will not change their tool list due to modifications to this value.
  • Rules saved by older versions are ignored and discarded on the next write to the file.

How It Works

  • When a session is created (agent/created), the plugin reads the state file. If the session is default-off, it calls agent.ctx.tools.restrict({ deny: [...] }), placing the currently registered mcp__rea__* tools on the deny list so they disappear from the model’s tool list.
  • When tools are enabled mid-session, the plugin calls tools.restrict again, removing the REA tools from the deny list.
  • If REA connects after session creation, or new tools are added after an update, the plugin periodically scans and hides those new tools from sessions that are off; the dropdown will display REA off (pending).
  • Reloading the plugin re-applies each session’s individual selection; records for destroyed sessions are cleaned up.

Permissions & Side Effects

Installation

Runs rea setup --client dsh --yes. If the rea command is not found, the plugin first runs npm install --global rea-agents@latest, downloading and installing an unpinned package from npm.

Uninstallation

Runs rea uninstall. This command is not client-specific and will remove REA’s registrations and skill files for all clients, not just DSH. The panel will request confirmation first. Checking an additional checkbox will also run npm uninstall --global rea-agents.

Agent Access Restrictions

The agent can only use status, on, and off. Install, update, and uninstall operations can only be performed through the admin panel.

Checking for & Applying Updates

  • Checking for updates runs npm view rea-agents, which connects to the npm registry.
  • Updating runs rea update.

One-Click Engine Installation

The plugin supports one-click installation of Ghidra, Java (Temurin 21), apktool, and adb on macOS, Linux, and Windows. Specific behavior:

  • macOS (with Homebrew): Uses brew install ghidra, brew install openjdk@21, brew install apktool, brew install --cask android-platform-tools.
  • Other systems (Linux, Windows, macOS without Homebrew): Downloads from official sources: Ghidra and apktool from GitHub releases, Temurin 21 from adoptium.net, platform-tools from dl.google.com.
  • Each archive must satisfy the vendor-provided checksum (SHA-256 or SHA-1), is extracted to $DSH_HOME/rea-engines/, and the path is written to REA environment variables.

Engine Environment Variables

The plugin can register REA environment variable writes with DSH, such as GHIDRA_INSTALL_DIR, JAVA_HOME, REA_APKTOOL_COMMAND, etc. Values must be absolute paths of the corresponding type (~ will be expanded). Path type validation is performed before saving, and invalid values are rejected. Some variables point to programs that REA executes; only point them to trusted software.

npm Cache Corruption

If npm install fails due to a corrupted _cacache entry (ENOENT or EINTEGRITY), the plugin retries once using a temporary cache without affecting the user’s npm cache.

Browse Buttons

Each engine path field has a folder icon. Clicking it invokes the system file picker (AppleScript on macOS, PowerShell generic dialog on Windows, zenity or kdialog on Linux). The selected path only fills the field and is not written to configuration until saved.

Language & Access

  • Panel messages use the browser language (zh-* for Chinese, English for all others).
  • HTTP routes are located at /api/dsh-rea-gate/ and are accessible only through authenticated connections.

Use Cases & Notes

Suitable for users who need to isolate REA tools per session, reduce context overhead, and manage multiple REA instances in a unified manner.

Notes:

  • The plugin runs with the permissions of the current DSH process. It is recommended to review the source code and license before installation.
  • Uninstalling REA removes configuration for all clients. Please confirm carefully.
  • Default-off saves context; to enable by default, modify default in the state file.

Conclusion

dsh-rea-gate controls tool visibility on a per-session basis, reducing unnecessary context overhead while preserving the REA installation. For more details and source code, refer to:
- Plugin directory page: https://www.skillhub.cn/plugins/MistRipple/dsh-rea-gate
- GitHub repository: https://github.com/MistRipple/dsh-rea-gate

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

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

Xiaoye