dsh-agents-viewer: Display the AGENTS.md instruction chain in the DSH right sidebar

Preface

Debugging agents in DSH (DeepSeek Harness) inevitably involves AGENTS.md. The global ~/.dsh/AGENTS.md, the shared ~/.agents/AGENTS.md, plus AGENTS.md / CLAUDE.md / AGENTS.local.md / CLAUDE.local.md in every directory from the project root to the session cwd—the files are scattered and layered. After making changes, you have to guess which next tool call will read them. dsh-agents-viewer consolidates these instruction files into a single entry point: viewing and editing in a native tab in the right sidebar, a one-click button in the chat header, and a separate /agents command that doesn’t depend on the interface. It focuses on editing and viewing, not rewriting DSH’s instruction loading logic.

What is this

dsh-agents-viewer is a DSH dual-face bundle plugin: the host half is in index.js, the client half is in runtime/client.js, and it is declared via the dsh.client property in package.json. Maintained by atrestandbed-bot, package version 0.7.0, MIT license.

It requires DSH with ctx.sidebarRightTabs. The README specifies that 0.2.2-rc.1 (Electron 44.7.0) has been verified, engines.dsh only sets a lower bound of >=0.2.2-rc.1 with no upper limit, dsh.client.inject is empty, and the service is detected at runtime. The author’s trade-off is: no need to update the manifest for DSH minor version updates; if the API truly changes, at worst a tab is missing, but DSH will still start.

Core Features

Native Tab in Right Sidebar

Open AGENTS.md in the right sidebar’s “Add” menu or guide page. It uses DSH’s own tab, split pane, fullscreen, drag, and collapse features, rather than a floating drawer with a mask, or techniques like requestAnimationFrame following or an “wait 30 seconds fallback button”.

Chat Header Button

To the left of the cluster of file/sidebar buttons is an AGENTS.md icon. Clicking it opens the native tab. If the right sidebar is already expanded and the current tab is AGENTS.md, clicking again collapses the sidebar. The button is visible by default; /agents c and /agents o write the state to a persistent file, and the button will show or hide based on the new state after the next DSH startup.

Complete Instruction Chain

The panel covers the global ~/.dsh/AGENTS.md, the shared ~/.agents/AGENTS.md, and AGENTS.md / CLAUDE.md / AGENTS.local.md / CLAUDE.local.md in every directory from the project root to the session cwd. The panel and the /agents command are on the same footing; files in subdirectories can be edited directly. Any subdirectory outside this chain does not appear.

Precise Project

The tab body gets sessionId and useSessions from standard props. The host looks up ~/.dsh/storages/workspace.json by reverse lookup of the session id to locate the workspace, no longer guessing by “recently updated workspace”. It only falls back to the recent workspace if a session cannot be found, marks “Inferred” on the tab, and confirms before saving.

Inline Edit and Save

Select in list → Edit → Ctrl+S or “Save”. If the file does not exist, writing the content creates it.

Installation and Activation

It is recommended to install this package directly via DSH’s plugin page; it will automatically handle dependencies and bundles. Alternatively, run npm run adapt:install in this checkout.

Manual installation into a profile (taking the Windows desktop profile as an example) involves three steps. This script does: first, copies the package directory into the profile’s node_modules; then, registers dependencies and bundles in the profile’s package.json; finally, restarts DSH.

$profile = "$env:USERPROFILE\.dsh\profiles\desktop"
$name    = "dsh-agents-viewer"

# 1) Copy package directory in (must include runtime/)
Copy-Item -Recurse -Force "<path-to-this-package>" "$profile\node_modules\$name"

# 2) Register in profile's package.json:
#    Add "dsh-agents-viewer": "file:<absolute-path-to-this-package>" to dependencies
#    Append "dsh-agents-viewer" to the end of dsh.profile.bundles
#    Note: bundles are the "enable" switch; being in dependencies only means "installed but not enabled".

# 3) Restart DSH (client tab type registration happens at startup)

It is advisable to back up the profile’s package.json and cordis.patch.yml before making changes.

After upgrading DSH, you can run the adaptive check first to see if the version, engines, and profile copy are consistent:

npm run adapt          # Only checks: version, engines, profile copy consistency
# After exiting DSH, when syncing this checkout to the profile:
npm run adapt:install

Additionally, a manual manifest verification script is provided, which can specify the installation location or check app.asar:

node scripts/check-compat.mjs
# Or specify installation location
node scripts/check-compat.mjs --asar "D:/Program Files/DeepSeek Harness/resources/app.asar"

It verifies that each package in dsh.client.inject exists, if engines.dsh accepts the current version, and if the client bundle is still registered via window.__ModuleLoader__.load. When DSH changes module names, it will report FAIL here first.

Typical Usage

The /agents command does not depend on the interface and is available anytime:

/agents                List all AGENTS.md
/agents <index>        View full text
/agents all            View all
/agents w <index>      Open in external editor
/agents n              New (project level)
/agents n global       New global
/agents n shared       New shared
/agents o              Record "show button" (takes effect next startup)
/agents c              Record "hide button" (takes effect next startup)
/agents help           Usage

Interface paths are equivalent to command paths: open tab in right sidebar “Add” menu, click header button to toggle, select and edit in list, Ctrl+S to save.

Implementation Details

Just look at a few notable points in the implementation logic:

  • The client registers the page type using ctx.sidebarRightTabs.register({ id, kind, priority, title, guide, keepMounted }) and mounts the body via ctx.slots.register({ name: 'sidebar.right.pane.tab', key: id }, Body). Standard props for the body are directly passed to sessionId and useSessions, without DOM observation or URL parsing.
  • The header button is registered into conversation.session.header.utilities (list slot, order: -100). On click: collapse sidebar → openTab('agents'). If expanded and current tab is agents → toggleExpanded() to collapse. If expanded but different tab → switch to agents.
  • The host uses webServer.register to expose /dsh-agents-viewer/list, /read, /write, and resolveProject(hint) reverse looks up session-<uuid> in the hint to find workspace.json.
  • The whitelist is global/shared plus the directory chain from root to cwd; all other paths return 403. Writing to disk uses fs.writeFileSync in the host process directly; the whitelist is the only entry point.
  • Regarding compatibility, the client only Cordis-injects slots, and uses nested ctx.inject for sidebarRightTabs / sidebarRight as needed. The host checks types for webServer.register / commands.register / workingDirectory.ensure, logging a warning if missing. webserver/index-inject wraps everything in try/catch, so plugin exceptions won’t turn the index into a 500 error.

Applicable Scenarios and Notes

Suitable for developers maintaining AGENTS.md instruction chains in DSH: those who need to edit across global, shared, and project layers, or those who need a fallback command independent of the interface. The compatibility range marked in the README is dsh >=0.2.2-rc.1, verified version is 0.2.2-rc.1 (Electron 44.7.0).

A few points to be aware of:

  • The plugin runs with the current DSH process permissions and can read/write paths within the whitelist; read the source code before installing to confirm the license is MIT.
  • Panel save does not trigger instruction hot refresh: the host writes directly to disk, and dsh-agent-instructions only refreshes on the next read / write / edit tool call. To see the new content immediately in the current session, open a new session or have the agent perform a read/write on that file.
  • /agents o and /agents c are not instant toggles; they only change the persistent state. The button reads the state on the next DSH start or page load refresh.
  • First install or upgrade requires restarting DSH; the client module graph assembles at startup.
  • Before modifying profile bundles, connections, or startup items, fully exit DSH: changes while running trigger HMR, the current browser connection is swapped, and ongoing sessions end with turn/end: aborted / disposed. Only changing code in the plugin working directory allows hot reload.
  • The directory page is a community site plugin list, has no official affiliation with DeepSeek / Hypersphere, and is not an official app store.

Additionally, the README specifically explains that a class of desktop welcome: Web authentication failed startup failure is not caused by the plugin. The failure point is in the desktop shell exchanging cookies with the newly started Host. The plugin has not yet participated. The way to judge is whether the --- error --- in the crash log is that message, and whether it continues to crash after clicking “Disable Third-Party Plugins”.

Conclusion

The value of dsh-agents-viewer lies in consolidating scattered AGENTS.md into DSH’s native interface, using the same channel for reading and editing, and leaving a command channel independent of the interface. Directory page: https://www.skillhub.cn/plugins/atrestandbed-bot/dsh-agents-viewer ; Source code: https://github.com/atrestandbed-bot/dsh-agents-viewer

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

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

Xiaoye