DSH Plugin Store
Back to home

huiliyi37

dsh-tianshu-build

dsh-tianshu-tui — DeepSeek Harness terminal UI

Stars
19
Language
TypeScript
Created
Aug 13, 2026
Updated
Aug 14, 2026
Terminal UI
GitHub repo

Introduction

Tianshu Harness (天枢)

English | 中文

Tianshu Harness (tianshu) is a full-capability open-source coding agent: an agent harness with vision, cross-session memory, verification gates, agent routing, semantic + graph code retrieval, file rewind, and a full-screen terminal UI — all composed as plugins.

It is a friendly fork of DeepSeek Harness (dsh, MIT) released under the Apache License 2.0. The fork point is the 2026-08 baseline; this line evolves independently and does not track upstream. See NOTICE for the full attribution.

It keeps the upstream architecture where everything is a plugin.

Install

Run it straight from npm:

npx @huiliyi37/dsh-tianshu tui

Or install globally:

npm i -g @huiliyi37/dsh-tianshu
tianshu tui

For development (or to hack on the harness itself), run from a repository checkout — requires git, Node ^22.19 || >=24, and pnpm:

git clone https://github.com/huiliyi37/dsh-tianshu-build.git
cd dsh-tianshu-build
pnpm install
pnpm run build
pnpm tianshu web

What the full build adds

Beyond the upstream baseline (files, shell/PTY, skills, tasks/goals/plans, subagents and workflows, sandboxing and approvals, resumable sessions, LSP, web access, context compaction, loop-hygiene guards), this monorepo ships the differentiated capability set:

CapabilityPackageWhat it does
Vision bridge@huiliyi37/dsh-vision-bridgeA text-only primary still reads user images: a dedicated vision model describes attachments and injects the description at agent/pre-step.
Vision co-pilot@huiliyi37/dsh-vision-askSession-scoped image registry + ask_image tool: the main model re-interrogates any retained image, any number of times, without the user re-sending it.
Project memory@huiliyi37/dsh-memoryCross-session recall (BM25 hybrid over structured claims and knowledge notes) with a quality gate on writes; /memory, /remember.
Evidence gate@huiliyi37/dsh-evidence-gateRED→GREEN discipline for bugfix tasks: edits gated on a failing-first verification account.
Agent router@huiliyi37/dsh-agent-routerBase metrics → routing algorithm → MoE-style dispatch onto native subagents.
Pheromone@huiliyi37/dsh-pheromoneFile-level stigmergy: session-scoped spatial memory via exponential-decay signals (fragile / entry-point / …).
Semantic index@huiliyi37/dsh-semantic-indexWorkspace retrieval: file-level BM25 (CJK-bigram aware) over definition-aligned chunks, optional vector layer fused via RRF; powers semantic_search.
Meridian@huiliyi37/dsh-meridianCodebase graph index (tree-sitter → sqlite): repo map, impact analysis, flow queries, behavior signals; powers repo_graph.
File rewind@huiliyi37/dsh-fs-snapshotPre-write snapshots of every file a write tool touches, backing /rewind's code/both granularity.
Git seam@huiliyi37/dsh-gitTyped git capability service (GitLocal CLI provider, typed GitErrors) consumed by tools and UI.
Terminal UI@huiliyi37/dsh-tuiFull-screen TUI on the Tianshu (opencode-tui) render core — Apache-2.0 provenance chain preserved.
Spark anchors@huiliyi37/dsh-spark-anchorsPairs with reasoning-truncating provider routes: re-injects excluded paths so the model does not re-derive ruled-out options.

Use Tianshu

Web UI

For the recommended local interface, start the Web UI from the npm install (tianshu web) or from a built checkout:

pnpm run build
pnpm tianshu web

The Web UI is served at http://127.0.0.1:3080 by default.

Profiles

tianshu boots profiles — ordered stacks of plugin-bundle patch layers under your own overrides in $DSH_HOME/profiles/<name>:

tianshu --profile web                       # the browser UI (same as: tianshu web)
tianshu plugin --profile tui add <package>  # install a plugin into a custom profile
tianshu --profile tui                       # boot it

The CLI contract describes profile layout, layer semantics, and config dump commands.

Terminal UI

Start the full-screen terminal interface:

tianshu tui          # or: tianshu --profile tui

The TUI is a port of the Tianshu (opencode-tui) render core adapted to the harness seams. Type / to open the command menu — ↑↓ to select, Tab to accept, Enter to submit, Esc to close. Press Ctrl+. any time for the shortcut map.

Slash commands

CommandEffect
/sessionsession management (list / switch)
/fork [directive]fork the current session (history copied) and switch; optional first message
/branchalias of /fork
/model [provider/model]view or switch the model (hot-swaps the live session; spark-flash / spark-pro aliases switch to DeepSeek Spark)
/theme [name]switch themes
/clearclear the current conversation's scrollback
/compactcompact the current session's context
/steer <text>mid-turn steering (redirect without interrupting)
/statusstatus panel (5-domain projection snapshot)
/configsettings panel (settings / permission / credentials)
/skillsskill browser panel
/subagentsdelegation-tree panel
/workflowrunning-workflow panel
/taskstask panel (background tasks)
/goalgoal management (create / pause / resume / complete / block)
/memorymemory browser (list / filter / delete / preview)
/remember <text>save a memory
/rewindtwo-phase rollback (message list → granularity)
/btw <question>side-question to the background agent
/doctorterminal diagnostics with fix guidance
/mcplist connected MCP servers and tools
/export [path]export the current session's transcript to a Markdown file
/densitytoggle compact tool-card rendering
/permissionswitch the permission preset (workspace-write / danger-full-access)

Keyboard shortcuts

KeyEffect
Ctrl+Nnew session
Ctrl+Sresume the most recent session
Ctrl+Qquit
Ctrl+Pcommand palette
Ctrl+.shortcut map overlay
Ctrl+Fhistory search (n/N jump)
Ctrl+Oopen the input line in $EDITOR
Ctrl+Tmid-turn steer
Ctrl+Vpaste the system-clipboard image (clipboard-text fallback when the clipboard holds no image)
Alt+Wcopy the selection to the system clipboard (OSC52)
Shift+Tabcycle mode: normal → plan → always-approve
Tab@-path completion; accept a slash-menu selection
↑/↓input history (menu selection while the slash menu is open)
PageUp/PageDownpage the slash menu
Escclose the slash menu or overlays

Interaction

Tool approvals prompt inline as ⚠ 允许执行 …?[y/N] with a unified diff preview above the prompt. Subagent runs appear as spinner lines in the live region and settle into ✓/✗/◌ scrollback entries on completion. The bottom three rows are the input line (with a bottom-edge line colored by mode), the footer (mode badges + shortcut hints), and the metrics row (model / token usage / cache hit rate).

Image paste and terminal preview

Ctrl+V (or right-click / terminal-menu paste) reads the system clipboard image — macOS osascript, Linux wl-paste/xclip, Windows PowerShell — and attaches it; pasting text that looks like an image path loads the file as an attachment instead. Attached images render as a 📎 N images marker above the input line and, on submit, as inline terminal graphics (kitty / iTerm2 protocols) under the user bubble. The bubble carries a vision hint: an image-capable primary sees the image directly; a text-only primary with a vision bridge configured gets the image described by the vision model first; with neither, the TUI warns that the image was not sent (and does not submit it).

Vision bridge (optional)

dsh-vision-bridge lets a text-only primary still read user images: at agent/pre-step it describes image attachments through a dedicated vision model and injects the description as a plugin-source user message (model-visible ⟺ logged; bridge failure degrades to a visible note, never a failed turn). Enable by adding the plugin with a vision-capable provider/model:

# cordis.yml
- id: vision-bridge
  name: '@huiliyi37/dsh-vision-bridge'
  config:
    provider: deepseek-official   # any registered llm route that can see images
    model: <vision-capable model>

and set the TUI's vision state (in the tui-runner bundle config) so the bubble hint reflects the bridge: supportsVision: false, bridgeEnabled: true.

Vision co-pilot (ask_image, optional)

dsh-vision-ask goes one step further than the bridge: every image the user attaches is registered in a session-scoped registry under a short id (img_1, …), and the ask_image tool lets the main model re-interrogate any retained image — different questions, different angles — without the user re-sending it. A multimodal primary gets the original image forwarded back; a text-only primary gets a vision-model answer about the image. See packages/tui/vision-ask for configuration.

DeepSeek Spark mode

The deepseek-spark provider route truncates assistant reasoning to the tail N tokens on the wire (flash 300 / pro opt-in), keeping the model's context lean; dsh-spark-anchors pairs with it, re-injecting the excluded paths so the model does not re-derive ruled-out options. Enable once — settings hot-reload, no restart:

# settings.yaml
llm-deepseek:
  spark:
    enabled: true

then switch with /model spark-flash or /model spark-pro (aliases for deepseek-spark/deepseek-v4-flash / deepseek-spark/deepseek-v4-pro). Spark shares the DeepSeek API key — no extra configuration. dsh-spark-anchors mounts with the tui bundle, so the anchor compensation is live once a session runs on the deepseek-spark route; a self-assembled profile adds it explicitly (see the package README).

Headless

Run one task, print the final answer, and exit:

tianshu run "summarize this workspace"

Automation and SDKs

From a source checkout with DEEPSEEK_API_KEY in the environment or its root .env, start the ACP automation server:

pnpm run demo:acp

The Python SDK drives a bundled JSON-RPC runtime. The examples cover the runnable headless, ACP, JSON-RPC, Code Mode, and self-referential compositions.

Architecture

  • Everything is a plugin. Models, tools, policies, storage, context management, and interfaces are composable Cordis plugins, so deployments can extend or replace behavior without forking the agent loop. See the architecture for the underlying design.
  • Runs are reconstructable. Anything visible to the model is logged in the authoritative session stream; persistence, resume/fork/query, replay, telemetry, and UIs derive from the same events. See the session-log architecture.
  • Code Mode (opt-in). It exposes a run_code tool and a generated TypeScript SDK; only program output re-enters model context. See Code Mode.
  • Self-referential Cordis tools are opt-in. They let the agent inspect its live runtime and mount or unmount plugins while it runs. See the Cordis tools.

Telemetry

Disabled by default — nothing is uploaded anywhere. To stream session telemetry to your own OTLP/HTTP collector, set DSH_TELEMETRY_OTLP_URL (e.g. https://collector.example.com/v1/logs). A non-empty DSH_TELEMETRY_DISABLED force-disables it regardless of other settings.

Relationship with upstream dsh

This project forked from DeepSeek Harness (MIT) at the 2026-08 baseline and evolves independently — it does not track upstream releases, and its packages live under the @huiliyi37/* npm scope (CLI: @huiliyi37/dsh-tianshu, bin tianshu) so the two lines never collide. The repository is licensed under the Apache License 2.0; upstream attribution is preserved in NOTICE, and the TUI package carries its own Apache-2.0 provenance chain (LICENSE / NOTICE / SOURCE-MAP). The plugin-only distribution (dsh-tianshu-tui as an upstream-dsh plugin) is paused for now; this full monorepo is the maintained line.

Development

Start with the development guide and read the architecture before changing packages.

For agents, follow AGENTS.md.

License

Apache-2.0. Upstream and third-party attributions: NOTICE and THIRD_PARTY_NOTICES.md.