MIT License

技术解读

以下内容由 GitRead 中文社区 编辑团队基于项目 README 与官方资料整理, 结合中文开发者的常见使用场景补充技术选型建议。具体以项目官方文档为准。

深度解析 GitHub 项目 Nwflower/dsh-chat-import

项目背景与痛点

在当今的AI开发和对话系统中,开发者通常需要围绕多个系统管理用户的历史对话。不同平台上的会话数据通常格式各异,难以整合。Nwflower 的 dsh-chat-import 项目,旨在解决这一问题。它通过导入十余种外部代理聊天历史数据,统一集成到 DeepSeek Harness 中。这样,用户不仅可以恢复先前的对话,还可以跨平台继续聊天,有效管理不同工具间的聊天记录,提升开发效率。

核心技术揭秘

dsh-chat-import 的技术核心在于支持多种异构数据源的导入以及在 DeepSeek Harness 中复现对话会话的能力。该项目采用了现代编程最佳实践,包括模块化设计、数据映射和同步机制,确保了数据的完整性和一致性。

技术架构

项目使用 Python 进行开发,利用了成熟的库处理多样化数据格式。以下是其主要技术栈及架构概览:

  • 数据格式解析: 利用正则表达式、JSON、XML 等技术解析不同代理聊天历史数据。
  • 深度映射与转换: 每条原始对话映射并转换到统一格式,便于在 DeepSeek Harness 中加载与恢复。
  • 会话校验与同步: 集成数据后,与 DeepSeek Harness 进行数据校验,确保高保真度的会话同步与备份。

如下图所示,dsh-chat-import 主要包括数据导入、数据映射和同步与备份三个阶段。

graph TD subgraph "数据导入" A[提取数据源] --> B[格式解析] end subgraph "数据映射" B --> C{"数据适配?"} C -->|"是"| D[数据映射] C -->|"否"| E[异常处理] end subgraph "同步与备份" D --> F[同步到 DeepSeek Harness] E --> G[错误日志] H[深层校验] --> I[备份数据] end

功能亮点与差异

相较于市场上其他同类工具,dsh-chat-import 具备显著的技术优势,如高保真度的历史数据恢复、支持多种平台的数据导入及其中 UNIQUE 的一批兼容Agent。此外,其逆向导出功能以及数据包备份功能,提升了数据管理的灵活性与可用性。

应用场景与落地建议

在生产部署时,应留意数据解析的健壮性和资源使用效率。推荐对持续集成环境进行配置,保证数据的实时同步及备份。适合的应用场景包括大型聊天平台开发、多代理同步协作项目以及对话历史分析。

综合评价

优点:

  • 高保真度的历史恢复能力
  • 广泛兼容各类代理聊天对话
  • 强大的逆向导出与数据备份功能

缺点:

  • 需要针对特定数据格式进行适配,略微增加了研发成本
  • 大量数据同步时可能存在性能瓶颈

总的来说,dsh-chat-import 是一款有助于提高多平台聊天系统集成度与用户体验的优秀工具。其提供的功能和灵活性对于需要跨代理聊天记录管理的开发者来说,无疑是利器一件。

关于

GitHub 原始描述(英文)

Import 14+ external agent chat histories (Claude Code, Codex, ChatGPT, Cursor, Gemini, Reasonix, opencode, ZCode, Grok Build, OpenClaw, Pi, Hermes, Kimi CLI, DSH) into DeepSeek Harness as resumable sessions — full-fidelity, reverse export/sync, bundle backup. | 从 Claude Code、Codex、Reasonix 等 Agent 工具导入历史消息到 DeepSeek Harness 并继续对话。

描述取自 GitHub 官方 API,保持仓库作者书写的原文。

简要分析

热度分
368
价值分
181
活跃状态
活跃

语言占比

JavaScript

Release

README

DSH Chat Import

DSH Chat Import

A session import plugin built on DeepSeek Harness: import conversation history from other agents with one click, then keep talking in DeepSeek Harness.

All sessions, continued in DSH.

English 简体中文

version downloads GitHub stars GitCode license Awesome DSH Plugin dsh.so install

Supported Data Sources

Claude Code
Claude Code
Codex
Codex
Gemini CLI
Gemini CLI
Goose
Goose
Crush
Crush
Qoder CLI
Qoder CLI
Kimi CLI
Kimi CLI
Kimi Code
Kimi Code
Reasonix
Reasonix
OpenCode
OpenCode
MiMo Code
MiMo Code
ZCode
ZCode
Grok Build
Grok Build
OpenClaw
OpenClaw
Kilo Code
Kilo Code
Pi Coding Agent
Pi Coding Agent
oh-my-pi
oh-my-pi
Hermes
Hermes
Cursor
Cursor
Cline
Cline
Continue
Continue
Zed
Zed
Antigravity
Antigravity
ChatGPT
ChatGPT
WorkBuddy
WorkBuddy
Qwen
Qwen
DSH
DSH
TeleAgent
TeleAgent
Trae Work
Trae Work
Doubao
Doubao
Mistral Vibe
Mistral Vibe
CodeArts Desktop
CodeArts Desktop
CodeBuddy Code
CodeBuddy Code
Local JSONL
Local JSONL
Copilot VS Code
Copilot VS Code
Copilot CLI
Copilot CLI

Install

Requires dsh 0.1.5-rc.1 or newer. Verified on the 0.1.x line and on the 0.2.x line; dsh-tools must satisfy >=0.1.0-rc.6 <0.3.0.

  1. Install from a terminal
dsh plugin --profile web add dsh-chat-import                    # npm package
  1. Or install from the Plugin Marketplace

Usage

  1. Import conversations from the GUI

Click the Import sessions button at the bottom of the left sidebar to open the import window. With the DSH Claude Style theme, that button lives in the account menu at the bottom left. Pick the conversations you want and import them in one click.

Rows carry their own tools: double-click a row to preview the conversation (a read-only dry-run — plugin injections skipped, tool calls folded into one line), switch the search box to In content to search message bodies instead of titles, hide a row reversibly, move a single-session source file to the Recycle Bin, or drag the row onto a workspace in the left sidebar to import it there with its timestamps shifted so it sorts to the top. The exact rules are in docs/USAGE.md.

If the file came from somewhere else — a web-app export, a script you wrote, a tool this plugin does not list — use Import from file at the top of the same window. Type a local path and press Enter, or press Choose… to pick files. When the path is a directory, it asks whether to search subfolders. Check the preview, then import. If detection fails, it lists why each candidate parser gave up and points you at the skill that converts the format.

Import panel — light Import panel — dark

These screenshots also use the DeepSeek palette from DSH Claude Style, another theme plugin by the same author. It recreates the look and feel of Claude Code Desktop inside DSH and ships two palettes, one for Claude and one for DeepSeek. If the default theme is not quite your taste, give it a try. The workspaces and sessions in the screenshots are sample data.

  1. Import through an agent’s tool call
# Example call formats
import_chat({ format: "claude", path: "~/.claude/projects" })
import_chat({ format: "chatgpt", path: "~/Downloads/chatgpt-export/conversations.json" })
import_chat({ format: "local-jsonl", path: "D:\downloads\session.jsonl" })

Cursor workspace grouping and imports prefer the local Cursor workspace registry by conversation id, accepting only existing directories. Imports always read fresh; discovery caches successful reads and invalidates on DB/WAL changes. Malformed JSON and filesystem failures are counted in diagnostic warnings. When no usable entry exists, they fall back to decoding the transcript’s project directory name.

Configuration

To accommodate TUI users, the tools this plugin provides start out injected into context. In Settings you can switch them to not injected, or to a partial injection, which saves a fair number of tokens.

Full tool and command usage is in docs/USAGE.md.

Third-party plugins can call scanDiscover(), importPath(), importAll(), and resumeSummary() on the optional chatImport host service. These reuse the same discovery, import, batch-import, and handoff-summary pipelines as the built-in tools and commands. A single-session import result includes sessionId. When the service is absent, callers should degrade gracefully.

Features

Capability Entry Point Description
Import Sidebar panel, “Import” tab Import conversations from other agents, keeping reasoning, tool call results, and system prompts (optional)
Import from file Panel “Import from file” / /import auto <path> Any local file or directory: three-level detection (explicit format > content marker > parser trial), preview first, an optional search-subfolders prompt for directories, and, when every parser fails, a ready-to-send agent task brief plus a registered dsh-chat-import-convert skill
Retract Import Sidebar panel, “History” tab Review import history and delete sessions this plugin created
Export Context tool Serialize DSH sessions back into other agents’ formats
Ignore Automatic, plus /ignores Archiving, deleting, or removing a workspace registers the source, so rescans skip it; /ignore and /unignore manage the table

Codex discovery prefers the session title saved in session_index.jsonl (thread_name), so a rename made in Codex still shows up. Only when no indexed title exists does it fall back to the first real user prompt, extracted the same way import does it, with injected page context excluded. The title index is streamed line by line, and the last valid title record wins for each session.

For activity time, Codex discovery takes the latest valid timestamp found within bounded head and tail windows of the transcript and combines the results across rollout pages. File modification time is the fallback when the transcript carries no timestamp at all, so activity times still come back when the host file service does not expose modification times. A timestamp inside a truncated record can be missed.

Claude Code fork sessions (from the newer desktop session menu and from --fork-session) are discovered and imported too. A fork transcript opens with a verbatim copy of the parent’s records and appends its own from the fork point, so the main-transcript test looks at both ends of the file: if the file name’s stem appears at either end, the file owns that session. Session identity is the last sessionId in the transcript. Before this rule, such files were classified as subagent auxiliary transcripts and skipped wholesale. The copied prefix, which is the parent’s history, stays in the log, because a fork’s context really does contain it; the parent and the fork therefore overlap by one stretch of history.

On Windows, Hermes discovery scans %LOCALAPPDATA%\hermes and ~/.hermes, falling back to ~/AppData/Local/hermes when LOCALAPPDATA is unset. On macOS and Linux it scans ~/.hermes.

Docs

Document Description
Usage Reference Complete parameters, examples, and edge cases for every tool and command
Interchange Protocol Interchange v1 protocol and bundle format
Conversion Guide Agent-facing skill instructions: convert any transcript into an importable interchange v1 document
Import Guide Agent-facing skill instructions: the format table, parameter reference, and re-import rules for import_chat
Settings Migration DSH 0.1.5 → 0.1.7 plugin settings-page migration (measured errors, compatibility recipe)
Changelog Version history
Roadmap Not yet done, planned, and explicitly out of scope
Contributing Development setup, commit rules, security and privacy

Need to migrate configuration (skills, hooks, global settings) rather than conversation history? Try dsh-movein.

Star History

Star History Chart

评论

暂无评论