dsh-session-cleaner
Agent 与会话 活跃维护

dsh-session-cleaner

TheM14/dsh-session-cleaner

轻量级会话管理插件,支持自动归档已结束的对话会话,可快速续接历史预设的对话上下文,无需手动整理会话记录,操作便捷适配日常对话管理需求。

0
Stars 标星
0
Forks 分支
0
Watchers 关注
0
Open Issues
JavaScript
主要语言
MIT
开源协议
155 KB
仓库大小
1 个月前
最后推送
一键安装扩展 / 插件指令
dsh plugin --profile web add github:TheM14/dsh-session-cleaner
git clone https://github.com/TheM14/dsh-session-cleaner.git
git clone git@github.com:TheM14/dsh-session-cleaner.git
README.md main

dsh-session-cleaner

English | 简体中文

An archived-session management plugin for DeepSeek Harness. It adds an Archived Conversations page to Settings with restore, safe deletion, leftover cleanup, and continuation under a new agent preset.

The plugin does not replace existing menus or rewrite a source session's header or event history. Its UI uses the host's semantic design tokens and follows the active theme.

Features

  • List archived conversations by workspace with title, creation time, log status, and live status.
  • Display each session's effective preset and flag a missing or broken source preset.
  • Restore a conversation to its original workspace, with immediate official-sidebar updates.
  • Permanently delete an archived conversation through a rollback-aware quarantine and commit flow.
  • Clean ghost archive entries, orphan workspace slots, orphan projection-cache rows, and quarantined logs.
  • Create a full-history continuation with any available system or user preset while preserving the archived source.

Requirements

  • A DeepSeek Harness release compatible with 0.1.0-rc.6.
  • Node.js and npm.
  • The dsh Web profile; this plugin's client bundle targets the Web platform.

Installation

Clone and build the repository:

git clone <repository-url>
cd dsh-session-cleaner
npm install
npm run build

Enter the local plugin directory, add it to the dsh Web profile, then restart dsh web:

cd path\to\dsh-session-cleaner
dsh plugin --profile web add .
dsh web

To uninstall:

dsh plugin --profile web remove dsh-session-cleaner

Usage

  1. Open dsh Settings and select Archived Conversations.
  2. Select Restore to return a conversation to its original workspace.
  3. Select Delete and confirm to permanently remove its log and registry data.
  4. Choose a target preset and select Continue with preset to create a new session with the complete inherited history.
  5. Select Clean leftovers to remove safely identifiable residue from earlier operations or external state changes.

Deletion is permanent. A live session is never deleted. If the host still owns a session, restart dsh and do not open that session again before deleting it.

Data Safety

Deletion follows this order:

verify archived + not live
  -> rename log into quarantine
  -> commit workspace registry
  -> commit projection cache
  -> purge quarantined log

If the registry or projection-cache write fails, the plugin stops and attempts to roll back prior changes. If logical deletion commits but final file cleanup fails, the quarantined log remains under $DSH_HOME/storages/.dsh-session-cleaner-trash/ and can be removed by Clean leftovers.

Sweep reads every required state before it starts writing. Any prerequisite read failure aborts the cleanup. A staged write failure also stops later stages and returns the completed counts.

Every POST request requires a plugin-specific sentinel header. The host also validates Origin, Sec-Fetch-Site, session-id syntax, and a 64KB request-body limit.

Continue With a New Preset

Continuation creates a lineage child through the public ctx.agents.create and ctx.agentPresets.mount services:

  • the seed contains the source session's complete durable event prefix;
  • a target agent-preset/selected boundary is appended;
  • metadata records parentSession, seedLength, and the target agentPreset;
  • the child is attached to the source workspace after creation;
  • the source log, header, and archive state remain untouched.

Real Web validation confirmed that the complete history renders, the target preset survives a cold restart, and the source log hash remains unchanged.

Development

npm run build
npm test
npx tsc --noEmit -p tsconfig.json

npm test cleans and rebuilds lib/ before running the pure-logic and fake-host route tests. Prebuilt Host and Client bundles, declarations, and sourcemaps live in lib/ and are intentionally committed.

See plugin-design.md for the detailed transaction, security, and architecture decisions.

License

MIT