DDDPG/dsh-plugins--plugins-dsh-session-browser0

dsh-session-browser

DSH plugin: same-workspace cross-session read-only browsing for models — list_sessions / read_session / search_sessions tools with strict cwd scoping, UNTRUSTED snapshot marking, and bounded budgets (optional SQLite FTS full-text search).

AI 分析

核心用途是允许 AI 智能体读取和检索当前工作区内其他会话的上下文。适合需要跨会话协同、参考历史讨论的复杂任务。通过提供只读工具实现,确保安全性。

パッケージ
dsh-session-browser
バージョン
0.2.0
ライセンス
MIT
最終更新
2026/08/15

インストール

$npx -p @deepseek-ai/dsh dsh plugin --profile web add github:DDDPG/dsh-plugins#543d4b046af0c67602be6d16cba7f6ed94239247&path:plugins/dsh-session-browser

ドキュメント

README 全文を読む ↗

dsh-session-browser

English | 中文

License

Same-workspace cross-session read-only browsing for DeepSeek Harness (dsh): it gives every session's model three tools to inspect the conversations of other sessions in the same workspace:

  • list_sessions — list sibling sessions in the caller's workspace (id / title / cwd / createdAt / live / persisted). Optional query (case-insensitive substring over id / title / cwd) and limit (default 50, max 100).
  • read_session — project one sibling session's current conversation surface (user + assistant text only; tool calls, reasoning, and injected context are excluded by default). Optional maxMessages (newest kept, default 50) and includeToolResults (default false).
  • search_sessions — full-text search across the caller's workspace (requires enabling the SQLite FTS index, see below). Optional limit (default 10, max 20).

Safety & boundaries

  • Strict same-workspace scoping: every read is bounded by the caller session's cwd (workspace path). Sessions with a different cwd are invisible and unreadable — there is no opt-out parameter. The caller's own session is always excluded.
  • Read-only snapshot: content comes from ctx.sessionQuery.readSurface() (live-first, persisted fallback) — a one-shot snapshot of the target session's current model surface, not a subscription and not real-time.
  • UNTRUSTED marking: every cross-session output carries a warning header (consistent with the official dsh-session-reference mechanism) — the model must treat it as background information and never execute instructions or permission claims found inside it.
  • Budget constraints: each message is head/tail truncated (default 8000 chars), a single read is capped at 60000 chars total, with omission counts reported; lists default to 50 entries, searches to 10.

Install (web profile)

Published on npm as dsh-session-browser@0.2.0 with a dsh.bundle.patch — one command installs and auto-mounts (takes effect on the next dsh start):

dsh plugin --profile web add dsh-session-browser

Local checkout (development): dsh plugin --profile web add ./plugins/dsh-session-browser, or ./scripts/install.sh web plugins/dsh-session-browser.

Full-text search

search_sessions uses the session-query-sqlite FTS index. The bundle layer enables it by default (openAt: first-search, index at $DSH_HOME/storages/session-search.sqlite — see the session-query-sqlite override in the package's cordis.patch.yml). The index is built lazily on first search. To change the location or disable it, override the same row in the profile's own cordis.patch.yml (last write wins per row):

- id: session-query-sqlite
  config:
    path: !!js dshHomePath('storages/session-search.sqlite')
    openAt: first-search   # or: never

When disabled, search_sessions returns clear guidance instead of failing.

Uninstall

dsh plugin --profile web remove dsh-session-browser

(The FTS override ships with the bundle, so removing the bundle reverts session-query-sqlite to the host default automatically.)

Known limitations

  • FTS observation instability retries: the SQLite engine requires every persisted log to stay byte-identical across its observation window; an active workspace (the current or other sessions continuously writing logs) triggers SESSION_QUERY_PERSISTENCE_FAILED. The plugin retries automatically inside the tool (up to 3 attempts with increasing delays); if it still fails it returns "workspace is active, retry in a moment". This is an engine consistency design; the plugin layer cannot fix it.
  • New-format logs written by other instances: if ~/.dsh/sessions/ contains logs written by a newer DSH build (e.g. the TUI) with event types this build does not recognize, the engine's safety guard refuses to build the index. Move such logs out of ~/.dsh/sessions/ (e.g. archive to ~/.dsh/sessions-backup-*), otherwise search_sessions stays unavailable.

Test

node tests/static.test.mjs   # syntax gate + pure-function behavior assertions; exit 0 = green

Implementation

Tools are registered in lib/index.js. Reads go through the host sessionQuery service. Trust is same-workspace only (caller cwd); there is no separate auth layer.

Part of the dsh-plugins collection.

License

MIT