hkkz9522/dsh-session-manager

插件Plugin 原生Native ⭐ 3 MIT Web 界面Web UI

DeepSeek Harness 的会话管理器:在确认后删除对话并管理存档。

项目介绍Project Overview

DSH 会话管理插件为 Web 端补齐删除与取消归档能力。会话头提供归档与删除按钮,侧栏底部打开管理面板,支持全量/活跃/已归档筛选、相对时间与状态徽标。删除需确认,运行中会话将立即中断。主机端依赖未公开的内部字段,未来 DSH 升级若重构可能报错,需手动适配。

DSH session manager adds delete and unarchive to the Web UI. The conversation header offers archive and delete buttons, while a sidebar footer entry opens a manager panel with All/Active/Archived filters, relative time, and status badges. Deletion always requires confirmation and instantly stops running sessions. The host side accesses undocumented internals defensively, so a future DSH refactor may surface a runtime error and require manual adaptation.

或使用命令行安装(适合开发者)Or use CLI install (for developers)

命令行安装CLI Install

dsh plugin --profile web add dsh-session-manager

hkkz9522/dsh-session-manager 加入你的 DSH 配置(web profile)即可启用。

READMEREADME

dsh-session-manager — conversation manager (delete + archive)

中文 | English

npm version GitHub CI

Adds two capabilities that are missing from DeepSeek Harness Web:

  1. Delete conversations (with an explicit confirmation dialog): physically deletes a session — stops and disposes its agent, detaches the session store entry (every tab drops the row), removes the JSONL directory from disk, and cleans up workspace accounting and the archive set.
  2. Archive management: archive (workspace.archiveSession, built in) and unarchive (missing in rc.6 — this plugin implements it on the host side through the workspace registry's own persistence queue, with host/archived-sessions-changed frames keeping every client in sync).

Features

  • 🗑 Delete sessions: a "Delete session…" button in the conversation header plus a per-row delete in the manager panel — every path requires confirmation.
  • 📦 Archive / unarchive: header button + per-row actions in the panel.
  • 📋 Session manager panel (sidebar footer entry): filter by All / Active / Archived (archived sessions are invisible in the sidebar — the panel is where you find them again), with per-row Open / Archive / Unarchive / Delete.
  • 🏷 Status badges: archived / running / current; relative time and workspace directory.
  • ⚠️ The delete dialog shows the session title and an "irreversible" warning; for a running session it warns that deletion will interrupt it immediately.

Where the UI lives

Location Content
Conversation header (next to the session title) "Archive / Unarchive" and "Delete session…" (red, confirmation dialog) buttons
Sidebar footer "会话管理" button that opens the full manager panel

Install

From npm (recommended)

dsh plugin --profile web add dsh-session-manager

Restart the web app to activate (profile bundle auto-assembles; lib/ is the runtime artifact, no build step).

From GitHub (alternative)

dsh plugin --profile web add github:hkkz9522/dsh-session-manager

Local development / runtime injection

After cloning, inject in a web session that has dsh-super-injector resident (activates immediately, no restart):

dev_inject_plugin {"dir": "<absolute path to the repo>"}

Uninstall

  • Installed via dsh plugin add: remove the entry from dsh.profile.bundles and dependencies in ~/.dsh/profiles/web/package.json, then restart.
  • Installed via runtime injection: dev_uninject_plugin {"name": "dsh-session-manager"}

Compatibility (DSH upgrades)

  • Client UI uses only the official plugin surface (slot contracts conversation.session.header.actions / sidebar.footer.action, the standard toolkit useSessions / useWorkspaces / t, locale, client bundle format) — upgrades are very likely seamless.
  • Host side imports no @deepseek-ai package (only Node built-ins), so it never fails at load time after an upgrade. Delete/unarchive rely on a few internals that rc.6 does not expose publicly (accessed defensively); if a future version refactors them, you get a runtime error rather than a crash — adapt per the error message.
  • peerDependencies declares only the cordis range; no hard-coded DSH version.
  • After an upgrade, self-check once: create a blank session and delete it (end-to-end, 30 s), or run node scripts/smoke-test.mjs (read-only smoke checks of the two host endpoints; touches no real session).

Development & maintenance

  • No build step: lib/ is the runtime artifact (host is ESM; client is a hand-written loader-factory bundle).
  • Smoke test: node scripts/smoke-test.mjs [baseUrl] (needs a running dsh web).
  • CI (.github/workflows/ci.yml): node --check on both files + npm pack --dry-run content assertion.
  • Changes are tracked in CHANGELOG.md.

Implementation notes

  • Host (lib/index.js): a cordis plugin injecting webServer / workspaceRegistry / sessions / agents / sessionPersistence, exposing two HTTP endpoints:
    • POST /session-manager/api/delete { sessionId }
    • POST /session-manager/api/unarchive { sessionId }
  • Client (lib/client.js): a loader-factory bundle registering two slots:
    • conversation.session.header.actions (per-session actions + delete confirmation)
    • sidebar.footer.action (manager panel entry)

Delete of a live session: agent.cancel (interrupt) → agent.scope.dispose (quietly dispose the agent fiber, 3 s cap) → drop the zombie entry from the agents registry → sessions.flush → detach the session store entry (session/disposed → all clients remove the row) → workspace accounting cleanup → archive-set cleanup → remove the on-disk directory.

Risks & limitations

  • Deletion is irreversible (physical file removal); the UI always asks for confirmation.
  • Deleting a live session touches host internals (session store / agent registry instance fields); a future DSH refactor may require adapting the plugin (all access is defensive).
  • An archived session whose files were removed externally will just reappear in the list on unarchive (the row may not display).

License

MIT

Free to use, modify, copy, and distribute (including commercially) as long as the copyright notice and this license text are retained. The project is provided "as is", without warranty of any kind, express or implied. See LICENSE for the full terms.

上一个 Prev dsh-APEX_Plugin 下一个 Next dsh-deepseek-web-adapter