Skills Plugins MCP Prompt Model 导航 博客 资讯 我的中心
会话与消息 #cordis#deepseek-harness#dsh#dsh-plugin#session-export

dsh-chat-log

Export a DSH session log as a clean chat log: stream fragments folded into normal messages, every other event kept verbatim. /chat command + browser-download button.

yupeglv @yupeglv ⬇ 2 ★ 0 main

安装

dsh plugin --profile web add github:yupeglv/dsh-chat-log
下载安装清单

需要可复现安装时,可在仓库后追加 #commit 固定提交。

Export a DSH session log as a clean chat log: stream fragments folded into normal messages, every other event kept verbatim. /chat command + browser-download button.

该插件未提供要点说明,请参考仓库 README。

cordisdeepseek-harnessdshdsh-pluginsession-export
  1. 安装并启动 DeepSeek Harness:npx @deepseek-ai/dsh web
  2. 在终端执行上面的安装命令(CLI 会解析插件并核验来源)
  3. 用 dsh plugins list 确认已安装,必要时重启 Harness 生效

插件以当前 dsh 进程的权限运行,安装时可能执行代码。请先通读仓库源码与许可证,确认无破坏性命令与越权访问;本站只做索引,不对第三方插件安全性作担保。

代码仓库github.com/yupeglv/dsh-chat-log
许可证未标注(见仓库)
主要语言main
下载量2
GitHub 星标0
最近推送2026-08-25
收录日期2026-09-19
分类会话与消息

事实信息来自公开插件目录快照(2026-10-01),介绍文案由本站再加工。

以下为插件仓库 README 全文(原始内容,由公开目录抓取整理)。

# dsh-chat-log

[中文](README.zh.md) | English

Turn a DSH session log into a **clean chat log**: streaming chunk fragments are folded into normal messages, and **everything else is kept verbatim**. Download it with one click next to the official "Session log" ZIP button, or via the `/chat` command.

![npm](https://img.shields.io/npm/v/dsh-chat-log) ![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)

## Why

The official `@deepseek-ai/dsh-session-log-export` downloads a ZIP of the raw log: `session.jsonl` (or multi-frame zstd), where **over 80% of the lines are token-level streaming fragments** (`assistant/chunk`, `reasoning-chunks`, `text-chunks`, `tool-call-chunks`). Reading or reusing that log means wading through thousands of fragment lines.

`dsh-chat-log` builds a readable chat view from the **authoritative folded events** (`user/message`, `assistant/message`, `tool/call`, `tool/result`), and keeps every other event (permissions, approvals, request context, lifecycle) verbatim in `events`.

> A note on fidelity: fragment deltas occasionally lose characters against the authoritative fold (observed: a missing closing quote in a tool-call argument). This plugin **always trusts the authoritative fold** and reports the comparison result in `report`.

## Features

| | official `/export` | this plugin |
|---|---|---|
| Output | raw-log ZIP (browser download) | **clean nested chat JSON** (`dsh-chat.v1`) |
| Streaming fragments | shipped as-is (80%+ of lines) | **folded into complete messages** |
| Everything else | mixed into the archive | **verbatim in `events`** (nothing dropped) |
| Download | ZIP only | **direct `.json` download** (same HEAD-preflight pattern) |
| Headless | ✗ | **`/chat` command** (zero tokens, human-command plane) |
| Verification | — | fragment↔fold comparison report |

- **Zero runtime dependencies**, single pure-data core (`lib/fold.js`) — no zstd, no zip, no server.
- **Nothing is deleted**: every non-fragment event survives byte-identical; unverifiable fragment steps fall back to keeping raw events.
- **Token effect: zero.** `/chat` stays on the human-command plane; results never enter model history.

## Requirements

- DSH Web (`dsh web`) profile with Node **≥ 22.15**
- `commands` / `sessionPersistence` / `sessions` services (mounted by the shipped profiles)

## Install

```bash
# from npm (recommended)
dsh plugin --profile web add dsh-chat-log

# from GitHub
dsh plugin --profile web add github:YupegLV/dsh-chat-log

# local (development / self-hosting)
dsh plugin --profile web add file:/absolute/path/dsh-chat-log
```

Restart `dsh web` afterwards.

### ⚠️ Browser download needs one host patch (idempotent)

The "Chat log" button's **direct browser download** relies on a host download endpoint `/api/session.chat`, hosted in `dsh-host-apiproxy` — third-party plugins cannot register their own `/api/*` routes. After install, run once:

```bash
node node_modules/dsh-chat-log/scripts/patch-apiproxy.mjs
# or from the plugin checkout: node scripts/patch-apiproxy.mjs
```

The script is idempotent (safe to re-run; backs up the original file automatically). **Re-run after every DSH upgrade** (a fresh `dsh-host-apiproxy` overwrites the patch).

> Without the patch: the button fails silently (no status text), but the `/chat` command (writes to `dsh-chats/`) always works.

## Usage

| Entry | Description |
|---|---|
| `/chat` | Export the **current** session → `/dsh-chats/chat--.json`, echoes the absolute path |
| `/chat --id ` | Export a specific session |
| `/chat --out ` | Custom output directory |
| **Chat log** button (session header) | Beside the official "Session log" ZIP button; HEAD-preflights then downloads `dsh-chat-.json` through the browser download manager (needs the host patch above) |

## Output format (`dsh-chat.v1`)

```jsonc
{
  "schema": "dsh-chat.v1",
  "session": { "id": "...", "createdAt": 1787625016270, "cwd": "...", "agentPreset": "standard", "title": "..." },
  "model": { "provider": "deepseek-official", "model": "...", "reasoningEffort": "max", "maxTokens": 256000 },
  "turns": [
    {
      "index": 1,
      "startedAt": 1787625120770,
      "user": [ { "time": 1787625120846, "content": [ { "type": "text", "text": "..." } ] } ],
      "steps": [
        {
          "index": 1,
          "assistant": {
            "time": 1787625125842,
            "reasoning": "full reasoning text",
            "text": "full reply text",
            "toolCalls": [ { "id": "call_...", "name": "bash", "arguments": "{...full args JSON...}" } ],
            "usage": { "inputTokens": ..., "outputTokens": ... }
          },
          "tools": [
            { "call": { "id": "call_...", "name": "bash", "arguments": "..." },
              "result": { "isError": false, "text": "...", "time": ... } }
          ]
        }
      ],
      "endedAt": 1787625168111
    }
  ],
  "events": [
    /* every non-fragment raw event, verbatim and in order:
       session/turn/step lifecycles, request headers & context,
       permissions, approvals, sandbox, titles, checkpoints ... */
  ]
}
```

### Nothing dropped guarantee

- `events` = every raw event **except** the stream fragments, byte-identical, in original order (verified at export: count **and** per-line identity).
- Fragment content is fully carried by the authoritative folds (every fragment step must have a matching `assistant/message`; steps without one keep their raw fragments in `events`).
- The export includes a `report`: total events, folded fragments/steps, kept events, fragment↔fold comparison.

## Development & verification

> Plugin-development pitfalls (client bundle id must be the bare package name, `file:` installs are copies not symlinks, …) live in **[docs/DEVELOPMENT.md](docs/DEVELOPMENT.md)**.

```bash
# offline core verification (no dsh runtime; input = decompressed JSONL)
node test/verify.mjs
```

Layout:

```
lib/fold.js                     pure-data core: JSONL → chat tree + verification report
lib/index.js                    host half: /chat command, flush, readRaw, atomic write
lib/client.js                   browser half: "Chat log" download button
cordis.patch.yml                profile patch layer (inserts the plugin row)
scripts/patch-apiproxy.mjs      idempotent patch: registers /api/session.chat
docs/DEVELOPMENT.md             pitfalls & mechanism notes
test/verify.mjs                 CLI verification suite
```

## Known limitations

- Requires a `sessionPersistence` backend exposing raw artifacts (JSONL backend: yes; SQLite: no — same as the official ZIP export).
- Output is pretty-printed JSON; roughly 1.2× the raw log size (authoritative folds + full `events`), ~30% if you truncate tool results.
- Direct browser download depends on the idempotent `dsh-host-apiproxy` patch (see Install; `/chat` writing to disk does not).

## License

MIT

数据来源:公开的 DeepSeek Harness 插件目录与各插件 GitHub 仓库。本站为独立第三方目录,与 DeepSeek、幻方(High-Flyer)及插件作者均无隶属或背书关系。

每日精选 Skill 推荐,免费送到你邮箱

输入邮箱,每天接收一个精选 AI Agent 技能推荐。完全免费,持续更新。

提交后我们会发送一封确认邮件,点击邮件里的链接才会开始收信。

完全免费,取消任意时间。我们不会发送垃圾邮件。