返回目录

dsh-sidebar-reader

精选清单收录维护状态: 活跃

lafantasque520/dsh-sidebar-reader

让模型读取当前会话侧栏中的活动标签页、打开的标签页、终端画面和浏览器页面文本。

前往 GitHub
$ dsh plugin add dsh-sidebar-reader

安装

dsh 没有统一的安装命令——把该插件 README 中的配置行加入你的 profile/patch 配置,然后重启即可。

了解安装方式

0

星标

0

Fork

JavaScript

语言

MIT

许可证

2026-11-03

创建于

2026-11-16

最近推送

README

dsh-sidebar-reader

English | 中文

Let your model read the current session's sidebar on demand: the active tab, official right-sidebar tabs, terminal screens, and browser page text.

Once installed, just tell the model "read my sidebar" or "show me my terminal" — the model triggers a capture through the plugin's command channel and receives a snapshot within seconds.

How it works

model ──POST /sidebar-reader/command──▶ host route (lib/index.js)
                                  client polls every 2s
                                          ▼
                     client capture (lib/client.js, runs in the Web UI)
                     ├── active tab (sidebarRight.active(), active pane's active tab)
                     ├── right-sidebar tabs (sidebarRight.openTabs, current session only)
                     ├── terminal screens (remote.terminal.attach, first snapshot → ANSI-free,
                     │    incremental vs. the previous read)
                     └── web page text (webview innerText, desktop only)
                                          │
              client ──POST /sidebar-reader/latest──▶ host keeps the latest snapshot only
model ◀──GET /sidebar-reader/latest─── host

Agent tool (auto-registered)

The plugin's host side registers a native agent tool sidebar_read with the DSH tool registry: it appears in every new session's tool list automatically, and one call returns the full snapshot — no HTTP, no configuration. The "prefer this over pwsh/web_fetch for terminal or page questions" preference is encoded in the tool description itself.

The only parameter is delta (default true): terminal screens are incremental after the first read. Pass delta: false when you need every terminal's complete screen again.

The HTTP endpoints below remain as a fallback channel.

Features

Channel Source Notes
Active tab sidebarRight.active() The active pane's active tab (id / kind / title / contentId), plus expanded telling whether the column is showing
Right-sidebar tabs sidebarRight.openTabs live snapshot Every open tab of the current session (tabId / kind / contentId)
Terminal screens remote.terminal.attach first snapshot frame Full screen including scrollback, ANSI-stripped, then incremental (see below); input control is released right after reading
Web page text Sidebar browser webview innerText Desktop (Electron) only; strict mode, see below

Three passes on terminal text

A raw xterm screen is a poor thing to hand a model: it is full of color/cursor escapes, it repeats the whole scrollback on every read, and it can be arbitrarily long. So every terminal screen goes through three passes in lib/client.js:

Pass What it does Why
stripAnsi Drops ANSI/OSC escape sequences and invisible control characters Escapes are pure token cost and unreadable
screenDelta Remembers each terminal's last reported screen (per terminal id) and returns only the new part; falls back to the common line prefix when the screen was redrawn; returns the whole screen when nothing matches, so text is never lost Repeated reads cost a fraction of the context
capScreen Keeps only the tail, max 500 lines / 20 000 chars per terminal Scrollback can be huge; the newest output is at the bottom

Each terminal entry therefore carries screen (clean text), delta (false = this is a complete screen, i.e. the first read of that terminal or an explicit delta:false) and truncated (true = the caps kicked in). delta:false also refreshes the delta baseline, so the next incremental read stays consistent.

Strict mode for web page text

The page is read only when the active tab is a browser and the column is expanded. Otherwise page is null.

Why: when a sidebar browser tab moves to the background, its webview stays in the DOM with zero width, and the fallback picker would still return it — the model would receive a page the user is not looking at. null is better than the wrong page.

What you get

What you are looking at Readable Notes
A page in the sidebar browser ✅ title + URL + text Must be the active browser tab, with the column expanded
A file / document tab ⚠️ address only You get its contentId (e.g. dsh-resource://file/...); read the file by that path
A terminal ✅ screen text ANSI-free; first read is the full screen, later reads add only new lines (max 500 lines / 20k chars per terminal)
Plain web build (browser access) ❌ page text No webview; tabs and terminals still work

Snapshot example

{
  "page": { "title": "…", "url": "https://…", "text": "…", "chars": 1235 },
  "right": {
    "sessionId": "session-…",
    "expanded": true,
    "active": { "id": "tab5", "type": "browser", "title": "Browser", "path": "sidebar://browser/…" },
    "tabs": [
      { "id": "tab3", "type": "files", "path": "sidebar://files" },
      { "id": "tab5", "type": "browser", "path": "sidebar://browser/…" }
    ]
  },
  "terminals": {
    "sessionId": "session-…",
    "terminals": [
      { "id": "…", "title": "…", "state": "running", "screen": "…", "delta": false, "truncated": false }
    ]
  },
  "commandId": "cmd-…",
  "receivedAt": "2026-11-08T13:11:42.350Z"
}

Design disciplines:

  1. Scope — everything is filtered to the session on screen before leaving the browser; other sessions are unreadable;
  2. Never throws — each channel degrades independently; one failing channel doesn't break the others;
  3. Transparent — a toast is shown on every read;
  4. Revocable — all side effects live in ctx.effect and are cleaned up when the plugin is disabled.

Install

在 GitHub 阅读完整 README →

DSH Plugins 是独立的 DeepSeek Harness 插件目录,与 DeepSeek 官方无关,也不代表官方背书。第三方插件未经安全审计,安装前请审查源码。

每周获取最新的 DeepSeek Harness 插件,绝不滥发。