dsh

package
v0.1.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 28, 2026 License: Apache-2.0 Imports: 21 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package dsh captures DeepSeek Harness (DSH) activity and gives its agents MemSpace context and tools.

DSH has no hooks of its own, but ships a bridge plugin (@deepseek-ai/dsh-hooks-claude-code) that runs Claude Code-style command hooks. That bridge omits assistant replies and session ends, so the source of truth is the session log DSH writes (see Importer); the hooks only add context to prompts and trigger an import. Install adds two rows to the home-level $DSH_HOME/cordis.patch.yml, inside a marked block: the hook bridge, pointed at a hooks file MemSpace owns, and an MCP client running `memspace mcp stdio`.

Index

Constants

View Source
const AgentType = "dsh"

AgentType is the agent_type stored on sessions.

View Source
const LogName = "session.v4.jsonl.zstd"

LogName is the session log file name DSH 0.2 writes.

Variables

View Source
var HooksRunInPowerShell = runtime.GOOS == "windows"

HooksRunInPowerShell: DSH runs hook commands with PowerShell on Windows and bash elsewhere.

View Source
var MCPArgs = []string{"--sync-interval", "1m"}

MCPArgs are added to `memspace mcp stdio` in DSH's MCP row: the bridge runs outside the sandbox for as long as DSH does, so it imports and uploads new session logs.

Functions

func PowerShellCommand

func PowerShellCommand(argv []string) string

PowerShellCommand renders argv as a PowerShell command line. The call operator makes a quoted program path a command rather than a string.

Types

type Adapter

type Adapter struct {
	// Home overrides the DSH home (default: see DSHHome).
	Home string
	// StateDir is MemSpace's client state dir (import cursors, install
	// state, the hooks file).
	StateDir string
}

Adapter implements adapter.Adapter for DSH.

func (*Adapter) Capabilities

func (a *Adapter) Capabilities() []string

func (*Adapter) DSHHome

func (a *Adapter) DSHHome() string

DSHHome returns the DSH home: $DSH_HOME, else the one a `dsh` wrapper script on PATH exports (installers that keep DSH outside ~/.dsh write one), else ~/.dsh.

func (*Adapter) Detect

func (a *Adapter) Detect(ctx context.Context) adapter.Detection

func (*Adapter) Doctor

func (a *Adapter) Doctor(ctx context.Context, opts adapter.InstallOptions) []adapter.Check

func (*Adapter) Enabled

func (a *Adapter) Enabled() bool

Enabled reports whether the DSH adapter is installed (the importer only runs then).

func (*Adapter) HooksPath

func (a *Adapter) HooksPath() string

HooksPath is the Claude Code-format hooks file the bridge runs.

func (*Adapter) Install

func (a *Adapter) Install(ctx context.Context, opts adapter.InstallOptions) error

func (*Adapter) MCPCheck

func (a *Adapter) MCPCheck(ctx context.Context) adapter.Check

func (*Adapter) Name

func (a *Adapter) Name() string

func (*Adapter) NewImporter

func (a *Adapter) NewImporter() *Importer

NewImporter returns the session-log importer configured at install time.

func (*Adapter) Normalize

func (a *Adapter) Normalize(raw []byte, now time.Time) ([]spool.Record, error)

Normalize records nothing: the session log has everything the bridge's hook payloads carry, and more. The hook exists to add context to prompts.

func (*Adapter) PatchPath

func (a *Adapter) PatchPath() string

PatchPath is the home-level patch layer, applied to every profile.

func (*Adapter) RegisterMCP

func (a *Adapter) RegisterMCP(ctx context.Context, opts adapter.MCPOptions) error

RegisterMCP adds an MCP client row running the stdio bridge.

func (*Adapter) Uninstall

func (a *Adapter) Uninstall(ctx context.Context, out io.Writer) error

func (*Adapter) UnregisterMCP

func (a *Adapter) UnregisterMCP(ctx context.Context) error

type Importer

type Importer struct {
	DSHHome  string
	StateDir string
	// Since skips records older than this (zero: import everything).
	Since time.Time
	// Reset ignores saved cursors (used by explicit backfills).
	Reset bool
	// contains filtered or unexported fields
}

Importer incrementally converts DSH session logs (<DSH_HOME>/sessions/<workspace>/<session>/session.v4.jsonl.zstd) into MemSpace events.

A log is a sequence of zstd frames, one per append, each holding whole JSONL records. Each file keeps the byte offset after the last frame it processed, so only new frames are decompressed. Event IDs are derived from (session, seq): re-reading a record produces the same ID and the server deduplicates it.

func (*Importer) Import

func (im *Importer) Import(ctx context.Context, sp *spool.Spool, heartbeat func()) (int, error)

Import processes new log records. It stops early (without losing its place) when the spool is full.

func (*Importer) LatestChange

func (im *Importer) LatestChange() time.Time

LatestChange returns the newest modification time of any session log.

func (*Importer) Name

func (im *Importer) Name() string

func (*Importer) Stats

func (im *Importer) Stats() (files int, lastImport time.Time)

Stats reports importer progress for doctor/status.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL