rea
morluto
Reverse engineer anything with agents, from app behavior down to native binaries.
PROJECT TOPICS
INSTALL REFERENCE
dsh plugin --profile web add github:czr-chu/dsh-session-kit
该命令指向仓库当前默认分支;尚无绑定当前 commit 的完整验证结果。
PROJECT README
Session manager, backup, and migration toolkit for DeepSeek Harness.
Version 0.13.0 · public beta · 中文说明
dsh-session-kit adds a Session manager panel and a session_kit agent
tool to DeepSeek Harness (DSH). It backs up a whole workspace (every session
plus the project files, collected once), exports selected conversations as
portable archives, imports them as new sessions on another machine or workspace,
manages archive state, upgrades old session logs through DSH's official
migration, and turns public DeepSeek share links into new local conversations.
It is built for people who migrate DSH between machines, keep local backups, or want a smaller conversation-only copy of a long session — without touching DSH's storage layout or rewriting session files by hand.
The plugin is a plain ESM bundle. It declares no
@deepseek-ai/*runtime dependency and reads every DSH capability through the composed service registry.

manifest.backup with the workspace id, title and source
path; only that root is packed. Sensitive/build/dependency paths and symlinks
are excluded with the normal workspace rules.seq; streamed deltas are emptied and oversized strings are truncated with a
visible marker (default 8 KiB per string, 16 KiB per event). Use it when full
is too large and compact loses too much.meta.json.manifest.json with sha256 checksums, plus an archive
README.md that explains the layout..jsonl log.archived / pinned flags in
manifest.json and each session meta.json; import re-applies them to the new
id best-effort (a registry failure is a warning, not a rollback).?skipDuplicates=1) to filter them out instead. If
every session is filtered the import reports no-session.POST /session-kit/import?progress=ndjson streams one session line per
committed session plus a final done/error line; the panel uses the normal
JSON response.origin: 'subagent' descendants move to
$DSH_HOME/session-kit-trash/<timestamp>/. User-visible
fork/seeded children are preserved. Live sessions and running agents are
refused before anything moves; every backend session directory is validated
(canonical name, canonical project directory, not a symlink) and a failed move
rolls back.operation.json manifest before the first move
(per-session original directories, the derived sessions root, and the
archived/pinned snapshots). Workspace membership, pins and archive state are
cleaned afterwards; cleanup failures are logged rather than reported as a
failed delete.Deletes stay recoverable until you purge them.
trash_list. Lists every operation under
$DSH_HOME/session-kit-trash/ with its session count, byte size, and
restorable flag. Directories written by older releases (no manifest) are shown
but marked manifest missing — they can only be purged or restored by hand.trash_restore. Moves each recorded session directory back to
its original project directory, re-attaches it to that workspace, and replays
the archived/pinned snapshot. A target that already exists is skipped, never
overwritten; a path outside the recorded sessions root is refused. A partial
restore keeps the operation (with the remaining sessions) for a later call.trash_purge. Permanently removes whole operation directories.
Requires confirm: true; accepts explicit operation ids or all, optionally
limited by olderThanDays. It never touches the attachment store and never
removes a directory outside the trash root.move. Select sessions and choose Move to workspace
(next to archive and delete). Pick the destination in the dialog.cwd, and that value
cannot be re-labelled in place. The plugin therefore copies each session into
the target workspace under a new id, verifies the copy by reading it back
through the session query, attaches it there, and only then moves the source
directory into the trash. A failed copy leaves the source untouched; a failed
trash move keeps the copy and reports it.confirm: true.attachment_report scan up to 300
sessions read-only, resolve every image/file reference in the logs against the
attachment provider's host path, and report references that are missing or
unverifiable (no host path is exposed by the backend).GET /session-kit/attachment-report?limit=&includeSubagents=1 accepts a
positive limit (max 300). The response includes scanned/total sessions,
truncation, reference counts and per-session missing entries.This feature is marked experimental in the UI and requires a second confirmation.
<trash>/files/<encoded-root>/<relative-path> tree
with a files-manifest.json, then moves the session directories. A
file failure rolls the moved files back before any session directory moves.The derivation is inherently approximate: shell redirections, PTC/script outputs and files only mentioned in text cannot be discovered, and a file shared with another session is affected too. Review the preview before confirming.
formatStatus, legacy), including their stored
generation.SessionPersistence.open(id, 'write') triggers the prepare/publish
path, the handle is closed immediately, and a second stat verifies
the published generation. The plugin never decompresses, re-encodes or
rewrites a session artifact itself.https://chat.deepseek.com/share/<id> or a bare share
id, choose a target workspace, optionally set a title, and import.chat.deepseek.com is fetched; arbitrary
URLs are refused. Requests have a timeout and a response-size cap, and non-zero
API codes / non-JSON responses fail loudly.The session_kit tool exposes the same operations to the model:
| Action | Purpose | Notes |
|---|---|---|
list |
Summarize workspaces and sessions | archived rows are marked |
export |
Write one ZIP under the plugin's export directory | mode: compact / compressed / full, sessionIds or all |
export_workspace |
Write one ZIP per selected workspace | workspaceIds (max 20) or a single workspaceId; each ZIP carries all main sessions + that workspace tree |
workspace_archive_list |
List whole-workspace archive records | read-only; title/path, session and partial counts |
workspace_archive |
Archive all sessions of one workspace, then remove its registration | requires confirm: true and workspaceId; directory/logs/files are kept |
workspace_restore |
Recreate the workspace and reattach its sessions | archiveId; partial records can be retried |
import |
Import an archive file as new sessions | optional workspace file restore |
archive / unarchive |
Toggle the durable archive state | batch ids supported |
delete |
Move sessions to the trash | requires confirm: true; optional removeFiles with explicit selectedFiles; permanent: true erases irreversibly |
migrate |
Upgrade legacy logs through DSH's official migration | sessionIds or all (needs confirm: true) |
move |
Copy sessions into another workspace, then trash the sources | requires confirm: true and workspaceId; new ids; skips live/subagent/legacy |
trash_list |
List trash operations with size and restorable flag | read-only |
trash_restore |
Move an operation's sessions back into their workspace | operationId; optional sessionIds subset |
trash_purge |
Permanently erase trash operations | requires confirm: true; operationIds or all, optional olderThanDays |
files |
Preview derived related files for a delete | experimental, best effort |
detail |
Report storage size, format status and archived state | up to 100 explicit ids; read-only, no writes |
import_share |
Import a DeepSeek share link | input, optional workspaceId / cwd / title |
attachment_report |
Report missing/unverifiable attachment references | read-only; up to 300 sessions; optional limit |
Example prompts you can give the agent:
Requirements: DSH 0.2.1-rc.3 or newer, session format v4, Node 22+
for the plugin (the shipped DSH CLI requires Node 24.9+). The browser panel needs
a Web or Desktop deployment; a headless deployment still gets the
session_kit tool.
# from GitHub (recommended: pin a release tag)
dsh plugin --profile web add github:czr-chu/dsh-session-kit#v0.13.0
# or directly from a GitHub Release tarball
# dsh plugin --profile web add 'https://github.com/czr-chu/dsh-session-kit/releases/download/v0.13.0/dsh-session-kit-0.13.0.tgz'
# from a local checkout (iterating on the plugin)
dsh plugin --profile web add ~/src/dsh-session-kit
# verify the row was added
dsh plugin --profile web list --depth 0
Restart dsh web after installing, then refresh the page. The sidebar
gets a Session manager row under Plugins.
In the Desktop/Web Plugins → Add plugin dialog, enter either the GitHub
repository URL (https://github.com/czr-chu/dsh-session-kit#v0.13.0), the
Release .tgz URL, or an absolute local directory. The repository is public; no
GitHub token is needed for a Git install. See docs/install.md
for the repository requirements and offline install.
The npm name dsh-session-kit already belongs to an unrelated
package on npm, so install this project from GitHub or from a Release tarball;
do not run dsh plugin add dsh-session-kit unless this project is
later published under a different name.
An incompatible DSH version is refused at install time through
engines.dsh.
dsh web and refreshing, click
Session manager in the sidebar. Rows are grouped by workspace; use the
search box and the all/active/archived filter.$DSH_HOME/session-kit/exports/ instead..jsonl), choose the Target workspace, enable
workspace-file restore when restoring a backup, and click Import archive.
Imported conversations appear as new sessions; nothing existing is overwritten.session_kit tool exposes the same
operations (see the action table below).One ZIP contains a manifest, a restore README, per-session folders and optional workspace trees:
session-kit-<count>-sessions-<timestamp>.zip
├── manifest.json # kind/version, sessions, sha256, workspaces
├── README.md # restore instructions
├── sessions/<sessionId>/
│ ├── session.v4.jsonl # full mode
│ ├── session.compact.v4.jsonl # compact mode
│ ├── session.compressed.v4.jsonl # compressed mode
│ └── meta.json
├── attachments/
│ ├── media/<attachmentId>.<ext>
│ └── files/<prefix>/<digest>/<name>
└── workspaces/<encoded-workspace>/... # optional whole workspace tree
A whole-workspace archive record lives outside the ZIP layout:
$DSH_HOME/session-kit-workspace-archive/<archiveId>/
└── record.json # workspace title/path/order, per-session archived/pinned, partial state
The trash produced by delete is separate from archives:
$DSH_HOME/session-kit-trash/<timestamp>/
├── operation.json # manifest: sessions, original dirs, archived/pinned
├── <encoded-session-id>/... # moved session directory + subagent descendants
├── files/<encoded-workspace>/<relative> # selected related files (experimental flow, optional)
└── files-manifest.json # original absolute paths, evidence, session ids (optional)
Plugin row config (cordis.patch.yml or the plugin settings row):
| Field | Default (bundle) | Meaning |
|---|---|---|
maxImportBytes |
512 MiB | Maximum archive upload size |
maxExportBytes |
1 GiB | Maximum produced archive size |
includeAttachments |
true |
Export referenced attachments by default |
includeWorkspaceFiles |
true (bundle) |
Include whole workspace trees by default |
includeSubagents |
false |
Export subagent transcripts by default |
restoreWorkspaceFiles |
true (bundle) |
Restore archived workspace files on import by default |
workspaceExclude |
[] |
Extra directory names / patterns to exclude |
workspaceMaxBytes |
unset | Optional byte cap for the workspace part |
trashDir |
$DSH_HOME/session-kit-trash |
Where deleted sessions move |
defaultMode |
compact |
Export mode used when the caller omits one: full, compact or compressed |
The bundle exports a standard-schema Config; unknown keys and wrong types
fail the plugin at startup rather than being silently defaulted. Batch limits:
up to 500 management ids per request, 100 ids for migration, workspace move,
file preview and session detail, 20 workspaces per backup batch, and 5000
selected files per delete.
.git, node_modules,
.venv, venv, dist, build,
.next, target, pycache,
.cache, .pnpm-store, .yarn,
.idea, .vscode directories; .env,
.env., .pem, .key, .p12,
.keystore, id_rsa, id_ed25519,
.npmrc, .netrc, .git-credentials,
credentials, secrets*, .DS_Store files
and .ssh, .aws, .gnupg,
.config/gcloud directories. Symlinks are not followed. DSH
credentials, upload indexes, caches and telemetry identities are never read.chat.deepseek.com/share/<id> links
or bare share ids, never arbitrary URLs, with timeout and response-size caps.More detail: docs/security.md and the privacy audit.
0.2.1-rc.3 or newer; session format v4.ctx.get(...), so it does not pin @deepseek-ai/*
packages. A DSH upgrade may still require a plugin update.maxExportBytes /
workspaceMaxBytes; oversized files and cap violations are skipped
with warnings.chat.deepseek.com; private or
deleted shares fail, and only public content is available.trash_purge (or
delete old operation folders yourself) when the space is needed; a purge
requires explicit confirmation and never removes attachments.The host half is plain ESM; the browser half is bundled from src/client/ with the same closure-factory protocol the client module system loads. From a checkout of this repository:
# install the pinned build tooling and rebuild the committed client artifact
cd dsh-session-kit && npm ci
npm run build:client
# plugin-local tests (network-free; real-backend cases skip when unavailable)
npm run format:check
npm run lint
npm test
# full suite from the DSH repository root, including real persistence/replay checks
node --import tsx/esm --test dsh-session-kit/test/*.test.mjs
Expected result: 331 tests, with 9 guarded real-backend cases skipped under
plain node --test (they run when the DSH checkout is available
through tsx). The suite covers session listing/reading, compact
building, workspace file collection and sensitive exclusions, archive
build/import (including zip-slip and sha256 checks, archived/pinned restore,
duplicate preflight, NDJSON progress), archive/trash/permanent
delete semantics, trash restore/purge, workspace move, multi-workspace backup,
attachment reference reporting, official format migration, and share-link
normalization/build/import against a real local JSONL backend where available.
Project docs: architecture · install and upgrade · security · plugin conformance · workspace backup · self-assessment · privacy audit · feature matrix · roadmap · change documentation · decision records · market listing.
MIT. See LICENSE. Portions of lib/zip.js,
lib/format.js and lib/attachments.js are derived from
dsh-session-port (MIT); see
NOTICE.
CLASSIFICATION EVIDENCE
系统优先读取 GitHub Topics,再与站内分类词典和词根规则比对。当前命中: deepseek-harness。