Passer au contenu principal
F

dsh-approval-reason-dock

fzqxdedafeiyu/dsh-approval-reason-dock

Add an optional rejection reason to approval prompts: the text is steered into the running turn before the rejection is answered, and the panel only follows the session you are currently viewing.

Installer

dsh plugin --profile web add github:fzqxdedafeiyu/dsh-approval-reason-dock

README

dsh-approval-reason-dock

CI npm License: MIT Listed on dsh-plugin.org

An additive web-client plugin for DeepSeek Harness that lets you type an optional rejection reason on approval prompts. The reason is delivered into the running turn as a steering user message before the approval is answered as rejected, so the model reads it in its next step instead of guessing why the action was denied.

中文说明

Preview

Approval reason panel over the built-in approval card

Why

Harness approval prompts offer Allow once / Reject only. The rejection result is a closed outcome value with no reason channel, so a rejection reaches the model as a bare "the user rejected tool X". When a denial carries context ("the network is unreliable", "do not touch that file yet"), it belongs in the conversation immediately — not in a follow-up turn.

This plugin adds a small frame-wide panel on top of the host UI. It does not replace the built-in approval card, does not change the approval protocol or audit events, and fails soft: if the panel cannot render, the built-in card keeps working exactly as before.

Behavior

  • While the active session has an answerable approval, a panel appears in the top-right corner (shell.overlay slot).
  • The panel follows the session shown in the main view: only that session's approval is offered, and approvals in other sessions stay quiet until you switch to them. The panel header shows the session title.
  • The panel starts expanded and can be collapsed into a semi-transparent “Pending review” pill so it does not cover the conversation; clicking the pill expands it again. Each new approval starts expanded.
  • Reason drafts are kept per approval, so switching between several sessions with pending approvals does not wipe the text typed for the other one.
  • Type a reason and press Reject with reason:
    1. (approval rejection reason) <text> is sent into the running session as a steering user message (remote.session.prompt with mode: "steer");
    2. if the turn no longer accepts steering, it is queued (mode: "queue") instead;
    3. the approval is then answered as rejected.
  • Rejection closes the panel immediately. Only a failed reason delivery keeps a dismissible error notice with the error code.
  • Reject answers without a reason, same as the built-in button.

Non-invasive by design

This is the plugin's core selling point: it adds a layer; it does not change DSH's security architecture.

  • Client-only bundle. No host half, no HTTP routes, no tools/* hooks — nothing of this plugin runs inside the DSH host process.
  • The built-in approval card is never replaced or edited. The approval protocol, audit events, sandbox policy and permission checks stay exactly as shipped. The plugin only reads pending-approval metadata, calls the same answer() the built-in card calls, and delivers the reason through the normal session prompt path.
  • Fail-soft. If the panel cannot render or crashes, approvals keep working through the built-in card with native behavior.
  • Subagent sessions are left alone. DSH disables approval prompts there and auto-rejects escalation; the plugin never claims those interactions and renders nothing.
  • Human-readable trail. The reason is an ordinary steering user message, so the transcript records what was rejected and why — useful when a human reviews or debugs a session later.

Install

Requires DSH 0.2.2-rc.1 or a later 0.2.x release (see engines.dsh).

Version match:

DSHPluginStatus
0.2.1-rc.20.1.0verified stable; 0.1.1 is not supported on this line
0.2.2-rc.10.1.1+verified (all 0.1.1 real-machine tests ran here)

On DSH 0.2.1-rc.2, install the verified older line explicitly:

dsh plugin --profile web add dsh-approval-reason-dock@0.1.0

Why 0.1.1 does not claim 0.2.1: it needs the client-side uiSession service declared in exports.inject, and that service was not verified to exist in the 0.2.1 client runner. The DSH plugin manager evaluates engines.dsh for compatibility, so 0.1.1 may be flagged as incompatible on 0.2.1; pinning @0.1.0 avoids depending on that check.

0.1.2 is a documentation/market-sync release: runtime behavior is identical to 0.1.1, but the tagged release now carries the market materials (dsh-plugin.org listing badge, CLI install command, split English/Chinese preview images and screenshots.json).

Install with the DSH CLI (npm package):

dsh plugin --profile web add dsh-approval-reason-dock

Preferred: install the bundle from the DSH UI (Plugin Manager → install bundle) using the npm package name or the GitHub spec:

dsh-approval-reason-dock
github:FzqxDedafeiyu/dsh-approval-reason-dock

Or from GitHub source with the CLI:

dsh plugin --profile web add github:FzqxDedafeiyu/dsh-approval-reason-dock

Manual profile patch (if you manage the profile yourself): add the bundle to dsh.profile.bundles and let its patch insert the row:

- insert:
    - id: approval-reason-dock
      name: dsh-approval-reason-dock

The bundle ships cordis.patch.yml, index.js (empty Host half), client.js (browser half), locale/*.json and icon.svg.

Compatibility and risks

  • The browser half uses DSH client internals: the shell.overlay slot, uiSession session-status interactions, and remote.session.prompt. These APIs are not a stable public contract; a Harness upgrade may require a plugin update.
  • If an internal API is missing, the panel stays hidden and approvals still work through the built-in card (fail-soft).
  • The plugin sends no network requests and reads no session content beyond the pending approval metadata.

Privacy

The reason you type becomes a normal user message in the session log and model context (capped at 500 characters, plain text, never rendered as HTML). Nothing is sent anywhere else.

Uninstall

Remove the dsh-approval-reason-dock entry from dsh.profile.bundles (or use Plugin Manager → uninstall), then restart DSH.

Development

node test/harness.mjs

The harness checks the manifest/packaging shape, loads the real client.js factory, and drives the approval flow (reason delivery, steer→queue fallback, failure notices, already-settled approvals) against a fake React/Cordis/slot environment. npm run pack:check verifies the published file list.

Repository layout:

client.js           browser half (window.__ModuleLoader__ bundle)
index.js            host half (no-op apply)
cordis.patch.yml    Loader row
locale/{en,zh}.json display metadata
icon.svg            plugin icon
test/harness.mjs    sandbox tests
.github/workflows/  CI

Maintenance

Release, install/rollback, upgrade smoke tests and troubleshooting are documented in the maintenance handbook (Chinese, written for this deployment).

License

MIT. See LICENSE.

Plugins associés