dsh-session-path: Session Path Replication and Continuation File Generation

Introduction

DeepSeek Harness (DSH) session logs are stored in the $DSH_HOME/sessions/ directory, with files in a multi-frame Zstandard-compressed JSONL format. In real-world development, there are two pain points: first, the GUI lacks a direct entry to copy the session path; second, the log files use a container format that fails when read directly. The dsh-session-path plugin aims to solve both problems by adding a path-copying feature for sessions and providing tools to convert logs into readable files.

Installation

Install the plugin to a specified profile via npm:

dsh plugin --profile desktop add dsh-session-path

Core Features

The plugin primarily provides capabilities across three dimensions: GUI interaction, read-only tools, and read-write tools.

  1. GUI Interaction: Adds a copy button to the session title bar and a copy-path option to the sidebar menu.
  2. Read-only Tool (session_path): Provides a tool to read session path information without any disk writes.
  3. Read-write Tool (session_handoff): Generates readable handoff files and supports Zstandard multi-frame log parsing.

Usage

1. GUI Copy

  • Current Session: Click the ⧉ button on the right side of the session title bar to copy the continuation block (containing the title, ID, working directory, and log path) to the clipboard.
  • Any Session: Right-click on a session row in the sidebar; the last item in the menu is “Copy Session Path”. You can retrieve the path without opening the session.

2. Command-line Tools

  • Read Path (session_path)

    Retrieves the session path and basic information. Read-only operation.

    // Get the continuation block format path of the current session
    session_path({ format: "block" })

    // Get the raw path of the current session
    session_path({ format: "path" })
  • Generate Handoff File (session_handoff)

    Renders the session log as a readable file and writes it to the specified directory (default: $DSH_HOME/session-handoff).

    // Generate a Markdown format handoff file
    session_handoff({ sessionId: "xxx", format: "md" })

    // Generate a raw JSONL format file with a character limit
    session_handoff({ format: "jsonl", maxChars: 50000 })
Output files automatically truncate content exceeding `maxChars`, retaining the most recent portion, which is suitable as context for subsequent sessions.

Technical Details and Notes

  • Memory Efficiency: When parsing Zstandard logs, the plugin does not decompress the entire file into memory; instead, it scans frame by frame, holding only a single frame of data at a time.
  • Write Safety: The session_path tool and HTTP routes are read-only; only session_handoff writes to disk, and only to the configured handoffDir.
  • Access Control: HTTP routes include a trust fence, allowing access only from loopback or explicitly configured trusted hosts, and rejecting cross-site requests.
  • File Retention: Handoff files retain the most recent portion based on the character budget, as the tail context is most valuable for handoff tasks.

Summary

Through GUI buttons and command-line tools, this plugin fills in the capabilities for obtaining DSH session paths and reading logs. It is particularly suitable for agent development scenarios that require context relay or log analysis across multiple sessions.

羽毛球分组比赛记分
小程序二维码

欢迎使用《羽毛球分组比赛记分》微信小程序

Xiaoye