rea
morluto
Reverse engineer anything with agents, from app behavior down to native binaries.
PROJECT TOPICS
INSTALL REFERENCE
dsh plugin --profile web add github:Hungry-M/dsh-deepseek-import
该命令指向仓库当前默认分支;尚无绑定当前 commit 的完整验证结果。
PROJECT README
English | 中文
Capture conversations from Edge on chat.deepseek.com (one or many), export them as JSON, then rebuild them as resumable DeepSeek Harness sessions.
Status:
0.x, pre-release — data formats and CLI flags may change. Unofficial: not affiliated with or endorsed by DeepSeek or DeepSeek Harness. Licensed MIT; see CONTRIBUTING.md and SECURITY.md.
Edge extension ──export──▶ dsh-deepseek-*.json ──dsh-import.cmd──▶ ~/.dsh/sessions + workspace.json
Requires Node.js 22+ (session compression uses built-in zstd).
# from npm
npm i -g dsh-deepseek-import
dsh-import --list # importer
dsh-session list # session management (move / workspace path / delete / repair)
# or run straight from source
git clone https://github.com/Hungry-M/dsh-deepseek-import.git
cd dsh-deepseek-import
node dsh-import.mjs --list
The Edge extension is installed separately (next section) — a browser extension cannot ship inside an npm package. It is now published on the Edge Add-ons store, so no developer mode is needed.
From the store (recommended)
The store build updates on its own.
From source (development and debugging)
edge://extensions/ in Edgeedge-extension folderBoth paths run the same code; use the second one when you are changing it.
chat.deepseek.com and let it finish loadingIf a conversation never shows up, open it and click Capture chat. It tries three sources in order: the browser's local cache (IndexedDB), a screen-by-screen backfill, then only the visible screen.
DeepSeek loads long conversations page by page. The extension does two things:
message_id; the extension unions them by id, so scrolling up or capturing twice only ever adds messages, never overwrites what was already captured.deepseek-chat / history-message straight from IndexedDB first. For most conversations that is the whole history in one read, with no scrolling at all.Double-click dsh-import.cmd in the workspace (or drop JSON files onto it). With no arguments it uses the newest dsh-deepseek-*.json found in your download folder.
<workspace>/.dsh-imported/<sessionId>/ with their original names only when the data source carries them; anything that cannot be downloaded degrades to [附件未下载:name (size) 原链接]. DeepSeek's IndexedDB cache copy usually carries no attachmentsthinking.md in the same folder (never injected into the context)revisions.md[中断输出 #27:未产生完整正文…]); add --keep-interrupted to keep the partial textworkspace.json is backed up before it is modifiedimport.logThe sidebar list comes from ~/.dsh/storages/workspace.json, which DSH only reads at startup. Quit DSH completely and reopen it.
If the session still does not show up, use this order instead: quit DSH → run dsh-import.cmd → start DSH. A running DSH can overwrite workspace.json with its in-memory list.
import.config.json, next to this file:
{ "downloadDir": "D:\\Downloads", "subdir": "dsh-import", "lang": "zh" }
| Key | Meaning |
|---|---|
downloadDir |
Where to look for exports (defaults to the real system download folder) |
subdir |
Subfolder convention: the extension saves to <downloadDir>/<subdir>/, the importer scans it too |
lang |
zh / en, affects the TUI and the extension UI |
autoTrim |
Default true: auto-trim conversations above the threshold |
autoTrimChars |
Trigger threshold, default 120000 chars |
autoTrimTurns |
Max turns kept, default 20 |
autoTrimBudget |
Char budget for the kept part, default 60000 (walks backwards from the end) |
The same four auto-trim values live in the extension's ⚙ settings (checkbox + a collapsed "Advanced" section). They travel inside the export's options, and the importer resolves them in this order:
CLI flags > export options (extension settings) > import.config.json > built-in defaults
Sidecar location is also selectable in the extension (Write sidecars to DSH home), which equals --no-sidecar.
node dsh-import.mjs --list # list workspaces
node dsh-import.mjs # newest export in the download folder
node dsh-import.mjs export.json -w "D:\proj" # explicit workspace (auto-registers an unknown dir)
node dsh-import.mjs export.json --dry-run # parse only
node dsh-import.mjs export.json --thinking # also inline thinking (default: thinking.md only)
node dsh-import.mjs export.json --json # machine-readable: {ok, workspace, created[]}
node dsh-import.mjs export.json --keep-versions # keep pre-edit versions (default: current branch only)
node dsh-import.mjs export.json --keep-interrupted # keep partial interrupted output
node dsh-import.mjs export.json --tail 20 # only the last 20 turns
node dsh-import.mjs export.json --no-auto-trim # disable auto trimming
node dsh-import.mjs export.json --no-sidecar # sidecars to ~/.dsh/import-archive/
node dsh-import.mjs export.json --sidecar-dir "E:\arch"
dsh-import.mjs is also a module:
import { runImport, getWorkspaces, listExports, peekExport } from './dsh-import.mjs';
await runImport({ files: ['x.json'], workspacePath: 'D:\\proj', only: ['<conversation id>'] });
node dsh-import-tui.mjs
Pick an export (size/time shown) → preview conversations (messages/chars/thinking/attachments) → select (all, 1,3, 1-2) → pick a branch point → pick workspace → confirm.
To start a session at a chosen point instead of "the last N turns":
node dsh-import.mjs export.json --from-match "some text you typed"
node dsh-import.mjs export.json --from-index 157
DSH session format v4 requires the first model-visible node to be a system/message.
Imports from 0.1.0 predate that fix and would break the moment you kept chatting in them.
0.1.1 writes the head on import, and this command repairs sessions created earlier:
node dsh-import.mjs --audit # report only
node dsh-import.mjs --repair # insert/move the head, resequence, drop the projection cache
node dsh-import.mjs --doctor # environment / workspaces / sessions / ownership / permissions
--from-match does a case-insensitive substring match over user messages, first hit winstranscript.mdThe first user message ends with an index line:
[导入存档(需要时可直接读取):思考 2 段 → .dsh-imported/<sessionId>/thinking.md;附件 → …]
Those files sit inside the workspace, so the model can read them on demand with ordinary file tools (nothing is pushed into the context automatically).
A 227-message / 520k-char conversation is roughly 250–350k tokens. DSH compacts automatically (dsh-compaction-basic), but after compaction only ~16% of recent history stays verbatim and the rest becomes a summary — the import is effectively wasted.
node dsh-import.mjs export.json --tail 20
.dsh-imported/<sessionId>/transcript.mdtranscript.md, even without --tailtranscript.md starts with an index (#N role chars — first line), and each section is headed ## #N, so grep "## #123" jumps straight to a messageDouble-clicking the cmd closes instantly?
Older builds had LF line endings, which cmd.exe mis-parses. Current builds use CRLF, always stop at pause, and write import.log.
"Node.js not found"?
Lookup order: node-path.txt → PATH → Program Files\nodejs → Program Files (x86)\nodejs → %LOCALAPPDATA%\Programs\nodejs → %APPDATA%\npm → node.exe next to the script.
Which file does the cmd import?
Without arguments: the newest dsh-deepseek-*.json in the download folder. You can also drop files/folders onto it.
Body is only a fragment? Open the conversation and click Capture chat; then check the "来源" (source) tag in the list.
Citations and attachments depend on the data source: DeepSeek's IndexedDB cache copy keeps the body and thinking only; the references table and files field are usually absent. references.md and the attachment folder are therefore created only when the source carries them — their absence is a normal result, not a failure.
Imported sessions show "Untitled" in the sidebar first: the session list reads only the header and the projection cache — it never opens a cold log just to display a title. A freshly imported session has no cache yet, so the title is blank; opening it once restores the title permanently. The session/title event is in the log; nothing was lost. --doctor reports how many sessions are in this state.
Thinking is archived, not inlined: DSH reasoning blocks carry provider signatures; faking them would poison later requests. Read thinking.md, or force inline with --thinking.
Attachments are not added to DSH's attachment store: they are written to disk and referenced by path. When no download URL is available only the name and size survive.
Web-search citations: the cache record has no references table, so [reference:N] markers stay as plain text with no links.
Only text and attachments are migrated; tool calls and search results have no structured export.
Session format is DSH internals (v4 JSONL + zstd, multi-frame). A future DSH change may require an update here.
The extension relies on DeepSeek's own responses; if a redesign breaks capture, use Capture chat as the fallback.
dsh-session is the second CLI in this package. It treats a session as what DSH actually stores — four pieces of state — and updates all of them together.
node dsh-session.mjs list # sessions per workspace
node dsh-session.mjs doctor # read-only health check
node dsh-session.mjs move <id> [<id>...] --to "D:\other" # preview (dry-run is the default)
node dsh-session.mjs move <id> [<id>...] --to "D:\other" --apply
node dsh-session.mjs workspace-move "D:\old" --to "D:\new" # workspace path change
node dsh-session.mjs delete <id> [<id>...] --apply # permanent, not archive
node dsh-session.mjs repair --apply # restore the system head
--apply; --json prints the same plan machine-readably. The same goes for severity: unregistered or duplicate sessions are reported as warnings instead of being silently skipped.--to accepts a workspace path, title, or id; session ids may be short prefixes (move 228f1ce4 --to other).move updates four things: cwd in the session log, the project folder holding the session, sessionIds in workspace.json, and the .dsh-imported/<id> folder.workspace-move does not move the files inside the workspace — those are your own files. Rename the folder yourself first, then point DSH at the new path. Sessions whose cwd equals the old path follow along; sessions whose cwd differs are left alone and reported.delete is permanent: session folders, sidecar files, projection cache, sessionIds registration and archive/pin entries are all removed.workspace.json validates it first and refuses to write a store DSH would reject. Restart DSH afterwards — it only reads workspace.json at startup.move-session.mjs, remove-session.mjs and repair-session.mjs still work as thin wrappers (they apply by default, as before) but the dsh-session commands are the supported entry points.
~/.dsh/sessions/--<workspace>--/session-<uuid>/workspace.json.bak-* over workspace.jsonnode dsh-session.mjs delete <id> --applyedge-extension/
manifest.json MV3 manifest
merge.js window merging by message id / overlap
inject.js main world: read-only sniffing of fetch/XHR responses
stream-parser.js streaming patch protocol parser
content.js isolated world: normalize, cache reader, DOM fallback
background.js capture storage, attachment fetching
popup.html/js/css selection and export UI
dsh-import.mjs export JSON → DSH sessions
dsh-import-tui.mjs interactive importer
dsh-import.cmd double-click entry
session-core.mjs session state core (plan/apply for move, workspace-move, delete, repair)
dsh-session.mjs session CLI (list / doctor / move / workspace-move / delete / repair) CLASSIFICATION EVIDENCE
系统优先读取 GitHub Topics,再与站内分类词典和词根规则比对。当前命中: deepseek。