dsh-code 0.5.0 → 0.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.en.md ADDED
@@ -0,0 +1,219 @@
1
+ # DSH-Code
2
+
3
+ English | [中文](README.md)
4
+
5
+ <p align="center"><img src="docs/pictures/1.png" width="95%" alt="DSH-Code terminal with slash-command completion"></p>
6
+
7
+ <p align="center"><img alt="Typing SVG" src="https://readme-typing-svg.herokuapp.com?font=JetBrains+Mono&amp;weight=500&amp;size=22&amp;duration=4000&amp;pause=700&amp;color=4176E6&amp;center=true&amp;vCenter=true&amp;width=680&amp;lines=DeepSeek+Harness+Code;DSH+%E5%86%85%E6%A0%B8%E7%9A%84%E7%BB%88%E7%AB%AF%E7%BC%96%E7%A0%81%E7%95%8C%E9%9D%A2"></p>
8
+ <p align="center">
9
+ <a href="https://github.com/deepseek-ai/deepseek-harness"><img alt="DeepSeek Harness" src="https://img.shields.io/badge/DeepSeek-Harness-4176E6?style=for-the-badge&amp;logo=deepseek&amp;logoColor=white&amp;labelColor=1c1917"></a>
10
+ <a href="https://github.com/UNLINEARITY/dsh-code/stargazers"><img alt="GitHub stars" src="https://img.shields.io/github/stars/UNLINEARITY/dsh-code?label=Stars&amp;style=for-the-badge&amp;logo=github&amp;logoColor=white&amp;color=4176E6&amp;labelColor=1c1917"></a>
11
+ <a href="https://www.npmjs.com/package/dsh-code"><img alt="npm version" src="https://img.shields.io/npm/v/dsh-code?label=npm&amp;style=for-the-badge&amp;logo=npm&amp;color=cb3837&amp;labelColor=1c1917"></a>
12
+ <a href="https://github.com/UNLINEARITY/dsh-code/blob/main/LICENSE"><img alt="License" src="https://img.shields.io/github/license/UNLINEARITY/dsh-code?label=License&amp;style=for-the-badge&amp;logo=opensourceinitiative&amp;color=4176E6&amp;labelColor=1c1917"></a>
13
+ </p>
14
+
15
+ **DSH-Code is a terminal coding interface for [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness) (`dsh`).** It runs as an out-of-tree bundle over the official `@deepseek-ai/dsh-base` and uses the same Agent, Session, tool, command, skill, permission, sandbox, compaction, and plugin services as the Harness Web UI.
16
+
17
+ DSH-Code does not implement a separate agent loop. It adds a coding-focused TUI to the DSH runtime, drawing on the session handling of [Codex CLI](https://github.com/openai/codex) and the terminal interaction patterns of [Claude Code](https://code.claude.com/docs/en/overview).
18
+
19
+ ---
20
+
21
+ ## 1. Overview
22
+
23
+ DeepSeek Harness treats models, tools, storage, policies, and interfaces as plugins registered through Cordis. Durable session events record the conversation and runtime state needed for replay.
24
+
25
+ DSH-Code keeps that structure and adds a terminal workflow for coding tasks.
26
+
27
+ | Reference | Used in DSH-Code |
28
+ | --- | --- |
29
+ | **DeepSeek Harness** | Plugin composition, scoped services, Agent Presets, durable sessions, tools, skills, policies, sandboxing, and delegation |
30
+ | **Codex CLI** | Session navigation, bounded overlays, history inspection, stable bottom layout, and resize handling |
31
+ | **Claude Code** | Slash-command discovery, thinking folds, approvals, questions, and turn steering |
32
+
33
+ The interface follows familiar terminal conventions, while runtime behavior continues to come from DSH services and configuration.
34
+
35
+ ## 2. Quick start
36
+
37
+ Requires Node `^22.19 || >=24`, the preview `dsh` CLI, and `DEEPSEEK_API_KEY`.
38
+
39
+ ```sh
40
+ npm install -g @deepseek-ai/dsh dsh-code
41
+ npm install -g pnpm
42
+ dsh plugin --profile cli add dsh-code@0.6.1
43
+ ```
44
+
45
+ > Note: pnpm ignores packages published less than 24 hours ago, so pin `dsh-code@0.6.1` on the release day; the version can be omitted afterwards. npm installs are not affected.
46
+
47
+ Available launch commands:
48
+
49
+ ```sh
50
+ deepseek
51
+ dsh --profile cli
52
+ dsh-code
53
+ ```
54
+
55
+ `dsh --profile cli`, `deepseek`, and `dsh-code` are parallel launch commands. `deepseek` and `dsh-code` are global aliases for `dsh --profile cli`; all following arguments are forwarded, for example `deepseek --resume abc123`.
56
+
57
+ > DeepSeek Harness is currently a developer preview and may introduce compatibility-breaking changes. DSH-Code tracks that evolving plugin surface.
58
+
59
+ For installation, native-module, and plugin-loading issues, see the [troubleshooting guide](docs/problems.md).
60
+
61
+ ## 3. Terminal interaction
62
+
63
+ ### Basics
64
+
65
+ DSH-Code keeps one Ink owner for the lifetime of the process. `/new` and `/resume` replace the active Agent, not the terminal itself. If a switch is requested while the Agent is busy, it waits for the turn to finish; the newest request wins, and a failed target leaves the current session untouched.
66
+
67
+ Dynamic content is deliberately bounded. Streaming output, thinking, approvals, questions, `/help`, `/model`, `/mode`, `/resume`, `/plugin`, and Ctrl+O all share terminal-aware viewport rules. The composer remains immediately above the status line. After a resize, the screen is redrawn from the stored transcript once the new width settles.
68
+
69
+ Use `/mode` before the first turn to inspect or select the session's Agent Preset.
70
+
71
+ <p align="center"><img src="docs/pictures/2.png" width="95%" alt="Per-session Agent Preset picker"></p>
72
+
73
+ Use `/resume` to search persisted sessions without restarting the TUI.
74
+
75
+ <p align="center"><img src="docs/pictures/3.png" width="95%" alt="Searchable session resume picker"></p>
76
+
77
+ ### Common commands
78
+
79
+ ```sh
80
+ dsh --profile cli # start a fresh standard session
81
+ dsh --profile cli --mode code # start with an Agent Preset
82
+ dsh --profile cli --continue # resume the newest session for this directory
83
+ dsh --profile cli --resume abc123 # resume by id or unique prefix
84
+ dsh --profile cli --session my-id # start a fresh session with an explicit id
85
+ ```
86
+
87
+ Inside the TUI:
88
+
89
+ | Action | Purpose |
90
+ | --- | --- |
91
+ | `/new [preset]` | Create and enter another session without restarting the terminal |
92
+ | `/resume [id\|prefix]` | Search root sessions or all conversations; filter by cwd, order, and density |
93
+ | `/mode [preset]` | Inspect or select the blank session's Agent composition |
94
+ | `/model` | Switch among models advertised by the live LLM registry |
95
+ | `/plugin [query]` | Inspect loader entries, enabled state, module identity, and fiber phase |
96
+ | `/permission <name>` | Change the permission preset; Shift+Tab cycles presets |
97
+ | `/help` | Browse local commands, Harness commands, skills, and key bindings |
98
+ | `Ctrl+O` | Open the exclusive history detail view; switch entries and scroll all content |
99
+ | `Ctrl+R` | Fold or reveal model reasoning |
100
+ | `@` | Mention workspace files or bounded snapshots of persisted sessions |
101
+ | `Esc` / `Ctrl+C` | Close the topmost surface or interrupt the active turn |
102
+
103
+ ## 4. Features
104
+
105
+ ### 1. Agent and extensions
106
+
107
+ - Per-session Agent Presets for tools, prompt sections, skills, compaction, plan mode, and delegation
108
+ - Live slash-command and skill discovery from shared Harness registries
109
+ - Read-only Cordis loader diagnostics through `/plugin`
110
+ - Model routing through the live LLM registry, restored per persisted session
111
+ - Plans, goals, todos, permissions, sandbox state, subagents, and runtime steering
112
+
113
+ ### 2. Sessions and context
114
+
115
+ - `/new`, `/resume`, `--continue`, and explicit session identifiers without remounting Ink
116
+ - Codex-style searchable resume panel with root/all-conversation, cwd, order, and density filters
117
+ - Bare launches defer session creation until your first real input; quitting early leaves nothing behind
118
+ - Global input recall: Up/Down walks past prompts across sessions, and `/history` searches and fills the composer
119
+ - Lazy title snapshots and explicitly loaded, fully scrollable transcripts
120
+ - Read-only subagent conversation inspection and bounded `@` session references
121
+ - Markdown export, persistent titles, context occupancy, cache, token, TTFT, and timing metrics
122
+
123
+ ### 3. Approvals and interaction
124
+
125
+ - One-shot tool approval bar for sandbox escalation and hook `ask` decisions
126
+ - Structured `ask_user_question` and plan-review menus with multi-select and custom answers
127
+ - Turn steering at the next step boundary plus explicit interruption semantics
128
+ - Independent Agent mode, plan state, permission preset, goal, and sandbox indicators
129
+
130
+ ### 4. Terminal rendering
131
+
132
+ - Append-only settled transcript with bounded mutable streaming output
133
+ - Folded thinking, terminal Markdown, compact tool summaries, and full structured details
134
+ - Two-row status bar with mode and context on the second row, a blue context-occupancy meter, and all-blue accents
135
+ - Submissions while a turn runs appear immediately as ordinary prompt rows; Delete cancels the newest queued message, and busy states use the web StateDot chase animation
136
+ - Replies align with the input cursor, and the welcome wordmark is brighter
137
+ - Ctrl+O exclusive history inspection with entry navigation and complete vertical scrolling
138
+ - Width-safe CJK/control-character handling, compact-terminal degradation, and debounced resize replay
139
+ - Stable bottom order: content or panel → notice → composer → status
140
+
141
+ ## 5. How DSH-Code integrates with DSH
142
+
143
+ ### 1. Runtime composition
144
+
145
+ DSH-Code reads the live Harness registries instead of maintaining separate copies. Model adapters, tool providers, skill sources, commands, permission policies, persistence backends, sandboxes, and subagent providers can be added or replaced through DSH composition.
146
+
147
+ `/plugin` provides a read-only view of the current Cordis loader state.
148
+
149
+ ### 2. Session-scoped Agent Presets
150
+
151
+ The Host owns shared infrastructure—registries, persistence, session queries, permissions, and sandbox policy—while each session receives an isolated Agent scope composed from an **Agent Preset**:
152
+
153
+ - `standard` — the full general-purpose coding agent
154
+ - `code` — Code Mode / PTC-oriented multi-operation workflows
155
+ - `minimal` — only persistent shell access and `str_replace_editor`
156
+ - `cordis` — the full agent plus runtime inspection and preset-authoring guidance
157
+ - user presets — your own tools, prompt sections, skills, compaction, plan mode, and subagent behavior
158
+
159
+ Use `/mode` before the first turn or start directly with `--mode <preset>`. The selected preset is written to the session and restored on resume.
160
+
161
+ ### 3. Session history and replay
162
+
163
+ Prompts, streamed chunks, tool calls and results, model choices, plan state, permissions, titles, and preset selections are projected from durable Session events. Resume, export, history inspection, context accounting, and terminal replay use the same record.
164
+
165
+ React state is limited to temporary interface details such as the input draft, cursor, open panel, selection, and scroll position.
166
+
167
+ ```text
168
+ dsh profile
169
+ └─ Host plane: registries · persistence · query · permissions · sandbox
170
+ ├─ Agent session A + preset code
171
+ ├─ Agent session B + preset minimal
172
+ └─ DSH-Code TUI
173
+ durable events → pure projection → append-only transcript
174
+ └→ bounded panels → composer → status
175
+ ```
176
+
177
+ ## 6. Development
178
+
179
+ ```sh
180
+ pnpm install
181
+ pnpm test
182
+ pnpm typecheck
183
+ pnpm build
184
+ pnpm run gen:whale # regenerate src/whale-glyph.ts from the vendored logo path
185
+ ```
186
+
187
+ The whale glyph is generated from the DeepSeek FishLogo geometry vendored in `scripts/fish-logo.ts` (source: DeepSeek Harness, MIT).
188
+
189
+ ### 1. Source development installation
190
+
191
+ For a local checkout:
192
+
193
+ ```sh
194
+ dsh plugin --profile cli add file:C:/path/to/dsh-code
195
+ ```
196
+
197
+ GitHub installation is available for source development:
198
+
199
+ ```sh
200
+ dsh plugin --profile cli add github:unlinearity/dsh-code
201
+ ```
202
+
203
+ The Git package builds during installation. If pnpm asks for an `allowBuilds` entry, copy the complete entry it prints into `~/.dsh/profiles/cli/pnpm-workspace.yaml`, then run the command again. The key includes the Git URL and commit, so do not replace it with only `dsh-code`.
204
+
205
+ ### 2. References
206
+
207
+ - Runtime services, events, plugin scopes, and persistence follow **DeepSeek Harness**.
208
+ - Session navigation, popup sizing, scrollback, bottom-pane layout, and resize behavior refer to **Codex CLI**.
209
+ - Slash discovery, turn steering, thinking folds, approvals, and question flows refer to **Claude Code**.
210
+
211
+ DSH-Code is an independent MIT-licensed community project and is not affiliated with OpenAI or Anthropic.
212
+
213
+ Communities:
214
+ - [Linux DO](https://linux.do/): Learn AI, head to L Station!
215
+ - [Deepseek harness](https://www.deepseek.com/harness): DSH official website.
216
+
217
+ ## License
218
+
219
+ [MIT](LICENSE). The vendored FishLogo geometry is from DeepSeek Harness (MIT).
package/README.md CHANGED
@@ -1,9 +1,10 @@
1
1
  # DSH-Code
2
2
 
3
- English | [中文](README.zh.md)
3
+ [English](README.en.md) | 中文
4
4
 
5
- <p align="center"><img alt="Typing SVG" src="https://readme-typing-svg.herokuapp.com?font=JetBrains+Mono&amp;weight=500&amp;size=22&amp;duration=4000&amp;pause=700&amp;color=4176E6&amp;center=true&amp;vCenter=true&amp;width=680&amp;lines=DeepSeek+Harness+Code;DSH+%E5%86%85%E6%A0%B8%E7%9A%84%E7%BB%88%E7%AB%AF%E7%BC%96%E7%A0%81%E7%95%8C%E9%9D%A2"></p>
5
+ <p align="center"><img src="docs/pictures/1.png" width="95%" alt="带斜杠命令补全的 DSH-Code 终端"></p>
6
6
 
7
+ <p align="center"><img alt="Typing SVG" src="https://readme-typing-svg.herokuapp.com?font=JetBrains+Mono&amp;weight=500&amp;size=22&amp;duration=4000&amp;pause=700&amp;color=4176E6&amp;center=true&amp;vCenter=true&amp;width=680&amp;lines=DeepSeek+Harness+Code;DSH+%E5%86%85%E6%A0%B8%E7%9A%84%E7%BB%88%E7%AB%AF%E7%BC%96%E7%A0%81%E7%95%8C%E9%9D%A2"></p>
7
8
  <p align="center">
8
9
  <a href="https://github.com/deepseek-ai/deepseek-harness"><img alt="DeepSeek Harness" src="https://img.shields.io/badge/DeepSeek-Harness-4176E6?style=for-the-badge&amp;logo=deepseek&amp;logoColor=white&amp;labelColor=1c1917"></a>
9
10
  <a href="https://github.com/UNLINEARITY/dsh-code/stargazers"><img alt="GitHub stars" src="https://img.shields.io/github/stars/UNLINEARITY/dsh-code?label=Stars&amp;style=for-the-badge&amp;logo=github&amp;logoColor=white&amp;color=4176E6&amp;labelColor=1c1917"></a>
@@ -11,197 +12,207 @@ English | [中文](README.zh.md)
11
12
  <a href="https://github.com/UNLINEARITY/dsh-code/blob/main/LICENSE"><img alt="License" src="https://img.shields.io/github/license/UNLINEARITY/dsh-code?label=License&amp;style=for-the-badge&amp;logo=opensourceinitiative&amp;color=4176E6&amp;labelColor=1c1917"></a>
12
13
  </p>
13
14
 
14
- <p align="center"><img src="docs/pictures/1.png" width="95%" alt="DSH-Code terminal with slash-command completion"></p>
15
-
16
- **DSH-Code is a terminal coding interface for [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness) (`dsh`).** It runs as an out-of-tree bundle over the official `@deepseek-ai/dsh-base` and uses the same Agent, Session, tool, command, skill, permission, sandbox, compaction, and plugin services as the Harness Web UI.
15
+ **DSH-Code [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness)(`dsh`)的终端编码界面。** 它以树外 bundle 的形式组合在官方 `@deepseek-ai/dsh-base` 之上,与 Harness Web UI 使用同一套 Agent、Session、工具、命令、技能、权限、sandbox、上下文压缩与插件服务。
17
16
 
18
- DSH-Code does not implement a separate agent loop. It adds a coding-focused TUI to the DSH runtime, drawing on the session handling of [Codex CLI](https://github.com/openai/codex) and the terminal interaction patterns of [Claude Code](https://code.claude.com/docs/en/overview).
17
+ DSH-Code 没有另外实现一套 Agent loop,而是在 DSH 运行时上增加面向编码工作的 TUI。会话处理参考 [Codex CLI](https://github.com/openai/codex),终端交互参考 [Claude Code](https://code.claude.com/docs/en/overview)
19
18
 
20
19
  ---
21
20
 
22
- ## Overview
21
+ ## 一、项目概览
23
22
 
24
- DeepSeek Harness treats models, tools, storage, policies, and interfaces as plugins registered through Cordis. Durable session events record the conversation and runtime state needed for replay.
23
+ DeepSeek Harness 将模型、工具、存储、策略和界面作为插件,通过 Cordis 注册。持久化会话事件记录恢复对话与运行状态所需的信息。
25
24
 
26
- DSH-Code keeps that structure and adds a terminal workflow for coding tasks.
25
+ DSH-Code 保留这套结构,并补充适合编码任务的终端工作流。
27
26
 
28
- | Reference | Used in DSH-Code |
27
+ | 参考项目 | DSH-Code 使用的机制 |
29
28
  | --- | --- |
30
- | **DeepSeek Harness** | Plugin composition, scoped services, Agent Presets, durable sessions, tools, skills, policies, sandboxing, and delegation |
31
- | **Codex CLI** | Session navigation, bounded overlays, history inspection, stable bottom layout, and resize handling |
32
- | **Claude Code** | Slash-command discovery, thinking folds, approvals, questions, and turn steering |
29
+ | **DeepSeek Harness** | 插件组合、作用域服务、Agent Preset、持久会话、工具、技能、策略、sandbox 与委派 |
30
+ | **Codex CLI** | 会话导航、有界浮层、历史检查、稳定底部布局与缩放处理 |
31
+ | **Claude Code** | 斜杠命令发现、思考折叠、审批、提问与 turn steering |
33
32
 
34
- The interface borrows familiar terminal conventions, while runtime behavior continues to come from DSH services and configuration.
33
+ 界面采用开发者熟悉的终端操作方式,运行行为仍由 DSH 服务和配置决定。
35
34
 
36
- ## Quick start
35
+ ## 二、快速开始
37
36
 
38
- Requires Node `^22.19 || >=24`, the preview `dsh` CLI, and `DEEPSEEK_API_KEY`.
39
-
40
- ```sh
41
- npm install -g @deepseek-ai/dsh@next dsh-code
42
- npm install -g pnpm
43
- dsh plugin --profile cli add dsh-code
44
- ```
45
-
46
- Available launch commands:
47
-
48
- ```sh
49
- deepseek
50
- dsh --profile cli
51
- dsh-code
52
- ```
53
-
54
- `dsh --profile cli`, `deepseek`, and `dsh-code` are parallel launch commands. `deepseek` and `dsh-code` are global aliases for `dsh --profile cli`; all following arguments are forwarded, for example `deepseek --resume abc123`.
55
-
56
- ### Source development
57
-
58
- For a local checkout:
37
+ 需要 Node `^22.19 || >=24`、预览版 `dsh` CLI,以及 `DEEPSEEK_API_KEY`。
59
38
 
60
39
  ```sh
61
- dsh plugin --profile cli add file:C:/path/to/dsh-code
40
+ npm install -g @deepseek-ai/dsh dsh-code
41
+ npm install -g pnpm
42
+ dsh plugin --profile cli add dsh-code@0.6.1
62
43
  ```
63
44
 
64
- GitHub installation is available for source development:
45
+ > 提示:pnpm 会忽略发布不足 24 小时的包,因此发布首日请使用精确版本 `dsh-code@0.6.1`;24 小时后可省略版本号。npm 安装不受此限制。
65
46
 
47
+ 可用的启动指令:
66
48
  ```sh
67
- dsh plugin --profile cli add github:unlinearity/dsh-code
49
+ deepseek
50
+ dsh --profile cli
51
+ dsh-code
68
52
  ```
69
53
 
70
- The Git package builds during installation. If pnpm asks for an `allowBuilds` entry, copy the complete entry it prints into `~/.dsh/profiles/cli/pnpm-workspace.yaml`, then run the command again. The key includes the Git URL and commit, so do not replace it with only `dsh-code`.
71
-
72
- > DeepSeek Harness is currently a developer preview and may introduce compatibility-breaking changes. DSH-Code tracks that evolving plugin surface.
73
-
74
- For installation, native-module, and plugin-loading issues, see the [troubleshooting guide](docs/problems.md).
75
-
76
- ## How it works with DSH
77
-
78
- ## Terminal behavior
79
-
80
- DSH-Code keeps one Ink owner for the lifetime of the process. `/new` and `/resume` replace the active Agent, not the terminal itself. If a switch is requested while the Agent is busy, it waits for the turn to finish; the newest request wins, and a failed target leaves the current session untouched.
81
-
82
- Dynamic content is deliberately bounded. Streaming output, thinking, approvals, questions, `/help`, `/model`, `/mode`, `/resume`, `/plugin`, and Ctrl+O all share terminal-aware viewport rules. The composer remains immediately above the status line. After a resize, the screen is redrawn from the stored transcript once the new width settles.
83
-
84
- Use `/mode` before the first turn to inspect or select the session's Agent Preset.
85
-
86
- <p align="center"><img src="docs/pictures/2.png" width="95%" alt="Per-session Agent Preset picker"></p>
87
-
88
- Use `/resume` to search persisted sessions without replacing the TUI.
89
-
90
- <p align="center"><img src="docs/pictures/3.png" width="95%" alt="Searchable session resume picker"></p>
91
-
92
- ### Runtime composition
54
+ `dsh --profile cli`、`deepseek` `dsh-code` 是并列的启动命令。`deepseek` `dsh-code` 都是 `dsh --profile cli` 的全局别名,后续参数会原样转发,例如 `deepseek --resume abc123`。
93
55
 
94
- DSH-Code reads the live Harness registries instead of maintaining separate copies. Model adapters, tool providers, skill sources, commands, permission policies, persistence backends, sandboxes, and subagent providers can be added or replaced through DSH composition.
56
+ > DeepSeek Harness 目前仍处于 developer preview,可能出现破坏兼容性的变化;DSH-Code 会持续跟随其插件接口演进。
95
57
 
96
- `/plugin` provides a read-only view of the current Cordis loader state.
58
+ 安装、原生模块和插件加载问题,请查看[常见问题与排障](docs/problems.md)。
97
59
 
98
- ### Session-scoped Agent Presets
60
+ ## 三、终端交互
99
61
 
100
- The Host owns shared infrastructure—registries, persistence, session queries, permissions, and sandbox policy—while each session receives an isolated Agent scope composed from an **Agent Preset**:
62
+ ### 基础
101
63
 
102
- - `standard` the full general-purpose coding agent
103
- - `code` — Code Mode / PTC-oriented multi-operation workflows
104
- - `minimal` — only persistent shell access and `str_replace_editor`
105
- - `cordis` — the full agent plus runtime inspection and preset-authoring guidance
106
- - user presets — your own tools, prompt sections, skills, compaction, plan mode, and subagent behavior
64
+ DSH-Code 在整个进程中只保留一个 Ink owner。`/new` 和 `/resume` 替换的是活动 Agent,而不是终端本身。若 Agent 忙碌,切换会等待当前 turn 自然结束;最新请求优先,目标加载失败也不会破坏当前会话。
107
65
 
108
- Use `/mode` before the first turn or start directly with `--mode <preset>`. The selected preset is written to the session and restored on resume.
66
+ 所有动态内容都受到明确的视口约束。流式输出、思考过程、审批、问题、`/help`、`/model`、`/mode`、`/resume`、`/plugin` Ctrl+O 使用统一的终端预算。输入框始终紧贴状态栏上方;终端宽度稳定后,界面会根据保存的会话记录重新绘制一次。
109
67
 
110
- ### Session history and replay
68
+ 在第一次 turn 之前使用 `/mode`,查看或选择当前会话的 Agent Preset。
111
69
 
112
- Prompts, streamed chunks, tool calls, results, model choices, plan state, permissions, titles, and preset selections are projected from durable Session events. Resume, export, history inspection, context accounting, and terminal replay use the same record.
70
+ <p align="center"><img src="docs/pictures/2.png" width="95%" alt="每会话 Agent Preset 选择器"></p>
113
71
 
114
- React state is limited to temporary interface details such as the input draft, cursor, open panel, selection, and scroll position.
72
+ 使用 `/resume` 搜索持久会话,无需重新启动 TUI。
115
73
 
116
- ```text
117
- dsh profile
118
- └─ Host plane: registries · persistence · query · permissions · sandbox
119
- ├─ Agent session A + preset code
120
- ├─ Agent session B + preset minimal
121
- └─ DSH-Code TUI
122
- durable events → pure projection → append-only transcript
123
- └→ bounded panels → composer → status
124
- ```
74
+ <p align="center"><img src="docs/pictures/3.png" width="95%" alt="可搜索的会话恢复选择器"></p>
125
75
 
126
- ## Common commands
76
+ ### 常用命令
127
77
 
128
78
  ```sh
129
- dsh --profile cli # start a fresh standard session
130
- dsh --profile cli --mode code # start with an Agent Preset
131
- dsh --profile cli --continue # newest session for this directory
132
- dsh --profile cli --resume abc123 # persisted session by id or unique prefix
133
- dsh --profile cli --session my-id # fresh session with an explicit id
79
+ dsh --profile cli # 新建 standard 会话
80
+ dsh --profile cli --mode code # 使用 Agent Preset 启动
81
+ dsh --profile cli --continue # 恢复当前目录最新会话
82
+ dsh --profile cli --resume abc123 # id 或唯一前缀恢复持久会话
83
+ dsh --profile cli --session my-id # 使用指定 id 新建会话
134
84
  ```
135
85
 
136
- Inside the TUI:
86
+ 进入 TUI 后:
137
87
 
138
- | Action | Purpose |
88
+ | 操作 | 用途 |
139
89
  | --- | --- |
140
- | `/new [preset]` | Create and enter another session without restarting the terminal |
141
- | `/resume [id\|prefix]` | Search roots or all conversations; filter by cwd, order, and density |
142
- | `/mode [preset]` | Inspect or select the blank session's Agent composition |
143
- | `/model` | Switch among models advertised by the live LLM registry |
144
- | `/plugin [query]` | Inspect loader entries, enabled state, module identity, and fiber phase |
145
- | `/permission <name>` | Change the permission preset; Shift+Tab cycles presets |
146
- | `/help` | Browse local commands, Harness commands, skills, and key bindings |
147
- | `Ctrl+O` | Open the exclusive history detail view; switch entries and scroll all content |
148
- | `Ctrl+R` | Fold or reveal model reasoning |
149
- | `@` | Mention workspace files or bounded snapshots of persisted sessions |
150
- | `Esc` / `Ctrl+C` | Close the topmost surface or interrupt the active turn |
90
+ | `/new [preset]` | 不重启终端,创建并进入另一个会话 |
91
+ | `/resume [id\|前缀]` | 搜索根会话或全部对话,并按 cwd、排序和密度筛选 |
92
+ | `/mode [preset]` | 检查或选择空会话的 Agent 组合 |
93
+ | `/model` | 在实时 LLM 注册表提供的模型间切换 |
94
+ | `/plugin [query]` | 检查 loader 条目、启用状态、模块身份和 fiber 阶段 |
95
+ | `/permission <name>` | 切换权限预设;Shift+Tab 可循环切换 |
96
+ | `/help` | 浏览本地命令、Harness 命令、技能和快捷键 |
97
+ | `Ctrl+O` | 打开独占历史详情视图,切换条目并滚动完整内容 |
98
+ | `Ctrl+R` | 折叠或展开模型思考过程 |
99
+ | `@` | 引用工作区文件或持久会话的有界快照 |
100
+ | `Esc` / `Ctrl+C` | 关闭最上层界面或中断当前 turn |
101
+
102
+ ## 四、功能
103
+
104
+ ### 1. Agent 与扩展
105
+
106
+ - 每会话 Agent Preset:组合工具、提示词、技能、上下文压缩、plan mode 与委派能力
107
+ - 从共享 Harness 注册表实时发现斜杠命令和用户技能
108
+ - 通过 `/plugin` 只读诊断 Cordis loader
109
+ - 从实时 LLM 注册表路由模型,并按持久会话恢复选择
110
+ - 支持 plan、goal、todo、权限、sandbox、subagent 与运行中 steering
111
+
112
+ ### 2. 会话与上下文
113
+
114
+ - `/new`、`/resume`、`--continue` 与显式 session id,且无需重新挂载 Ink
115
+ - Codex 风格可搜索恢复面板,支持根/全部对话、cwd、排序和密度筛选
116
+ - 裸启动延迟到首次真实输入才创建会话,未输入即退出零残留
117
+ - 全局输入历史:Up/Down 跨会话召回,`/history` 搜索面板回填输入框
118
+ - 标题快照按需折叠,完整转录仅在显式请求时加载并支持全量滚动
119
+ - subagent 对话只读检查,以及通过 `@` 注入有界会话引用
120
+ - Markdown 导出、持久标题、上下文占用、缓存、token、TTFT 与耗时指标
121
+
122
+ ### 3. 审批与交互
123
+
124
+ - sandbox 升级与 hook `ask` 决策的一次性工具审批条
125
+ - 结构化 `ask_user_question` 与 plan review 菜单,支持多选和自定义答案
126
+ - 在下一个 step 边界进行 turn steering,并提供明确的中断语义
127
+ - Agent mode、plan、权限 preset、goal 与 sandbox 状态相互独立
128
+
129
+ ### 4. 终端渲染
130
+
131
+ - 已落定历史只追加,流式可变区域严格有界
132
+ - 思考折叠、终端 Markdown、紧凑工具摘要与完整结构化详情
133
+ - 双行状态栏:mode 与 context 在第二行,context 为蓝色进度条,全蓝强调
134
+ - 运行中提交即时显示为普通提示词行,Delete 取消排队消息,busy 使用 web StateDot 八点追逐动画
135
+ - 回复与输入框光标对齐,欢迎头字标提亮
136
+ - Ctrl+O 独占历史检查,支持切换条目与完整纵向滚动
137
+ - CJK/控制字符宽度安全、短终端主动降级、缩放防抖重放
138
+ - 固定底部顺序:内容或面板 → notice → 输入框 → 状态栏
151
139
 
152
- ## Features
140
+ ## 五、DSH-Code 如何接入 DSH
153
141
 
154
- ### Agent and extensions
142
+ ### 1. 运行时组合
155
143
 
156
- - Per-session Agent Presets for tools, prompt sections, skills, compaction, plan mode, and delegation
157
- - Live slash-command and skill discovery from shared Harness registries
158
- - Read-only Cordis loader diagnostics through `/plugin`
159
- - Model routing through the live LLM registry, restored per persisted session
160
- - Plans, goals, todos, permissions, sandbox state, subagents, and runtime steering
144
+ DSH-Code 读取 Harness 的实时注册表,不在本地维护另一套副本。模型适配器、工具 provider、技能来源、命令、权限策略、持久化后端、sandbox subagent provider 都可以通过 DSH composition 添加或替换。
161
145
 
162
- ### Sessions and context
146
+ `/plugin` 提供当前 Cordis loader 状态的只读视图。
163
147
 
164
- - `/new`, `/resume`, `--continue`, and explicit session identifiers without remounting Ink
165
- - Codex-style searchable resume picker with root/conversation, cwd, order, and density filters
166
- - Lazy title snapshots and explicitly loaded, fully scrollable transcripts
167
- - Read-only subagent conversation inspection and bounded `@` session references
168
- - Markdown export, persistent titles, context occupancy, cache, token, TTFT, and timing metrics
148
+ ### 2. 会话级 Agent Preset
169
149
 
170
- ### Approvals and interaction
150
+ Host 持有共享基础设施——注册表、持久化、会话查询、权限和 sandbox 策略;每个会话则获得一个隔离的 Agent scope,并由 **Agent Preset** 进行组合:
171
151
 
172
- - One-shot tool approval bar for sandbox escalation and hook `ask` decisions
173
- - Structured `ask_user_question` and plan-review menus with multi-select and custom answers
174
- - Turn steering at the next step boundary plus explicit interruption semantics
175
- - Independent Agent mode, plan state, permission preset, goal, and sandbox indicators
152
+ - `standard`——功能完整的通用编码 Agent
153
+ - `code`——面向 Code Mode / PTC 的多操作工作流
154
+ - `minimal`——只保留持久 shell `str_replace_editor`
155
+ - `cordis`——完整 Agent,加上运行时检查与 Preset 编写指导
156
+ - 用户预设——自行定义工具、提示词段落、技能、上下文压缩、plan mode 与 subagent 行为
176
157
 
177
- ### Terminal rendering
158
+ 在第一次 turn 之前使用 `/mode`,或通过 `--mode <preset>` 直接启动。选中的 preset 会写入会话,并在恢复时还原。
178
159
 
179
- - Append-only settled transcript with bounded mutable streaming output
180
- - Folded thinking, terminal Markdown, compact tool summaries, and full structured details
181
- - Ctrl+O exclusive history inspection with entry navigation and complete vertical scrolling
182
- - Width-safe CJK/control-character handling, compact-terminal degradation, and debounced resize replay
183
- - Stable bottom order: content or panel → notice → composer → status
160
+ ### 3. 会话记录与恢复
184
161
 
185
- ## References
162
+ 提示词、流式 chunk、工具调用与结果、模型选择、plan 状态、权限、标题和 preset 选择都由持久 Session 事件投影得到。会话恢复、导出、历史检查、上下文统计和终端重放使用同一份记录。
186
163
 
187
- - Runtime services, events, plugin scopes, and persistence follow **DeepSeek Harness**.
188
- - Session navigation, popup sizing, scrollback, bottom-pane layout, and resize behavior refer to **Codex CLI**.
189
- - Slash discovery, turn steering, thinking folds, approvals, and question flows refer to **Claude Code**.
164
+ React state 只保存输入草稿、光标、当前面板、选中项和滚动位置等临时界面状态。
190
165
 
191
- DSH-Code remains an independent MIT-licensed community project and is not affiliated with OpenAI or Anthropic.
166
+ ```text
167
+ dsh profile
168
+ └─ Host plane:注册表 · 持久化 · 查询 · 权限 · sandbox
169
+ ├─ Agent 会话 A + preset code
170
+ ├─ Agent 会话 B + preset minimal
171
+ └─ DSH-Code TUI
172
+ 持久事件 → 纯投影 → 只追加的历史转录
173
+ └→ 有界面板 → 输入框 → 状态栏
174
+ ```
192
175
 
193
- ## Develop
176
+ ## 六、开发
194
177
 
195
178
  ```sh
196
179
  pnpm install
197
180
  pnpm test
198
181
  pnpm typecheck
199
182
  pnpm build
200
- pnpm run gen:whale # regenerate src/whale-glyph.ts from the vendored logo path
183
+ pnpm run gen:whale # vendored Logo 路径重新生成 src/whale-glyph.ts
184
+ ```
185
+
186
+ 鲸鱼字形由 `scripts/fish-logo.ts` 中 vendored 的 DeepSeek FishLogo 几何数据生成(来源:DeepSeek Harness,MIT)。
187
+
188
+ ### 1. 源码开发安装
189
+
190
+ 本地 checkout 可使用:
191
+
192
+ ```sh
193
+ dsh plugin --profile cli add file:C:/path/to/dsh-code
194
+ ```
195
+
196
+ GitHub 安装可用于源码开发:
197
+
198
+ ```sh
199
+ dsh plugin --profile cli add github:unlinearity/dsh-code
201
200
  ```
202
201
 
203
- The whale glyph is generated from the DeepSeek FishLogo geometry vendored in `scripts/fish-logo.ts` (source: DeepSeek Harness, MIT).
202
+ Git 包会在安装阶段构建。若 pnpm 要求添加 `allowBuilds`,请把它输出的完整条目复制到 `~/.dsh/profiles/cli/pnpm-workspace.yaml`,再重新执行命令。该键包含 Git URL commit,不能只写 `dsh-code`。
203
+
204
+ ### 2. 参考
205
+
206
+ - 运行时服务、事件、插件作用域和持久化模型遵循 **DeepSeek Harness**。
207
+ - 会话导航、浮层尺寸、scrollback、底部布局与缩放处理参考 **Codex CLI**。
208
+ - 斜杠发现、turn steering、思考折叠、审批和提问流程参考 **Claude Code**。
209
+
210
+ DSH-Code 是独立的 MIT 社区项目,与 OpenAI 或 Anthropic 无隶属关系。
211
+
212
+ 社区:
213
+ - [Linux DO](https://linux.do/):学 AI,上 L 站!
214
+ - [Deepseek harness](https://www.deepseek.com/harness): DSH 官方网站
204
215
 
205
- ## License
216
+ ## 许可
206
217
 
207
- [MIT](LICENSE). The vendored FishLogo geometry is from DeepSeek Harness (MIT).
218
+ [MIT](LICENSE)vendored FishLogo 几何数据来自 DeepSeek HarnessMIT)。
package/bin/deepseek.mjs CHANGED
@@ -1,8 +1,9 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  import { spawn } from 'node:child_process'
4
- import { existsSync, realpathSync } from 'node:fs'
4
+ import { existsSync, readFileSync, realpathSync } from 'node:fs'
5
5
  import { createRequire } from 'node:module'
6
+ import { homedir } from 'node:os'
6
7
  import { join, resolve } from 'node:path'
7
8
  import { fileURLToPath, pathToFileURL } from 'node:url'
8
9
 
@@ -11,6 +12,30 @@ const packageRequire = createRequire(import.meta.url)
11
12
  /** Arguments required to boot DSH-Code's conventional profile. */
12
13
  export const profileArgs = (args = []) => ['--profile', 'cli', ...args]
13
14
 
15
+ /** The conventional cli profile directory under the DSH home. */
16
+ export function cliProfileDir(home = homedir()) {
17
+ return join(home, '.dsh', 'profiles', 'cli')
18
+ }
19
+
20
+ /**
21
+ * Whether the cli profile already mounts dsh-code. A bare profile composes
22
+ * dsh-base alone and keeps the process alive with no TUI runner — the alias
23
+ * must fail loudly with the missing step instead of hanging.
24
+ */
25
+ export function profileHasDshCode(profileDir = cliProfileDir(), fileExists = existsSync, readFile = readFileSync) {
26
+ const manifest = join(profileDir, 'package.json')
27
+ if (!fileExists(manifest)) return false
28
+ try {
29
+ const raw = JSON.parse(readFile(manifest, 'utf8'))
30
+ const bundles = raw?.dsh?.profile?.bundles
31
+ const dependencies = raw?.dependencies
32
+ return (Array.isArray(bundles) && bundles.includes('dsh-code'))
33
+ || (typeof dependencies === 'object' && dependencies !== null && 'dsh-code' in dependencies)
34
+ } catch {
35
+ return false
36
+ }
37
+ }
38
+
14
39
  /** Npm global-prefix roots that may contain DSH when this launcher is globally linked to a checkout. */
15
40
  export function globalDshRoots() {
16
41
  return [...new Set([
@@ -43,10 +68,20 @@ export function dshCommand(args, {
43
68
  }
44
69
 
45
70
  /** Launch the installed DSH CLI while preserving its exit status and stdio. */
46
- export function launchDsh(args = process.argv.slice(2), spawnProcess = spawn, resolveCommand = dshCommand) {
71
+ export function launchDsh(
72
+ args = process.argv.slice(2),
73
+ spawnProcess = spawn,
74
+ resolveCommand = dshCommand,
75
+ isProfileReady = profileHasDshCode,
76
+ ) {
77
+ if (!isProfileReady()) {
78
+ console.error('dsh-code: the cli profile does not mount dsh-code yet. Run: dsh plugin --profile cli add dsh-code')
79
+ process.exitCode = 1
80
+ return undefined
81
+ }
47
82
  const command = resolveCommand(args)
48
83
  if (command === undefined) {
49
- console.error('dsh-code: @deepseek-ai/dsh must be installed globally beside dsh-code; run: npm install -g @deepseek-ai/dsh@next dsh-code')
84
+ console.error('dsh-code: @deepseek-ai/dsh must be installed globally beside dsh-code; run: npm install -g @deepseek-ai/dsh dsh-code')
50
85
  process.exitCode = 1
51
86
  return undefined
52
87
  }