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
- Variables
- func PowerShellCommand(argv []string) string
- type Adapter
- func (a *Adapter) Capabilities() []string
- func (a *Adapter) DSHHome() string
- func (a *Adapter) Detect(ctx context.Context) adapter.Detection
- func (a *Adapter) Doctor(ctx context.Context, opts adapter.InstallOptions) []adapter.Check
- func (a *Adapter) Enabled() bool
- func (a *Adapter) HooksPath() string
- func (a *Adapter) Install(ctx context.Context, opts adapter.InstallOptions) error
- func (a *Adapter) MCPCheck(ctx context.Context) adapter.Check
- func (a *Adapter) Name() string
- func (a *Adapter) NewImporter() *Importer
- func (a *Adapter) Normalize(raw []byte, now time.Time) ([]spool.Record, error)
- func (a *Adapter) PatchPath() string
- func (a *Adapter) RegisterMCP(ctx context.Context, opts adapter.MCPOptions) error
- func (a *Adapter) Uninstall(ctx context.Context, out io.Writer) error
- func (a *Adapter) UnregisterMCP(ctx context.Context) error
- type Importer
Constants ¶
const AgentType = "dsh"
AgentType is the agent_type stored on sessions.
const LogName = "session.v4.jsonl.zstd"
LogName is the session log file name DSH 0.2 writes.
Variables ¶
var HooksRunInPowerShell = runtime.GOOS == "windows"
HooksRunInPowerShell: DSH runs hook commands with PowerShell on Windows and bash elsewhere.
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 ¶
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 (*Adapter) DSHHome ¶
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) Enabled ¶
Enabled reports whether the DSH adapter is installed (the importer only runs then).
func (*Adapter) NewImporter ¶
NewImporter returns the session-log importer configured at install time.
func (*Adapter) Normalize ¶
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) RegisterMCP ¶
RegisterMCP adds an MCP client row running the stdio bridge.
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 ¶
Import processes new log records. It stops early (without losing its place) when the spool is full.
func (*Importer) LatestChange ¶
LatestChange returns the newest modification time of any session log.