deepseek-harness
deepseek-ai
DeepSeek Harness: Everything is a Plugin.
PROJECT TOPICS
PROJECT README
English | 中文
A DeepSeek Harness bundle that carries what you are doing in your IDE right now into each model turn: the files currently open and the current text selection (file path, zero-based line/character range, selected text).
It reads the Claude Code IDE integration bridge — the same ~/.claude/ide/<port>.lock files and MCP-over-WebSocket protocol the Claude Code CLI uses — so one bundle serves both IntelliJ IDEA and Visual Studio Code.
dsh plugin add github:LSAI2023/dsh-ide-context
Then boot a profile that lists this bundle:
dsh --profile web
Users override any key in their profile's cordis.patch.yml (it applies after every bundle layer):
- id: ide-context
config:
refreshIntervalMs: 30000 # optional; omit or 0 to inject on every changed turn
pollIntervalMs: 5000 # optional; how often opened files / selection are polled
lockDir: ~/.claude/ide # optional; where the IDE <port>.lock files live
refreshIntervalMs must be a non-negative safe integer. Omission or 0 injects whenever the IDE state changed since the last injection; a positive value additionally suppresses injections within that many milliseconds of the latest one. pollIntervalMs defaults to 5000. lockDir defaults to ~/.claude/ide.
On each turn whose IDE state changed, one source-tagged context message like:
ide context (turn 1):
ide: IntelliJ IDEA
opened files (2):
- /work/project/src/main/java/com/example/Main.java
- /work/project/pom.xml
The user selected lines 15 to 19 from /work/project/src/main/java/com/example/Main.java:
public static void main(String[] args) {
System.out.println("hello");
}
This may or may not be related to the current task.
The selection block uses Claude Code's editor-selection structure: a 1-based inclusive line range, the selected text, and a fixed "may or may not be related" tail. Opened files are resolved by the IDE whose workspace exactly matches the session's working directory, falling back to the newest lock when none matches.
~/.claude/ide/<port>.lock file.~/.claude/ide; when it does not, the plugin logs a warning and injects nothing.workspaceFolders contains the session's working directory (exact or a parent directory), then falls back to the newest lock. With both IntelliJ and VS Code open, the project you launched dsh from wins.workspaceFolders; files from unrelated projects and virtual documents (git:, output:, …) are dropped so only the current project's context is returned.~/.claude/ide resolves to C:\Users\<user>\.claude\ide on Windows; drive letters compare case-insensitively). WSL (Linux host + Windows IDE) path/host conversion is not implemented yet.@deepseek-ai/dsh-llm and dependency @deepseek-ai/schemastery resolve from the DeepSeek Harness installation.This repository is self-contained: the TypeScript source lives in src/ and builds to the published index.js (and invariant.js) with esbuild.
npm install # devDependencies (esbuild, typescript, @types/node)
npm run build # bundle src/index.ts and src/invariant.ts -> index.js / invariant.js
npm test # live MCP-over-WebSocket smoke test against a local fake IDE bridge
The build keeps @deepseek-ai/* and node:* external, so the runtime dependencies resolve from the DeepSeek Harness installation exactly as before.
index.jsandinvariant.jsare committed build artifacts: the package is consumed directly from GitHub as compiled JS, so they must stay in sync withsrc/. After editingsrc/, runnpm run build(ornpm run check:buildto rebuild and fail if the artifacts drift). A one-timenode install-hooks.mjsenables a pre-commit check, and CI enforces the same guard.
The implementation is split into focused modules under src/:
src/index.ts — assembly entry point: re-exports the public API and wires the pre-step listener.src/types.ts — domain model (IdeSnapshot, IdeSelection) and configuration schema.src/constants.ts — shared names, defaults, and tunables.src/platform.ts — path/URI handling behind a Platform seam (Windows-ready).src/lock.ts — lock-file discovery and workspace selection.src/ws.ts — zero-dependency RFC 6455 WebSocket client.src/protocol.ts — MCP tool-result parsing.src/bridge.ts — connection lifecycle + snapshot maintenance (IdeBridge).src/format.ts — snapshot rendering behind a SelectionRenderStrategy.src/invariant.ts — the package-owned invariant companion (registered as @deepseek-ai/dsh-ide-context/invariant).tests/ide-context.spec.ts — unit tests ported from the DeepSeek Harness repository's packages/context/ide-context/.CLASSIFICATION EVIDENCE
系统优先读取 GitHub Topics,再与站内分类词典和词根规则比对。当前命中: 无有效分类标签。