dsh-session-import
开发工具 活跃维护

dsh-session-import

JuneLearn/dsh-session-import

支持导入并校验平台会话导出文件,内置状态同步、回滚防护机制,搭配应用内可视化操作界面,导入流程稳定高效,可快速完成会话数据迁移与一致性核验。

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

DSH Session Import

Need to restore a DeepSeek Harness conversation on another computer, another
deployment, or a new workspace? This plugin reads .zip archives and bare
.jsonl logs produced by DSH /export, validates their structure and SHA-256
fingerprint, and restores the content as a new DSH session. The complete
workflow is available from an Import conversation dialog on the new-session
page.

中文说明

Related projects

  • DSH Image2 Draw adds
    gpt-image-2 text-to-image and image-to-image support to DSH.
  • DSH Reasoning Settings
    configures independent reasoning levels and wire values for third-party
    providers and models.

Features

  • Imports .zip archives and bare .jsonl session logs produced by DSH
    /export.
  • Adds an Import conversation button to the new-session page with file
    selection and drag-and-drop support.
  • Previews the title, message counts, tool activity, turns, original workspace,
    model, and session state before importing.
  • Always allocates a new session ID and never overwrites an existing session.
  • Supports a target workspace, custom title, original timestamps or restamping
    to the current time.
  • Selectively synchronizes model and reasoning effort, agent preset,
    permissions, sandbox, approval policy, and plan mode.
  • Displays SHA-256 and optionally enforces an expectedHash match.
  • Supports side-effect-free dryRun=1 validation and immediate open=1
    session resume.
  • Rolls back persistence, workspace attachment, or load-validation failures so
    partial sessions are not left behind.
  • Restricts deletion to sessions successfully imported and registered by the
    current plugin process instead of accepting arbitrary cold-session IDs.
  • Validates ZIP CRC-32, central-directory metadata, entry bounds, and local
    header names, and rejects encrypted, multi-disk, and ZIP64 archives.
  • Handles request cancellation, file-selection races, Escape, focus restore,
    and responsive layouts in the browser client.

Installation

Prerequisites

  • Install Node.js. DSH currently supports Node.js
    22.19.x or version 24 and newer; Node.js 24 LTS is recommended. Node.js
    includes npm and npx.
  • Install Git so the plugin can be fetched from GitHub.
  • Install pnpm. Both methods require pnpm because dsh plugin invokes it in the
    profile directory to install or remove plugins.
  • Your network must reach registry.npmjs.org and github.com. Configure a
    working network proxy if npm or GitHub is unavailable or unstable.
  • Method 1 does not require a DeepSeek Harness source checkout. Method 2 also
    requires that checkout.

Check the basic environment first:

node --version
npx --version
git --version
corepack enable
pnpm --version

If corepack enable fails with a permission error, run it once from an
Administrator PowerShell. Alternatively, use another option from the
pnpm installation guide.

If downloads fail with ECONNRESET, ETIMEDOUT, or a GitHub connection error,
set a proxy for the current PowerShell window. Port 7890 is only an example;
replace it with your proxy's actual port:

$proxy = "http://127.0.0.1:7890"
$env:HTTP_PROXY = $proxy
$env:HTTPS_PROXY = $proxy
$env:npm_config_proxy = $proxy
$env:npm_config_https_proxy = $proxy

These variables only affect the current PowerShell window and disappear when
it is closed.

Method 1: npx (recommended for regular users)

This method does not require a DeepSeek Harness source checkout or a global
dsh installation, but Git and pnpm must already be available:

npx --yes -p @deepseek-ai/dsh dsh plugin --profile web add github:JuneLearn/dsh-session-import

Start Web through the same package runner after installation:

npx --yes -p @deepseek-ai/dsh dsh web

Method 2: pnpm with the Harness source tree (recommended for developers)

Enter the DeepSeek Harness source root. Install its dependencies once, then
install the plugin:

cd D:\deepseek-harness
pnpm install
pnpm dsh plugin --profile web add github:JuneLearn/dsh-session-import

Start Web from that source directory afterward:

cd D:\deepseek-harness
pnpm dsh web

The package's dsh.bundle declaration adds the plugin to the Web profile
automatically. Neither method requires editing cordis.patch.yml. Web listens
on http://127.0.0.1:3080 by default.

Local development install

Link the working tree directly into the Web profile while developing locally:

cd D:\deepseek-harness
pnpm dsh plugin --profile web add "D:\CodexFile\临时文件夹\dsh-session-import"
pnpm dsh web

After a local link install, source changes normally require only a dsh web
restart and browser refresh rather than another installation.

Upgrade

Run the corresponding installation command again. No uninstall or manual
profile-patch maintenance is required.

npx method:

npx --yes -p @deepseek-ai/dsh dsh plugin --profile web add github:JuneLearn/dsh-session-import

pnpm source method:

cd D:\deepseek-harness
pnpm dsh plugin --profile web add github:JuneLearn/dsh-session-import

Uninstall

npx method:

npx --yes -p @deepseek-ai/dsh dsh plugin --profile web remove dsh-session-import

pnpm source method:

cd D:\deepseek-harness
pnpm dsh plugin --profile web remove dsh-session-import

Uninstalling the plugin does not remove sessions that were already imported.
Restart dsh web; the import button and HTTP endpoints are then removed.

Usage

  1. Open DSH Web and click New session at the top of the left sidebar.
  2. Find the workspace and mode controls above the central prompt input.
  3. Click Import conversation to the right of Standard mode.
  4. Select or drop a .zip / .jsonl file produced by DSH /export.
  5. Review the structural verdict, SHA-256, counts, original workspace, and
    synchronizable state.
  6. Select a target workspace and adjust title, restamping, and synchronization
    options as needed.
  7. Click Start import. The new session appears in the sidebar and opens
    automatically.

The control row is approximately:

[Select workspace]  [Standard mode]  [Import conversation]

The plugin also exposes local HTTP endpoints. See the complete
API documentation for parameters and response formats.

Validation and resource limits

  • The upload and decompressed root session log are each limited to 256 MB.
  • One ZIP may contain at most 10,000 entries, and the expanded root log may
    contain at most 1,000,000 events.
  • subagents/ logs and media/ files are counted but are not currently
    imported with the root session.
  • Structural validation covers event sequence, time, type, references,
    turn/step and tool-call pairing, message envelopes, surfaceOp, and
    sourceEventSeqs.
  • SHA-256 proves equality with a supplied fingerprint, but DSH exports are not
    digitally signed and therefore do not prove author identity.
  • Deletion ownership is kept only for the current DSH process. Imported
    sessions continue to work after restart, but can no longer be removed through
    the plugin rollback endpoint.

Permissions and data

  • Uploaded files are parsed locally in memory and are never sent to an external
    service.
  • The plugin makes no outbound network requests and does not access API keys or
    other DSH credentials.
  • Import writes only to DSH's own session persistence and workspace registry.
  • Rollback only acts on sessions successfully imported and registered by this
    plugin process.

Troubleshooting

Symptom Cause and action
Import conversation is missing Open the new-session page, restart dsh web, then press Ctrl+F5
loaded without registering An old client bundle is cached; update the plugin, restart DSH, and hard-refresh
400 bad-file The file is not valid ZIP/JSONL, or is damaged, encrypted, oversized, or unsupported
409 hash-mismatch The uploaded file does not match the expected SHA-256 fingerprint
422 structure Events are broken or references are invalid; failed imported artifacts are rolled back
403 not-imported The target was not registered by this plugin process, or DSH has restarted
503 persistence / workspace The active profile lacks required persistence or workspace services

Development

npm test
npm run check
npm pack --dry-run

tests/plugin.test.mjs covers log and ZIP parsing, structural validation,
sequence remapping, transactional rollback, deletion protection, client helper
functions, module identity, and package metadata.

Compatibility

The current release targets the public session format, dual-end plugin,
WebServer, workspace, and session-persistence interfaces of DeepSeek Harness
0.1.0-rc.6. Harness is still in Developer Preview. If an upgrade breaks the
plugin, check event types, message envelopes, Host service names, and the
dsh.client.inject declaration first.

Acknowledgements

This project is based on the MIT-licensed
kinyokun/dsh-session-import.
Thanks to kinyokun for the original work. The
upstream copyright and license notice remain in LICENSE. See
NOTICE and the
upstream comparison for attribution and a
detailed change summary.

License

MIT