@jingyi0605/codingns4dsh 0.1.0 → 0.1.2

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.
Files changed (213) hide show
  1. package/README.en.md +306 -0
  2. package/README.md +190 -993
  3. package/data/build/dist/client/account-bar.d.ts +2 -2
  4. package/data/build/dist/client/account-bar.js +96 -39
  5. package/data/build/dist/client/bundle.js +13722 -3611
  6. package/data/build/dist/client/cli-catalog.js +20 -3
  7. package/data/build/dist/client/cli-slots.d.ts +5 -0
  8. package/data/build/dist/client/cli-slots.js +57 -7
  9. package/data/build/dist/client/debug/ui.d.ts +1 -1
  10. package/data/build/dist/client/debug/ui.js +62 -32
  11. package/data/build/dist/client/dsh-runtime-version.d.ts +9 -2
  12. package/data/build/dist/client/dsh-runtime-version.js +24 -2
  13. package/data/build/dist/client/features/cli-adapters.d.ts +1 -1
  14. package/data/build/dist/client/features/cli-adapters.js +19 -16
  15. package/data/build/dist/client/features/debug.js +2 -2
  16. package/data/build/dist/client/features/index.d.ts +2 -1
  17. package/data/build/dist/client/features/index.js +3 -1
  18. package/data/build/dist/client/features/lan-access-panel.d.ts +1 -1
  19. package/data/build/dist/client/features/lan-access-panel.js +8 -10
  20. package/data/build/dist/client/features/lan-access.js +1 -1
  21. package/data/build/dist/client/features/login-protection-panel.d.ts +1 -1
  22. package/data/build/dist/client/features/login-protection-panel.js +7 -9
  23. package/data/build/dist/client/features/reverse-proxy-panel.d.ts +1 -1
  24. package/data/build/dist/client/features/reverse-proxy-panel.js +99 -11
  25. package/data/build/dist/client/features/reverse-proxy.d.ts +1 -1
  26. package/data/build/dist/client/features/reverse-proxy.js +19 -18
  27. package/data/build/dist/client/features/terminal-enhancement-panel.d.ts +1 -1
  28. package/data/build/dist/client/features/terminal-enhancement-panel.js +62 -55
  29. package/data/build/dist/client/features/terminal-enhancement.d.ts +1 -1
  30. package/data/build/dist/client/features/terminal-enhancement.js +3 -3
  31. package/data/build/dist/client/features/types.d.ts +14 -3
  32. package/data/build/dist/client/features/workspace-session-enhancement-panel.d.ts +1 -1
  33. package/data/build/dist/client/features/workspace-session-enhancement-panel.js +31 -9
  34. package/data/build/dist/client/features/workspace-session-enhancement.js +72 -11
  35. package/data/build/dist/client/git-management.d.ts +16 -0
  36. package/data/build/dist/client/git-management.js +757 -0
  37. package/data/build/dist/client/index.d.ts +3 -2
  38. package/data/build/dist/client/index.js +152 -27
  39. package/data/build/dist/client/locale.js +91 -29
  40. package/data/build/dist/client/quick-phrase-layout.d.ts +49 -0
  41. package/data/build/dist/client/quick-phrase-layout.js +95 -0
  42. package/data/build/dist/client/quick-phrase-slot.d.ts +7 -0
  43. package/data/build/dist/client/quick-phrase-slot.js +370 -0
  44. package/data/build/dist/client/remote-web-context.js +1 -1
  45. package/data/build/dist/client/settings-bridge.d.ts +9 -6
  46. package/data/build/dist/client/settings-bridge.js +51 -27
  47. package/data/build/dist/client/settings-section.d.ts +3 -2
  48. package/data/build/dist/client/settings-section.js +33 -19
  49. package/data/build/dist/client/subscription-slot.d.ts +3 -0
  50. package/data/build/dist/client/subscription-slot.js +108 -16
  51. package/data/build/dist/client/terminal/model.d.ts +14 -2
  52. package/data/build/dist/client/terminal/model.js +109 -21
  53. package/data/build/dist/client/terminal/recovery.d.ts +50 -0
  54. package/data/build/dist/client/terminal/recovery.js +101 -0
  55. package/data/build/dist/client/terminal/ui.d.ts +2 -2
  56. package/data/build/dist/client/terminal/ui.js +49 -11
  57. package/data/build/dist/client/terminal/xterm-view.d.ts +2 -2
  58. package/data/build/dist/client/terminal/xterm-view.js +2 -1
  59. package/data/build/dist/client/theme.d.ts +6 -1
  60. package/data/build/dist/client/theme.js +32 -1
  61. package/data/build/dist/client/workspace-session-archive-dom.d.ts +12 -0
  62. package/data/build/dist/client/workspace-session-archive-dom.js +27 -5
  63. package/data/build/dist/client/workspace-session-visibility-dom.d.ts +30 -0
  64. package/data/build/dist/client/workspace-session-visibility-dom.js +604 -0
  65. package/data/build/dist/dsh-capabilities/client/config-forms-adapter.d.ts +50 -0
  66. package/data/build/dist/dsh-capabilities/client/config-forms-adapter.js +139 -0
  67. package/data/build/dist/dsh-capabilities/client/conversation-adapter.d.ts +7 -0
  68. package/data/build/dist/dsh-capabilities/client/conversation-adapter.js +6 -0
  69. package/data/build/dist/dsh-capabilities/client/locale-adapter.d.ts +9 -0
  70. package/data/build/dist/dsh-capabilities/client/locale-adapter.js +4 -0
  71. package/data/build/dist/dsh-capabilities/client/primitives-adapter.d.ts +10 -0
  72. package/data/build/dist/dsh-capabilities/client/primitives-adapter.js +14 -0
  73. package/data/build/dist/dsh-capabilities/client/settings-scope-adapter.d.ts +8 -0
  74. package/data/build/dist/dsh-capabilities/client/settings-scope-adapter.js +16 -0
  75. package/data/build/dist/dsh-capabilities/client/sidebar-adapter.d.ts +7 -0
  76. package/data/build/dist/dsh-capabilities/client/sidebar-adapter.js +5 -0
  77. package/data/build/dist/dsh-capabilities/client/theme-adapter.d.ts +6 -0
  78. package/data/build/dist/dsh-capabilities/client/theme-adapter.js +4 -0
  79. package/data/build/dist/dsh-capabilities/client/typert-adapter.d.ts +5 -0
  80. package/data/build/dist/dsh-capabilities/client/typert-adapter.js +4 -0
  81. package/data/build/dist/dsh-capabilities/host/config-forms-adapter.d.ts +19 -0
  82. package/data/build/dist/dsh-capabilities/host/config-forms-adapter.js +45 -0
  83. package/data/build/dist/dsh-capabilities/host/connection-rpc-adapter.d.ts +19 -0
  84. package/data/build/dist/dsh-capabilities/host/connection-rpc-adapter.js +13 -0
  85. package/data/build/dist/dsh-capabilities/host/settings-scope-adapter.d.ts +8 -0
  86. package/data/build/dist/dsh-capabilities/host/settings-scope-adapter.js +47 -0
  87. package/data/build/dist/dsh-capabilities/host/typert-adapter.d.ts +6 -0
  88. package/data/build/dist/dsh-capabilities/host/typert-adapter.js +4 -0
  89. package/data/build/dist/dsh-capabilities/index.d.ts +6 -0
  90. package/data/build/dist/dsh-capabilities/index.js +6 -0
  91. package/data/build/dist/dsh-capabilities/matrix.d.ts +15 -0
  92. package/data/build/dist/dsh-capabilities/matrix.js +32 -0
  93. package/data/build/dist/dsh-capabilities/registry.d.ts +22 -0
  94. package/data/build/dist/dsh-capabilities/registry.js +196 -0
  95. package/data/build/dist/dsh-capabilities/routes.d.ts +10 -0
  96. package/data/build/dist/dsh-capabilities/routes.js +34 -0
  97. package/data/build/dist/dsh-capabilities/settings-store.d.ts +29 -0
  98. package/data/build/dist/dsh-capabilities/settings-store.js +5 -0
  99. package/data/build/dist/dsh-capabilities/types.d.ts +50 -0
  100. package/data/build/dist/dsh-capabilities/types.js +23 -0
  101. package/data/build/dist/features/registry.d.ts +8 -2
  102. package/data/build/dist/features/registry.js +104 -1
  103. package/data/build/dist/host/auth-session.d.ts +8 -1
  104. package/data/build/dist/host/auth-session.js +28 -6
  105. package/data/build/dist/host/cli-adapters/claude-driver.d.ts +2 -0
  106. package/data/build/dist/host/cli-adapters/claude-driver.js +19 -4
  107. package/data/build/dist/host/cli-adapters/claude-model-options.d.ts +14 -0
  108. package/data/build/dist/host/cli-adapters/claude-model-options.js +157 -0
  109. package/data/build/dist/host/cli-adapters/codex-driver.d.ts +11 -0
  110. package/data/build/dist/host/cli-adapters/codex-driver.js +166 -14
  111. package/data/build/dist/host/cli-adapters/driver.d.ts +2 -0
  112. package/data/build/dist/host/cli-adapters/dsh-message-projector.d.ts +15 -0
  113. package/data/build/dist/host/cli-adapters/dsh-message-projector.js +120 -29
  114. package/data/build/dist/host/cli-adapters/dsh-tool-history.d.ts +4 -1
  115. package/data/build/dist/host/cli-adapters/dsh-tool-history.js +25 -7
  116. package/data/build/dist/host/cli-adapters/feature.js +74 -8
  117. package/data/build/dist/host/cli-adapters/gemini-driver.js +2 -2
  118. package/data/build/dist/host/cli-adapters/grok-driver.js +2 -2
  119. package/data/build/dist/host/cli-adapters/json-rpc-process.d.ts +4 -2
  120. package/data/build/dist/host/cli-adapters/json-rpc-process.js +8 -9
  121. package/data/build/dist/host/cli-adapters/kimi-driver.js +1 -1
  122. package/data/build/dist/host/cli-adapters/legacy-session-adapter.d.ts +17 -0
  123. package/data/build/dist/host/cli-adapters/legacy-session-adapter.js +88 -0
  124. package/data/build/dist/host/cli-adapters/legacy-session-settings.d.ts +24 -0
  125. package/data/build/dist/host/cli-adapters/legacy-session-settings.js +162 -0
  126. package/data/build/dist/host/cli-adapters/official-provider-subscription.d.ts +29 -0
  127. package/data/build/dist/host/cli-adapters/official-provider-subscription.js +361 -0
  128. package/data/build/dist/host/cli-adapters/opencode-driver.d.ts +2 -0
  129. package/data/build/dist/host/cli-adapters/opencode-driver.js +97 -12
  130. package/data/build/dist/host/cli-adapters/pi-driver.js +69 -23
  131. package/data/build/dist/host/cli-adapters/provider-registry.d.ts +33 -0
  132. package/data/build/dist/host/cli-adapters/provider-registry.js +83 -0
  133. package/data/build/dist/host/cli-adapters/provider-subscription.d.ts +25 -3
  134. package/data/build/dist/host/cli-adapters/provider-subscription.js +346 -30
  135. package/data/build/dist/host/cli-adapters/registry.d.ts +6 -0
  136. package/data/build/dist/host/cli-adapters/registry.js +170 -13
  137. package/data/build/dist/host/cli-adapters/rpc-driver-utils.js +10 -0
  138. package/data/build/dist/host/cli-adapters/session-store.d.ts +7 -0
  139. package/data/build/dist/host/cli-adapters/session-store.js +39 -1
  140. package/data/build/dist/host/cli-adapters/standard-stream-driver.d.ts +3 -0
  141. package/data/build/dist/host/cli-adapters/stream-normalizer.d.ts +3 -0
  142. package/data/build/dist/host/cli-adapters/stream-normalizer.js +22 -2
  143. package/data/build/dist/host/control-api-client.d.ts +3 -3
  144. package/data/build/dist/host/control-api-client.js +2 -1
  145. package/data/build/dist/host/credential-store.js +11 -1
  146. package/data/build/dist/host/dsh-device-runtime.d.ts +4 -0
  147. package/data/build/dist/host/dsh-device-runtime.js +20 -9
  148. package/data/build/dist/host/features/auth.js +8 -5
  149. package/data/build/dist/host/features/debug.js +1 -1
  150. package/data/build/dist/host/features/git-management.d.ts +5 -0
  151. package/data/build/dist/host/features/git-management.js +290 -0
  152. package/data/build/dist/host/features/host-status.js +1 -1
  153. package/data/build/dist/host/features/index.d.ts +1 -0
  154. package/data/build/dist/host/features/index.js +3 -0
  155. package/data/build/dist/host/features/terminal-process.js +1 -1
  156. package/data/build/dist/host/features/terminal-status.d.ts +3 -1
  157. package/data/build/dist/host/features/terminal-status.js +3 -1
  158. package/data/build/dist/host/index.d.ts +7 -3
  159. package/data/build/dist/host/index.js +76 -11
  160. package/data/build/dist/host/lan-access-dsh.js +18 -5
  161. package/data/build/dist/host/native-session-bridge.d.ts +23 -1
  162. package/data/build/dist/host/native-session-bridge.js +157 -10
  163. package/data/build/dist/host/rpc-table.d.ts +1 -1
  164. package/data/build/dist/host/rpc.js +60 -10
  165. package/data/build/dist/host/session-migration-repair.d.ts +19 -0
  166. package/data/build/dist/host/session-migration-repair.js +395 -0
  167. package/data/build/dist/host/settings.d.ts +8 -1
  168. package/data/build/dist/host/settings.js +94 -3
  169. package/data/build/dist/host/terminal/backends/tmux-backend.d.ts +1 -0
  170. package/data/build/dist/host/terminal/backends/tmux-backend.js +4 -2
  171. package/data/build/dist/host/terminal/controller-factory.d.ts +4 -0
  172. package/data/build/dist/host/terminal/controller-factory.js +26 -7
  173. package/data/build/dist/host/terminal/runtime-manager.d.ts +2 -1
  174. package/data/build/dist/host/terminal/runtime-manager.js +3 -0
  175. package/data/build/dist/host/terminal/startup.d.ts +2 -0
  176. package/data/build/dist/host/terminal/startup.js +2 -1
  177. package/data/build/dist/host/terminal/terminal-controller.d.ts +10 -3
  178. package/data/build/dist/host/terminal/terminal-controller.js +101 -15
  179. package/data/build/dist/host/terminal/terminal-process-service.js +3 -1
  180. package/data/build/dist/host/terminal/terminal-service.d.ts +2 -0
  181. package/data/build/dist/host/terminal/terminal-service.js +10 -0
  182. package/data/build/dist/index.d.ts +6 -2
  183. package/data/build/dist/index.js +8 -2
  184. package/data/build/dist/shared/contracts/cli-adapter.d.ts +14 -0
  185. package/data/build/dist/shared/contracts/config.d.ts +31 -1
  186. package/data/build/dist/shared/contracts/config.js +25 -0
  187. package/data/build/dist/shared/contracts/dsh-device.d.ts +13 -1
  188. package/data/build/dist/shared/contracts/errors.d.ts +1 -1
  189. package/data/build/dist/shared/contracts/feature.d.ts +6 -0
  190. package/data/build/dist/shared/contracts/git.d.ts +82 -0
  191. package/data/build/dist/shared/contracts/git.js +3 -0
  192. package/data/build/dist/shared/contracts/subscription.d.ts +46 -0
  193. package/data/build/dist/shared/contracts/terminal.d.ts +4 -1
  194. package/data/build/dist/shared/contracts/version.d.ts +2 -2
  195. package/data/build/dist/shared/contracts/version.js +4 -6
  196. package/data/build/dist/shared/debug.d.ts +14 -0
  197. package/data/build/dist/shared/debug.js +53 -0
  198. package/data/build/dist/shared/index.d.ts +7 -4
  199. package/data/build/dist/shared/index.js +2 -1
  200. package/data/build/dist/transport/debug.d.ts +1 -1
  201. package/data/build/dist/transport/debug.js +3 -30
  202. package/data/build/dist/transport/dsh-session.js +3 -3
  203. package/data/build/dist/typert.host.js +4 -2
  204. package/data/build/dist/typert.remote-client.d.ts +11 -0
  205. package/data/build/dist/typert.remote-client.js +7 -0
  206. package/dsh.bundle.patch +1 -1
  207. package/package.json +17 -5
  208. package/profile/README.md +4 -4
  209. package/profile/package.json +6 -4
  210. package/profile/scripts/check-dsh-install.mjs +2 -2
  211. package/profile/version.json +2 -2
  212. package/scripts/check-dsh-install.mjs +2 -2
  213. package/version.json +2 -2
package/README.md CHANGED
@@ -1,1114 +1,311 @@
1
1
  <div align="center">
2
2
 
3
- # Codingns4DSH for DeepSeek Harness
3
+ # CodingNS for DeepSeek Harness
4
4
 
5
- **Use your existing Agent CLIs, persistent terminals, workspace debugging, and remote access — inside DSH's own interface.**
5
+ **把外部 Agent CLI、持久终端、工作区调试和远程访问,装进 DSH 原生界面。**
6
6
 
7
7
  [![npm version](https://img.shields.io/npm/v/%40jingyi0605%2Fcodingns4dsh?logo=npm)](https://www.npmjs.com/package/@jingyi0605/codingns4dsh)
8
- [![DSH compatibility](https://img.shields.io/badge/DSH-%3E%3D0.1.5--rc.3%20%3C0.1.7-0-4D6BFE)](https://github.com/deepseek-ai/deepseek-harness)
8
+ [![DSH compatibility](https://img.shields.io/badge/DSH-%3E%3D0.1.5--rc.3%20%3C%3D0.1.7--rc.2-4D6BFE)](https://github.com/deepseek-ai/deepseek-harness)
9
9
  [![Node.js](https://img.shields.io/badge/Node.js-%3E%3D22.19-3C873A?logo=node.js&logoColor=white)](https://nodejs.org)
10
10
 
11
- **Current release: `0.1.0`** · **DSH: `>=0.1.5-rc.3 <0.1.7-0`** (validated on `0.1.6-alpha.2`)
11
+ **简体中文** · [English](README.en.md)
12
12
 
13
- **Reach your own DSH Web UI from anywhere on the internet.** Beyond [LAN access](#lan-access-to-dsh), the [relay access service](#relay-access-service) carries the same DSH Web session to any device on any network — no public IP, no port forwarding, no VPN.
13
+ **当前版本 `@jingyi0605/codingns4dsh@0.1.2`** · DSH **`>=0.1.5-rc.3 <=0.1.7-rc.2`**(已验证 `0.1.5-rc.3`、`0.1.6-alpha.2`、`0.1.7-rc.2`)· Node **`>= 22.19`** · macOS / Linux / Windows
14
14
 
15
- **End-to-end encrypted.** The relay moves WebRTC/DTLS ciphertext, so the relay service sees connection metadata only — never your DSH conversations, terminal output or files. See [End-to-end encryption](#end-to-end-encryption-why-the-relay-cannot-read-your-dsh-traffic).
16
-
17
- **Repository: [jingyi0605/Codingns4DSH](https://github.com/jingyi0605/Codingns4DSH)** · **npm: [`@jingyi0605/codingns4dsh`](https://www.npmjs.com/package/@jingyi0605/codingns4dsh)** · **npm publisher: [`jingyi0605`](https://www.npmjs.com/~jingyi0605)**
18
-
19
- **QQ discussion group: 1092985965**
15
+ **[GitHub](https://github.com/jingyi0605/Codingns4DSH)** · **[npm](https://www.npmjs.com/package/@jingyi0605/codingns4dsh)** · **QQ 群 1092985965**
20
16
 
21
17
  <p>
22
- <a href="#what-is-codingns">What is Codingns4DSH</a> ·
23
- <a href="#how-it-works">How it works</a> ·
24
- <a href="#feature-overview">Features</a> ·
25
- <a href="#supported-external-agents">Supported Agents</a> ·
26
- <a href="#installation">Installation</a> ·
27
- <a href="#first-run">First run</a> ·
28
- <a href="#remote-access">Remote access</a> ·
29
- <a href="#troubleshooting">Troubleshooting</a> ·
30
- <a href="#roadmap">Roadmap</a> ·
31
- <a href="#development">Development</a> ·
32
- <a href="#community">Community</a> ·
33
- <a href="#acknowledgements">Acknowledgements</a> ·
34
- <a href="#中文说明">简体中文</a>
18
+ <a href="#界面预览">界面预览</a> ·
19
+ <a href="#这是什么">这是什么</a> ·
20
+ <a href="#支持的外部-agent">外部 Agent</a> ·
21
+ <a href="#功能详解">功能详解</a> ·
22
+ <a href="#安装">安装</a> ·
23
+ <a href="#首次使用">首次使用</a> ·
24
+ <a href="#故障排查">故障排查</a> ·
25
+ <a href="#开发">开发</a> ·
26
+ <a href="#鸣谢">鸣谢</a>
35
27
  </p>
36
28
 
37
29
  </div>
38
30
 
39
- ---
40
-
41
- ## Acknowledgements
42
-
43
- Codingns4DSH's inspiration — and part of its implementation approach — comes from **[CodexHost](https://github.com/BytePioneer-AI/codex-host)**.
44
-
45
- CodexHost runs Pi, Claude Code, Grok Build and other Agent Harnesses natively inside Codex Desktop. It showed the direction Codingns4DSH follows from the other side: a host application should host *other* Harnesses as first-class Agents instead of replacing them. The multi-Harness adapter model, projecting a CLI's event stream into the host's own native sessions, and keeping each Agent's sessions in the host's sidebar and composer all trace back to that project's design.
46
-
47
- Thanks to the CodexHost authors and community. Codingns4DSH is an independent project and is not affiliated with CodexHost.
48
-
49
- ---
50
-
51
- ## Table of contents
52
-
53
- - [Acknowledgements](#acknowledgements)
54
- - [What is Codingns4DSH?](#what-is-codingns)
55
- - [How it works](#how-it-works)
56
- - [Feature overview](#feature-overview)
57
- - [Features in detail](#features-in-detail)
58
- - [External Agent integration](#external-agent-integration)
59
- - [Workspace session enhancement](#workspace-session-enhancement)
60
- - [Terminal](#terminal)
61
- - [LAN access to DSH](#lan-access-to-dsh)
62
- - [Relay access service](#relay-access-service)
63
- - [Workspace debug](#workspace-debug)
64
- - [Supported external Agents](#supported-external-agents)
65
- - [Installation](#installation)
66
- - [First run](#first-run)
67
- - [Remote access](#remote-access)
68
- - [Settings reference](#settings-reference)
69
- - [Troubleshooting](#troubleshooting)
70
- - [Roadmap](#roadmap)
71
- - [Development](#development)
72
- - [Community](#community)
73
- - [中文说明](#中文说明)
74
-
75
- ---
76
-
77
- ## What is Codingns4DSH?
78
-
79
- **DeepSeek Harness (DSH)** is DeepSeek's coding-agent harness: a CLI plus a Web application that runs an agent loop inside your project workspace — sessions, tools, permissions, settings, and the browser UI.
80
-
81
- DSH is designed to be extended. A **profile** is a named stack of plugin **bundles**, and a bundle may contribute both a **Host layer** (Node/Cordis plugins running in the DSH process) and a **browser layer** (UI modules injected into the DSH Web interface).
82
-
83
- **Codingns4DSH is such a bundle.** Installing it into a profile adds:
84
-
85
- - **Your existing Agent CLIs as first-class Agents** — Claude Code, Codex, Kimi CLI, Gemini CLI, Pi Agent, OpenCode, Grok Build and Command Code appear in the DSH composer, and their streaming output, tool calls, permission prompts, questions, usage and thinking levels are rendered by DSH's native conversation UI.
86
- - **A terminal that survives restarts** — sidebar terminals bound to a workspace or a session, restored after DSH restarts, with shell, theme, font, cursor and scrollback settings.
87
- - **A workspace debug panel** — save launch profiles per workspace, start them in a terminal, watch configured ports, stop instances and open proxied services.
88
- - **Remote access** — expose the local DSH Web UI to your LAN, or reach it through the Codingns4DSH relay when the Host is not directly reachable.
89
-
90
- Nothing in DSH is replaced: conversations, the session list, the sidebar, settings and permission prompts stay native. Codingns4DSH registers modules and UI slots into them.
91
-
92
- ### Who is this for?
93
-
94
- - You already run DSH and want to drive your existing Agent CLI subscriptions from one interface instead of switching between terminals.
95
- - You keep several shells open per project and want them back after a DSH restart.
96
- - You want to open the same DSH from a phone, tablet or another computer — on the same network, or through a relay.
97
- - You want a per-workspace "start service → check port → open it" loop without leaving DSH.
31
+ ## 界面预览
98
32
 
99
- ### At a glance
100
-
101
- | | |
102
- | --- | --- |
103
- | Package | `@jingyi0605/codingns4dsh` (DSH bundle: Host + browser layers) |
104
- | Plugin version | `0.1.0` (independent from the DSH version) |
105
- | DSH compatibility | `>=0.1.5-rc.3 <0.1.7-0`, validated on `0.1.6-alpha.2` |
106
- | Node.js | `>= 22.19` |
107
- | Platforms | macOS, Linux, Windows |
108
- | Toolchain | `dsh` CLI; `pnpm` for plugin installation |
109
- | Modules | 6 — see [Feature overview](#feature-overview) |
110
- | External Agents | 8 adapters — see [Supported external Agents](#supported-external-agents) |
111
- | Network behavior | Agent traffic goes to each Agent CLI's own provider. Codingns4DSH contacts Codingns4DSH servers only when you enable and log in to the relay service. |
112
-
113
- ---
114
-
115
- ## How it works
116
-
117
- ```
118
- ┌─ your machine (the "Host") ─────────────────────────────────────────┐
119
- │ DSH process (Node.js, profile: codingns) │
120
- │ ├─ @deepseek-ai/dsh-web-app serves the browser UI │
121
- │ └─ codingns4dsh (this bundle) │
122
- │ ├─ Host layer Agent adapters, terminal controller, │
123
- │ │ LAN listener, relay tunnel, debug service │
124
- │ └─ Browser layer Agent picker, sidebar terminal, settings │
125
- │ cards, session logos, debug panel │
126
- │ │
127
- │ Agent CLIs (claude / codex / kimi / gemini / …) run as child │
128
- │ processes of DSH and keep using their own credentials. │
129
- └─────────────────────────────────────────────────────────────────────┘
130
- ▲
131
- │ browser: http://127.0.0.1:<dsh-port> (local)
132
- │ http://<lan-ip>:<listen-port> (LAN access module)
133
- │ relay tunnel (relay module: from anywhere on
134
- │ the internet, no public IP)
135
- ```
136
-
137
- Key consequences of this design:
138
-
139
- - **The browser is only a view.** Every Agent process, terminal session and workspace file lives on the Host. Closing the browser does not stop them.
140
- - **External Agents stay external.** Codingns4DSH launches the CLI you already installed and authenticated, and projects its events into DSH sessions. Model requests go to that CLI's provider, not through Codingns4DSH.
141
- - **Remote paths are opt-in.** LAN access forwards TCP from a listener to the local DSH Web port and never leaves your network. The relay service is the path that reaches the same DSH Web from anywhere on the internet, it is used only after you enable the module and log in, and its traffic is end-to-end encrypted (WebRTC/DTLS) so the relay carries ciphertext rather than readable DSH content.
142
-
143
- ---
144
-
145
- ## Feature overview
146
-
147
- All modules appear as cards under **Settings → Codingns4DSH** (`设置 → Codingns4DSH`). "Activation" tells you whether a change applies immediately or after restarting DSH.
148
-
149
- | Module (settings card) | What you get | Where you use it | Runs on | Default | Activation |
150
- | --- | --- | --- | --- | :---: | :---: |
151
- | **External Agent integration**<br>`外部Agent集成` | Detect installed Agent CLIs, show version / command / available models, enable each Agent independently, and run them as native DSH streaming sessions | Composer Agent picker, **Settings → Codingns4DSH** | Host + browser | **On** | live |
152
- | **Workspace session enhancement**<br>`工作区会话增强` | Agent logo on each session row, archived-session entry per workspace, subscription/usage readout under the composer | DSH session sidebar | Browser | **Off**<br>(needs External Agent integration) | live |
153
- | **Terminal enhancement**<br>`终端强化` | Persistent terminal backend plus terminal appearance (default shell, theme, colors, font, cursor, scrollback) | **Settings → Codingns4DSH**, right sidebar Terminal | Browser + Host | **Off** | **restart** |
154
- | **LAN access to DSH**<br>`局域网访问DSH` | A listener that forwards a LAN address to the current local DSH Web port; also installs the `crypto.randomUUID` shim that plain-HTTP LAN origins need | **Settings → Codingns4DSH** | Browser + Host | **Always on** (no switch) | live |
155
- | **Relay access service**<br>`中转访问服务` | Access your DSH Web **from anywhere on the internet**, not only from the LAN: Codingns4DSH account login, DSH device list, Host binding and an isolated DSH–Codingns4DSH relay tunnel — no public IP, no port forwarding, no VPN, and **end-to-end encrypted (WebRTC/DTLS)** | **Settings → Codingns4DSH** | Browser + Host | **Off** | live |
156
- | **Workspace debug**<br>`工作区调试` | Per-workspace launch profiles, start/stop, live port checks and an HTTP service proxy | Right sidebar **调试** tab | Browser + Host | **On** | live |
157
-
158
- Notes:
33
+ <div align="center">
34
+ <img width="100%" src="assets/screenshots/workspace-overview.jpg" alt="工作台与右侧 Git 面板">
35
+ </div>
159
36
 
160
- - The right-sidebar terminal exists as soon as the plugin is installed. **Terminal enhancement** switches it from a basic local PTY to the persistent backend (tmux on macOS/Linux, ConPTY broker on Windows) and unlocks appearance settings.
161
- - Restart-required modules save your intent, show the currently effective state, and apply on the next DSH start. Turning **Terminal enhancement** off does not terminate existing tmux/ConPTY sessions.
162
- - The **Workspace debug** card is the one module that currently renders Chinese text only.
37
+ CodingNS 工作台把会话、Agent 选择器与右侧 Git 面板放在同一界面中。
163
38
 
164
39
  ---
165
40
 
166
- ## Features in detail
167
-
168
- ### External Agent integration
41
+ ## 这是什么
169
42
 
170
- Codingns4DSH detects Agent CLIs on the **Host machine** by looking them up on `PATH`, then reads their version, command path and model catalog from the CLI itself. Each Agent can be enabled or disabled independently; detected Agents are enabled by default. The built-in **DeepSeek Harness** Agent always appears first in the picker.
43
+ **DSH(DeepSeek Harness)** 是一个编码 Agent 运行框架,由 CLI 和 Web 界面组成,在你的 Workspace 中运行 Agent 循环。
171
44
 
172
- When you select an Agent and a model in the composer, Codingns4DSH starts (or resumes) that CLI as a child process of DSH and projects its event stream into a **native DSH session**:
45
+ **Codingns4DSH 是一个 DSH 插件 Bundle**(Host 层 + 浏览器层),提供八个模块,全部在 **设置 → Codingns4DSH** 中配置。
173
46
 
174
- - streaming assistant text, thinking levels and tool calls rendered by DSH's own components;
175
- - permission prompts and Agent questions shown as native DSH interactions;
176
- - subscription/usage information where the Agent exposes it;
177
- - follow-up messages, interruption, and steering for Agents that support them;
178
- - the last used model and thinking effort remembered per Agent.
47
+ > 名称说明:本插件名为 **Codingns4DSH**(npm 包 `@jingyi0605/codingns4dsh`,设置页入口显示为 Codingns4DSH);文中单独出现的 **Codingns4DSH** 指提供 Control API、账号与中继隧道的平台服务。
179
48
 
180
- Sessions started this way stay in the DSH sidebar like any other session, with the Agent's logo, and can be restored or archived from the session row (see [Workspace session enhancement](#workspace-session-enhancement)). The session index is stored on the Host and contains no credentials and no raw messages.
49
+ | 模块 | 作用 | 默认 |
50
+ | --- | --- | :---: |
51
+ | **外部Agent集成** | 把已安装的 Agent CLI 变成 DSH 原生会话:流式输出、工具调用、权限确认、提问、用量、思考强度 | 开 |
52
+ | **工作区会话增强** | 会话行显示 Agent Logo、归档会话入口、工作区隐藏/恢复入口、订阅/用量信息 | 关 |
53
+ | **终端强化** | 持久终端,以及 Shell、主题、字体、光标、滚动缓冲区设置 | 关 · 需重启 |
54
+ | **局域网访问DSH** | 监听端口并把局域网地址转发到本机 DSH Web | 常驻 |
55
+ | **登录保护** | 可选:用统一的本地账号保护局域网**和**中继访问,回环地址始终放行 | 常驻(卡片) |
56
+ | **中转访问服务** | **在互联网任何位置访问自己的 DSH Web**,端到端加密 | 关 |
57
+ | **工作区调试** | 按工作区保存启动配置、检查端口、HTTP 服务代理 | 开 |
58
+ | **Git 仓库管理** | 在右侧 Sidebar 标签页查看改动、暂存文件、提交和 Git 版本历史 | 开 |
181
59
 
182
- Installation and login for each Agent happen **outside** DSH, with that vendor's own tooling. Codingns4DSH never stores Agent credentials.
60
+ DSH 原生部分不会被替换:对话、会话列表、侧栏、设置、权限确认仍然是 DSH 自己的组件。
183
61
 
184
- ### Workspace session enhancement
62
+ 一切都跑在 **Host(你的电脑)** 上:Agent 进程、终端、文件、局域网/中继监听;浏览器只是视图。Agent CLI 作为 DSH 子进程使用自己的凭据与上游,模型流量不经过插件。远程访问全部可用。
185
63
 
186
- Three independent switches, all on by default once the module is enabled:
187
-
188
- - **Agent logo** on each external session row, so you can tell which CLI produced a session.
189
- - **Archived-session entry** in workspaces that have archived external sessions, so they can be brought back.
190
- - **Subscription and usage readout** in the composer dock for Agents whose limits can be read (Command Code, Codex, Claude Code, OpenCode, Grok, and the built-in DSH Agent when an upstream usage source is configured). Third-party upstream usage is shown when configured, and official quota windows are hidden rather than shown incorrectly.
191
-
192
- ### Terminal
193
-
194
- The plugin ships its own terminal stack: a DSH-speaking Host controller, the browser terminal UI, and xterm.js. The official DSH terminal rows are disabled in the same bundle generation so there is exactly one terminal service and one terminal UI.
195
-
196
- - **Binding scope** — by workspace (default: DSH sessions in the same workspace share terminals) or by DSH session (each session gets its own).
197
- - **Persistence** — in enhanced mode, terminals are backed by `tmux` on macOS/Linux and by a ConPTY broker on Windows, and are restored when DSH restarts. In the default basic mode terminals use a local PTY and do not survive a restart.
198
- - **Shells** — "system recommended" is resolved on the Host from the operating system and installed shells; explicit choices are zsh, bash, PowerShell, cmd and Git Bash, limited to shells actually detected on the Host.
199
- - **Appearance** — inherit the DSH theme or customize background, foreground, cursor color, font family, font size, line height, cursor shape, cursor blink and scrollback (1,000–100,000 lines).
200
- - **Restart required** — enabling or disabling the module, and changing the binding scope, take effect after restarting DSH; the settings card reports both the effective state and the next-start intent.
201
-
202
- ### LAN access to DSH
203
-
204
- Use this when the Host and your other device are on the same network.
205
-
206
- 1. Pick a **listen host** (all interfaces, or a specific interface) and a **listen port** (default `13080`).
207
- 2. Let Codingns4DSH **auto-detect the local DSH Web port**, or type it manually.
208
- 3. Start the mapping, then open `http://<lan-ip>:<listen-port>` on the other device.
209
-
210
- The module also installs a `crypto.randomUUID` shim in the browser, because plain-HTTP LAN origins are not secure contexts and some browsers do not expose that API there. **Auto-start** restores the mapping the next time DSH starts. This path stays on the local network and does not use the relay service.
211
-
212
- ### Relay access service
213
-
214
- **The relay service goes beyond the LAN: it lets you open your own DSH Web UI from anywhere on the internet.** LAN access only works while the other device is on the same network as the Host; the relay carries the same DSH Web session across networks, NAT and mobile data — from another office, another city, or a phone on cellular. No public IP, no router port forwarding and no VPN are required.
215
-
216
- Use this when direct access is not possible (different networks, NAT, no port forwarding) or simply when you are away from the local network:
217
-
218
- 1. Set the **Control API address** (default `https://channel.codingns.com:1443`; several addresses can be saved).
219
- 2. **Log in** with your Codingns4DSH account.
220
- 3. **Refresh the device list** and select the DSH device.
221
- 4. **Bind the current Host** — the panel shows the Host label, public key and fingerprint.
222
-
223
- The tunnel is an isolated DSH–Codingns4DSH device channel: the Host's local DSH port is never exposed to the internet, and only a Host you have bound can be reached. The only networking requirements are outbound HTTPS from the Host to the Control API and connectivity from the device you browse with to the Codingns4DSH relay entry. The password is used only for the login request; the refresh token and device credential are kept in the Host credential store, not in browser settings. Traffic inside the tunnel is **end-to-end encrypted with WebRTC/DTLS** — the relay handles connection metadata only, never DSH content. See [End-to-end encryption](#end-to-end-encryption-why-the-relay-cannot-read-your-dsh-traffic).
224
-
225
- ### Workspace debug
226
-
227
- Per-workspace launch profiles, stored in `<workspace>/.codingns/debug.json`:
228
-
229
- - **name**, **working directory** (relative to the workspace root), **command and arguments**, **environment variables** (secret-looking keys are rejected) and the **shell/runtime** to launch with;
230
- - an optional **port** the command is expected to listen on;
231
- - an optional **reverse proxy** toggle to expose that port through DSH.
232
-
233
- From the right sidebar **调试** tab you can start a profile in a terminal, watch the port state (checked every few seconds), stop a running instance (only the process listening on the configured port is terminated — the terminal runtime is left alone), and open a proxied service through a per-instance, unguessable binding URL. The proxy is intentionally narrow: it serves only the port that the current running instance actually listens on, and it supports HTTP only — WebSocket proxying is not implemented yet.
64
+ 补充说明:Codingns4DSH 装好后侧栏终端就已存在,**终端强化** 只是把它从基础本地 PTY 切换为持久后端(macOS/Linux 用 tmux,Windows 用 ConPTY),重启后生效;在 DSH `0.1.5.x` 上 Codingns4DSH 运行于兼容模式(无多 Tab 与 Shell 选择),卡片会给出提示;**工作区调试** 目前界面文案只有中文。
234
65
 
235
66
  ---
236
67
 
237
- ## Supported external Agents
68
+ ## 支持的外部 Agent
238
69
 
239
- Each Agent is detected on the Host by command name; the version and model list are read from the CLI itself. Capability support depends on the Agent's protocol and version.
70
+ 在 Host 上按命令名检测,版本与模型列表从 CLI 自身读取;检测到的 Agent 默认启用,可单独启停。内置的 **DeepSeek Harness** Agent 始终可用。
240
71
 
241
- | Agent | Adapter id | CLI command(s) on `PATH` | Protocol | Capabilities |
72
+ | Agent | id | 命令 | 协议 | 能力 |
242
73
  | --- | --- | --- | --- | --- |
243
- | Command Code | `command-code` | `command-code`, `commandcode`, `cmdc` | single-shot CLI (`--session` + `-p`) | models, streaming, resume, interrupt, tool events, reasoning, usage |
244
- | Claude Code | `claude-code` | `claude` | stream-json | models, streaming, resume, interrupt, tool events, reasoning, usage |
245
- | Kimi CLI | `kimi` | `kimi`, `kimi-cli` | stream-json | models, streaming, resume, interrupt, tool events, reasoning, usage, approvals, questions, steering |
246
- | Gemini CLI | `gemini` | `gemini` | ACP | models, streaming, resume, interrupt, tool events, reasoning, usage, approvals |
247
- | Pi Agent | `pi` | `pi`, `pi-agent` | JSON-RPC | models, streaming, resume, interrupt, tool events, reasoning, usage, steering |
248
- | Codex | `codex` | `codex` | JSON-RPC (app-server) | models, streaming, resume, interrupt, tool events, reasoning, usage, approvals, questions, steering |
249
- | OpenCode | `opencode` | `opencode` (or an existing server via `OPENCODE_SERVER_URL`, default `http://127.0.0.1:4096`) | HTTP + SSE | models, streaming, resume, interrupt, tool events, reasoning, usage, approvals, questions |
250
- | Grok Build | `grok` | `grok`, `grok-build` | ACP | models, streaming, tool events, reasoning, usage, approvals |
251
-
252
- Capability legend:
253
-
254
- - **models** — the Agent's model list is read and offered in the composer.
255
- - **streaming** — assistant text is streamed into the DSH session as it is produced.
256
- - **resume** — an existing Agent session can be continued after a DSH restart.
257
- - **interrupt** — the running turn can be cancelled.
258
- - **tool events** — tool calls and results are rendered in the conversation.
259
- - **reasoning** — thinking/effort level is exposed and selectable.
260
- - **usage** — token or subscription usage is surfaced.
261
- - **approvals / questions** — the Agent's permission prompts and questions become native DSH interactions.
262
- - **steering** — a message can be injected while the Agent is working.
263
-
264
- Anything not listed for an Agent is not supported by that CLI or its current version. The built-in **DeepSeek Harness** Agent is always available and needs no external CLI.
265
-
266
- ---
267
-
268
- ## Installation
269
-
270
- ### Requirements
271
-
272
- | Requirement | Notes |
273
- | --- | --- |
274
- | **DSH `>=0.1.5-rc.3 <0.1.7-0`** | Tested with `0.1.6-alpha.2`. Plugin and DSH versions are released independently; keep them inside the declared range. |
275
- | **Node.js `>= 22.19`** | Used by the `dsh` launcher and by the bundle. |
276
- | **`pnpm` on `PATH`** | `dsh plugin` forwards to pnpm. DSH prints `dsh: pnpm was not found` if it is missing. |
277
- | **A supported Agent CLI** | Only if you plan to use external Agents. Install and log in with the vendor's own installer. |
278
- | **`tmux` (optional)** | Required only for persistent terminals (Terminal enhancement) on macOS/Linux. Windows uses the bundled ConPTY broker. |
279
-
280
- Install tmux with `brew install tmux` (macOS), `sudo apt install tmux` (Debian/Ubuntu) or `sudo dnf install tmux` (Fedora/RHEL).
281
-
282
- ### Install from npm (recommended)
283
-
284
- DSH installs plugins into a **profile**. Codingns4DSH expects the profile to also contain the DSH Web application layer, so create a dedicated profile from the shipped `web` template first, then add the bundle:
285
-
286
- ```bash
287
- # 1. Create a dedicated profile from the shipped web template.
288
- # --dump-config only creates the profile and prints the composed layer tree,
289
- # then exits; it does not start the server.
290
- dsh codingns --from-default-profile web --dump-config
291
-
292
- # 2. Install the Codingns4DSH bundle into that profile.
293
- dsh plugin --profile codingns add @jingyi0605/codingns4dsh@0.1.0
294
-
295
- # 3. Start DSH with the profile.
296
- dsh codingns
297
- ```
298
-
299
- Or install into the standard `web` profile, if you prefer not to keep a separate profile:
300
-
301
- ```bash
302
- dsh plugin --profile web add @jingyi0605/codingns4dsh@0.1.0
303
- dsh web
304
- ```
305
-
306
- What the install command does:
74
+ | Command Code | `command-code` | `command-code`、`commandcode`、`cmdc` | 单轮 CLI | 模型、流式、恢复、打断、工具、思考、用量 |
75
+ | Claude Code | `claude-code` | `claude` | stream-json | 模型、流式、恢复、打断、工具、思考、用量 |
76
+ | Kimi CLI | `kimi` | `kimi`、`kimi-cli` | stream-json | 上述全部 + 权限确认、提问、插话 |
77
+ | Gemini CLI | `gemini` | `gemini` | ACP | 模型、流式、恢复、打断、工具、思考、用量、权限确认 |
78
+ | Pi Agent | `pi` | `pi`、`pi-agent` | JSON-RPC | 模型、流式、恢复、打断、工具、思考、用量、插话 |
79
+ | Codex | `codex` | `codex` | JSON-RPC(app-server) | 全部 + 权限确认、提问、插话 |
80
+ | OpenCode | `opencode` | `opencode`,或 `OPENCODE_SERVER_URL`(默认 `http://127.0.0.1:4096`) | HTTP + SSE | 全部 + 权限确认、提问 |
81
+ | Grok Build | `grok` | `grok`、`grok-build` | ACP | 模型、流式、工具、思考、用量、权限确认 |
307
82
 
308
- - it runs `pnpm add` inside `$DSH_HOME/profiles/<profile>` (default `~/.dsh/profiles/<profile>`);
309
- - if the profile does not exist yet, DSH initializes it automatically;
310
- - because `@jingyi0605/codingns4dsh` declares a bundle patch, the package is appended to `dsh.profile.bundles`, so the plugin's Host and browser layers are loaded on the next start;
311
- - the Codingns4DSH bundle patch disables the official DSH terminal rows and inserts the Codingns4DSH terminal in the same bundle generation, so there is exactly one terminal service.
83
+ **模型** 模型列表 · **流式** 实时输出 · **恢复** 重启后继续 · **打断** 取消当前回合 · **工具** 对话中渲染工具调用 · **思考** 推理/思考强度 · **用量** token 或订阅额度 · **权限确认 / 提问** 变成 DSH 原生交互 · **插话** 回合中追加消息。
312
84
 
313
- To install a later release, replace `0.1.0` with the version shown on the [npm package page](https://www.npmjs.com/package/@jingyi0605/codingns4dsh), keeping it inside the declared DSH compatibility range.
314
-
315
- > **If the registry reports a 404 for `@jingyi0605/codingns4dsh`:** that version has not been published yet. Use [Install from source](#install-from-source-fallback) and add the local checkout instead — the rest of the setup is identical.
316
-
317
- > **Do not** create a profile with the plugin as its very first command (`dsh plugin --profile codingns4dsh add …` on a fresh name). A brand-new custom profile only contains `@deepseek-ai/dsh-base`: it has no Web application layer, so the terminal patch cannot find its targets (you will see `patch: entry "terminal-controller" not found`) and there is no browser UI to open. Create the profile from the `web` template first, as shown above.
318
-
319
- ### Verify the installation
320
-
321
- ```bash
322
- dsh --version # DSH version, must be inside the supported range
323
- dsh plugin --profile codingns list --depth 0 # codingns4dsh 0.1.0
324
- dsh --profile codingns --dump-config # composed plugin tree
325
- ```
326
-
327
- In the composed tree, confirm both of these:
328
-
329
- - an entry `id: codingns4dsh` (the bundle layer);
330
- - `id: terminal-controller` marked `disabled: true` under the `@jingyi0605/codingns4dsh` patch layer, with no `patch: entry … not found` warnings on stderr.
331
-
332
- ### Upgrade, downgrade and uninstall
333
-
334
- ```bash
335
- # upgrade or pin a different version
336
- dsh plugin --profile codingns add @jingyi0605/codingns4dsh@<version>
337
-
338
- # uninstall (the bundle entry is removed from the profile automatically)
339
- dsh plugin --profile codingns remove codingns4dsh
340
- ```
341
-
342
- After changing versions, restart DSH. Your configuration is preserved in the DSH settings document, so an upgrade does not reset module switches or Agent preferences.
343
-
344
- ### Install from source (fallback)
345
-
346
- Use this when the npm package is not available to you yet, or when you want to run a checkout:
347
-
348
- ```bash
349
- git clone https://github.com/jingyi0605/Codingns4DSH.git
350
- cd Codingns4DSH
351
- pnpm install
352
- pnpm build
353
-
354
- # create the profile first (see above), then install the checkout
355
- dsh codingns --from-default-profile web --dump-config
356
- dsh plugin --profile codingns add "$PWD"
357
- dsh codingns
358
- ```
359
-
360
- Installing a directory creates a linked dependency, so the profile keeps using the checkout's build output: run `pnpm build` again (or keep `pnpm dev:watch` running) and restart DSH after changing the source.
361
-
362
- If you prefer an installable artifact, pack a tarball instead of linking the directory:
363
-
364
- ```bash
365
- npm pack # builds via prepack, then writes jingyi0605-jingyi0605-codingns4dsh-<version>.tgz
366
- dsh plugin --profile codingns add ./jingyi0605-codingns4dsh-0.1.0.tgz
367
- ```
368
-
369
- ### Where Codingns4DSH keeps files
370
-
371
- | Path | Contents |
372
- | --- | --- |
373
- | `$DSH_HOME/profiles/<profile>` (default `~/.dsh/profiles/<profile>`) | The DSH profile: installed plugin packages and `dsh.profile.bundles`. |
374
- | `$DSH_HOME/settings.yaml` (default `~/.dsh/settings.yaml`) | Plugin settings under the `codingns:` namespace: module switches, Agent enables, Agent preferences, LAN mapping, terminal appearance. |
375
- | `$DSH_HOME/codingns4dsh/host-id` | Stable local terminal host identity (generated once per profile). |
376
- | `$DSH_HOME/codingns4dsh/terminals.json` | Persistent terminal mapping used to restore terminals after a restart. |
377
- | `~/.config/codingns4dsh/codingns-credentials.json` | Relay refresh token and device credential. Override the directory with `CODINGNS4DSH_STATE_DIR`. |
378
- | `<workspace>/.codingns/debug.json` | Workspace debug launch profiles (mode `0600`, secrets rejected). |
85
+ 未列出的能力表示该 CLI 或其版本不支持;Agent 的安装与登录都在 DSH 之外完成,Codingns4DSH 不保存 Agent 凭据。
379
86
 
380
87
  ---
381
88
 
382
- ## First run
383
-
384
- 1. **Start DSH**: `dsh codingns` opens the DSH Web UI in your browser.
385
- 2. **Open Settings → Codingns4DSH** (`设置 → Codingns4DSH`). You will see one card per module, with its current state and whether a restart is needed.
386
- 3. **External Agents**: install and log in to the Agent CLIs you want *outside* DSH, then confirm the commands are on the Host `PATH` (`which claude`, `which codex`, …). The card lists each Agent's detection status, version, command path and models; enable the ones you need.
387
- 4. **Start a session**: pick an Agent and a model in the composer, choose a thinking level if the Agent supports it, and send a prompt. Output streams into a native DSH session and appears in the sidebar with the Agent's logo.
388
- 5. **Terminals**: open the Terminal panel in the right sidebar and create a terminal for the current workspace. For persistence across restarts, enable **Terminal enhancement** in the settings card and restart DSH.
389
- 6. **Workspace debug**: open the right sidebar **调试** tab, add a launch profile for the workspace (command, working directory, optional port) and start it. Codingns4DSH reports the port state and, when enabled, gives you a proxy URL for the service.
390
- 7. **Remote access (optional)**: for devices on your own network, set up [LAN access](#lan); to reach this same DSH Web **from anywhere on the internet**, log in to the [relay service](#relay).
89
+ ## 功能详解
391
90
 
392
- ---
91
+ ### 外部 Agent 集成
393
92
 
394
- ## Remote access
93
+ 在选择器里挑选 Agent 与模型后,Codingns4DSH 以 DSH 子进程方式启动(或恢复)该 CLI,并把事件流投影成原生会话;模型与思考强度按 Agent 记忆。
395
94
 
396
- Codingns4DSH offers two independent remote paths. You can enable either or both — they solve different problems:
397
-
398
- | | [LAN access to DSH](#lan) | [Relay access service](#relay) |
399
- | --- | --- | --- |
400
- | Connect from | Devices on the same local network | **Any device, anywhere — the internet is enough** |
401
- | Typical use | Phone, tablet or second computer at home or in the office | Working away from the Host, across NAT, mobile data or a company network |
402
- | Requirements | Host and device share a network, and the firewall allows the listen port | Outbound HTTPS from the Host to the Codingns4DSH Control API, plus connectivity from your device to the Codingns4DSH relay entry |
403
- | Account needed | No | Codingns4DSH account with a bound Host |
404
- | Local port exposed | Yes — a listener on the chosen interface and port | No — traffic goes through the isolated device tunnel |
405
- | Path to the Host | Direct TCP on your own network | DSH–Codingns4DSH relay tunnel |
406
-
407
- In short: **LAN access keeps you on the local network, while the relay access service lets you reach your own DSH Web service from anywhere on the internet.**
95
+ <div align="center">
96
+ <table>
97
+ <tr>
98
+ <td><img width="100%" src="assets/screenshots/agent-picker.jpg" alt="工作区会话增强:Agent Logo、归档会话与工作区列表"></td>
99
+ <td><img width="100%" src="assets/screenshots/model-picker.jpg" alt="Codex 的模型列表"></td>
100
+ </tr>
101
+ </table>
102
+ </div>
408
103
 
409
- ### LAN
104
+ 模型列表直接读取自各 CLI,可随时切换;按钮上还会显示当前模型与思考强度。
410
105
 
411
- Enable the mapping in the **LAN access to DSH** card:
106
+ ### 会话增强与订阅用量
412
107
 
413
- 1. choose a **listen host** — all interfaces (`0.0.0.0`) is the simplest choice, or pick a specific interface;
414
- 2. choose a **listen port** (default `13080`);
415
- 3. auto-detect or enter the **local DSH Web port**;
416
- 4. start, then open `http://<lan-ip>:<listen-port>` from the other device.
108
+ 会话行显示 Agent Logo 与归档入口,输入框下方显示可读取额度的 Agent 的订阅或上游用量(含缓存命中率、按模型统计与费用)。
417
109
 
418
- Notes: keep both devices on the same network, and allow the listen port through the Host firewall. If several DSH instances are running, auto-detect reports all candidate ports and asks you to choose one. Enable **auto-start** to restore the mapping whenever DSH starts.
110
+ <div align="center">
111
+ <table>
112
+ <tr>
113
+ <td><img width="100%" src="assets/screenshots/subscription-usage.jpg" alt="Codex 上游用量与费用统计"></td>
114
+ <td><img width="100%" src="assets/screenshots/subscription-plan.jpg" alt="Codex 订阅额度与重置时间"></td>
115
+ </tr>
116
+ </table>
117
+ </div>
419
118
 
420
- ### Relay
119
+ 用量来自 Agent 自身的额度接口或已配置的上游用量来源;数据只在 Host 上读取,不写入浏览器存储。
421
120
 
422
- **This is the path for accessing your DSH from outside the local network** — over the internet, from any network the remote device happens to be on. The Host does not need a public IP, a port mapping or a VPN; it only needs outbound HTTPS access to the Control API.
121
+ ### 工作区调试
423
122
 
424
- Enable the **Relay access service** card:
123
+ 每个工作区一份启动配置(`<工作区>/.codingns/debug.json`):命令、工作目录、环境变量、Shell 与可选端口,可一键启动、检查端口、结束进程或停止。可选反向代理会把端口通过 DSH 暴露出来,目前仅支持 HTTP。
425
124
 
426
- 1. enter the **Control API address** (default `https://channel.codingns.com:1443`; extra addresses can be saved and switched);
427
- 2. **log in** with your Codingns4DSH account;
428
- 3. **refresh the device list** and select the target DSH device;
429
- 4. **bind the current Host**; the card shows the Host label, public key and fingerprint.
125
+ <div align="center">
126
+ <table>
127
+ <tr>
128
+ <td><img width="100%" src="assets/screenshots/workspace-debug.jpg" alt="工作区调试面板:启动配置、端口状态与代理"></td>
129
+ <td><img width="100%" src="assets/screenshots/workspace-debug-edit.jpg" alt="工作区调试面板:编辑启动配置"></td>
130
+ </tr>
131
+ </table>
132
+ </div>
430
133
 
431
- On the remote device, connect to the bound Host through the Codingns4DSH entry and use DSH Web as usual — the same sessions, terminals and workspaces you have locally, since everything actually runs on the Host.
134
+ 面板实时显示端口监听状态与 PID,并按实例生成不可猜测的代理地址。
432
135
 
433
- The relay carries the DSH Web connection through an isolated device tunnel, so the Host's local port is never exposed to the internet and only Hosts you have bound can be reached. Credentials stay on the Host.
136
+ ### Git 仓库管理
434
137
 
435
- ### End-to-end encryption (why the relay cannot read your DSH traffic)
138
+ Git 面板通过 DSH 原生右侧 Sidebar 的标签页入口打开,按 Workspace 保存状态并跨会话复用。未初始化的目录可直接初始化仓库;已初始化的仓库支持查看暂存文件和未提交文件、暂存/取消暂存、丢弃更改、填写提交说明、切换分支和浏览提交历史。模块关闭后会移除右侧标签及对应 Host Git RPC,不影响其他模块。
436
139
 
437
- The relay path is end-to-end encrypted by design, so using it does not mean handing your conversations to a server. DSH traffic always travels inside a **WebRTC DataChannel protected by DTLS between the two endpoints** — the DSH Client in your remote browser and the DSH Host on your machine. The tunnel never hands business messages to the relay:
140
+ ### 模块与设置
438
141
 
439
- - **What the control service and relay handle**: account and device records, the Host binding, tickets, SDP/ICE signaling, online state and traffic accounting — control-plane metadata only.
440
- - **What stays end-to-end encrypted**: DSH RPC and model messages, Agent output, terminal (PTY) input and output, tasks, file contents, ports and the remote DSH Web itself. Whether the two ends connect directly or through TURN, the payload stays encrypted end to end — the relay only ever forwards ciphertext.
441
- - **The client verifies the Host's identity**: every Host generates and keeps its own DTLS certificate (`~/.config/codingns4dsh/dtls-identity.json`) and publishes its SHA-256 fingerprint. The remote side checks the fingerprint during the WebRTC handshake and aborts the connection on a mismatch (`Host DTLS fingerprint 校验失败`) instead of silently accepting a substituted certificate. The same fingerprint is shown in the relay settings card so you can compare it manually.
442
- - **Credentials stay on the Host**: your account password is used only for the login request; the refresh token and the device credential live in the Host credential store, not in the browser.
443
- - **Diagnostics never log content**: tunnel diagnostics record protocol metadata (direction, message type, stream id, status, byte count) and never envelope bodies, tickets, cookies or DSH Web content.
142
+ 设置页按模块渲染卡片,开关、说明和「是否需要重启」都来自模块自身的描述;终端外观、局域网映射、登录保护、中转账号等都在对应卡片内配置。
444
143
 
445
- These are design gates of the tunnel rather than incidental behavior: the control service and relay may only process control-plane metadata, gateway business messages must never be handed to the relay, and all DSH payloads must be end-to-end encrypted between the DSH Client and the DSH Host.
144
+ <div align="center">
145
+ <table>
146
+ <tr>
147
+ <td><img width="100%" src="assets/screenshots/settings-overview.jpg" alt="设置 → Codingns4DSH 模块卡片"></td>
148
+ <td><img width="100%" src="assets/screenshots/settings-modules.jpg" alt="全部模块开关"></td>
149
+ </tr>
150
+ </table>
151
+ </div>
446
152
 
447
- ### Security notes
153
+ ### 登录保护
448
154
 
449
- - LAN access is a plain TCP forward on your own network — use it on trusted networks only.
450
- - Relay traffic is end-to-end encrypted (WebRTC/DTLS): the relay and control service see connection metadata, not your DSH conversations, terminal output or files.
451
- - The relay tunnel only operates after you log in and bind the Host; log out to drop the session.
452
- - Agent credentials never pass through Codingns4DSH; each CLI keeps using its own configuration.
453
- - Tunnel diagnostics never log envelope bodies, tickets, cookies or DSH Web content.
155
+ 默认关闭,在卡片中开启后用统一的本地账号保护局域网**和**中继访问(默认会话超时 30 分钟)。认证发生在 Host 的转发边界,未登录请求不会到达 DSH Web;`127.0.0.1` 与 `::1` 永远放行,避免把自己锁在外面。
454
156
 
455
- ---
157
+ <div align="center">
158
+ <img width="70%" src="assets/screenshots/login-protection.jpg" alt="本地账号登录页">
159
+ </div>
456
160
 
457
- ## Settings reference
161
+ 密码以 `scrypt` 哈希保存在 `0600` 文件中,浏览器只持有 `HttpOnly`、`SameSite=Strict` 会话 Cookie。
458
162
 
459
- Settings live in the DSH settings document (`$DSH_HOME/settings.yaml`, default `~/.dsh/settings.yaml`) under the `codingns` namespace. The settings page is the supported way to change them.
163
+ ### 远程访问
460
164
 
461
- | Setting | Meaning | Default |
165
+ | | 局域网访问 | 中转访问服务 |
462
166
  | --- | --- | --- |
463
- | `modules.<moduleName>` | Per-module enable intent (`cliAdapters`, `workspaceSessionEnhancement`, `terminalEnhancement`, `reverseProxy`, `debug`). | Each module's own default |
464
- | `agentAdapters.<adapterId>` | Per-Agent enable intent. | All detected Agents enabled |
465
- | `agentAdapterPreferences.<adapterId>` | Last used model and thinking effort per Agent. | remembered per Agent |
466
- | `cliSessions` | Host-side index of external sessions (no credentials, no messages). | — |
467
- | `lanAccessDsh.autoStart` | Restore the LAN mapping when DSH starts. | `false` |
468
- | `lanAccessDsh.listenHost` / `listenPort` | Listener interface and port. | `0.0.0.0` / `13080` |
469
- | `lanAccessDsh.dshPort` | Local DSH Web port; `0` means auto-detect. | `0` |
470
- | `terminalEnhancement.bindingScope` | `workspace` (share terminals per workspace) or `session`. | `workspace` |
471
- | `terminalEnhancement.defaultProfile` | Default shell for new terminals (`system`, `zsh`, `bash`, `powershell`, `cmd`, `git-bash`). | `system` |
472
- | `terminalEnhancement.appearance.*` | Theme, colors, font, cursor and scrollback; `null` inherits DSH. | inherit |
473
- | `workspaceSessionEnhancement.showAdapterLogo` / `showArchivedSessions` / `showSubscriptionUsage` | Session-row enhancements. | `true` |
474
- | `controlBaseUrl` / `controlBaseUrls` | Relay Control API addresses. | `https://channel.codingns.com:1443` |
475
-
476
- ---
477
-
478
- ## Troubleshooting
479
-
480
- ### Check versions first
481
-
482
- ```bash
483
- dsh --version
484
- dsh plugin --profile codingns list --depth 0
485
- npm view @jingyi0605/codingns4dsh version
486
- ```
487
-
488
- Keep DSH inside `>=0.1.5-rc.3 <0.1.7-0`. The bundle's launch glue validates the running DSH version and refuses to take over the connection for an unsupported Host; upgrade or downgrade DSH instead of mixing versions.
167
+ | 从哪里连接 | 同一局域网 | **任何设备、互联网上的任何位置** |
168
+ | 前提 | 同一网络 + 放行监听端口 | Host 能通过 HTTPS 访问 Control API;设备能连上 Codingns4DSH 入口 |
169
+ | 是否暴露本地端口 | 是——所选网卡/端口(默认 `13080`) | 否——独立设备隧道 |
170
+ | 账号 | 可选登录保护 | 需要 Codingns4DSH 账号并绑定 Host |
489
171
 
490
- ### `patch: entry "terminal-controller" not found`
172
+ **局域网**:选择监听网卡与端口,自动探测(或手动填写)本机 DSH Web 端口,启动后在另一台设备打开 `http://<局域网 IP>:<端口>`;开启自动启动可恢复映射,模块还会补齐明文 HTTP 来源所需的 `crypto.randomUUID`。
491
173
 
492
- The profile has no DSH Web application layer, which happens when a custom profile is created by the plugin install itself. Recreate the profile from the `web` template and install again:
174
+ **中转**:配置 Control API(默认 `https://channel.codingns.com:1443`,可在此注册账号),登录、刷新设备、绑定当前 Host(显示标签、公钥、指纹),之后在任意设备通过 **`https://dsh.codingns.com`** 打开已绑定的 Host——不需要公网 IP、端口映射或 VPN。
493
175
 
494
- ```bash
495
- dsh codingns --from-default-profile web --dump-config
496
- dsh plugin --profile codingns add @jingyi0605/codingns4dsh@0.1.0
497
- ```
498
-
499
- ### An Agent is not detected
500
-
501
- - Confirm the CLI works in a terminal **on the Host machine**: `claude --version`, `codex --version`, `kimi --version`, …
502
- - Confirm its directory is on the `PATH` **of the process that started DSH** (GUI launchers often have a shorter `PATH` than your shell).
503
- - Log in to the Agent with its own tooling; Codingns4DSH only launches it.
504
- - Restart DSH after changing `PATH` or installing a CLI, then re-open the settings card.
505
-
506
- ### Terminal problems
507
-
508
- - Persistent terminals require `tmux` on macOS/Linux. If it is missing, the settings card reports the runtime as unavailable; install tmux and restart DSH.
509
- - Enabling/disabling **Terminal enhancement** and changing the binding scope take effect only after a DSH restart; the card shows the effective state versus the next-start intent.
510
- - Terminals are addressed by workspace; if a terminal seems to belong to another session, check the binding scope.
511
-
512
- ### LAN access does not connect
513
-
514
- - Verify the listener is running: the card shows `Forwarding: <host>:<port> → DSH Web 127.0.0.1:<dshPort>`.
515
- - Allow the listen port through the Host firewall, and make sure both devices are on the same network and can reach the Host's IP.
516
- - If auto-detect finds no port, start the DSH Web UI first or enter the DSH port manually.
517
-
518
- ### Relay login or binding fails
519
-
520
- - Check the Control API address and that the Host can reach it over HTTPS.
521
- - Log in again if the session expired; then refresh the device list.
522
- - Bind the Host before expecting the tunnel to accept connections; the card shows the bound Host label and fingerprint.
523
-
524
- ### Diagnostics and logs
176
+ <div align="center">
177
+ <table>
178
+ <tr>
179
+ <td><img width="100%" src="assets/screenshots/relay-service.jpg" alt="中转访问服务卡片"></td>
180
+ <td><img width="100%" src="assets/screenshots/relay-h5-login.jpg" alt="H5 登录页选择 DSH Host"></td>
181
+ </tr>
182
+ </table>
183
+ </div>
525
184
 
526
- Tunnel diagnostics are disabled by default. Start DSH with:
185
+ DSH 设置按钮旁的账户入口会显示登录状态、访问路径与延迟、Host CPU/内存,并可一键注销登录。
527
186
 
528
- ```bash
529
- CODINGNS4DSH_TUNNEL_DEBUG=1 dsh codingns --no-open
530
- ```
187
+ <div align="center">
188
+ <img width="70%" src="assets/screenshots/relay-status.jpg" alt="账户状态弹层:访问路径、延迟、CPU 与内存">
189
+ </div>
531
190
 
532
- Diagnostic records include connection direction, message type, stream id, operation, scope, status and byte count. Envelope bodies, tickets, cookies and DSH Web content are never logged. Plugin install diagnostics (pnpm output) are written to `$DSH_HOME/profiles/<profile>/.plugin-manager/logs/`.
191
+ 其中「访问」会标明当前是通过本机、局域网还是中转进入 DSH Web。
533
192
 
534
- ### Reporting a problem
193
+ **为什么中转看不到你的 DSH 内容**——隧道端到端加密,使用它不等于把对话交给服务器:
535
194
 
536
- Include the DSH version, Codingns4DSH version, operating system, the module you were using, what you expected, what happened, and the exact error text. Report through [GitHub Issues](https://github.com/jingyi0605/Codingns4DSH/issues) or the QQ group **1092985965**.
195
+ - 载荷走在 **DSH Client 与 DSH Host 之间的 WebRTC DataChannel,由 DTLS 保护**;无论直连还是经 TURN,Relay 都只承载密文。
196
+ - Relay 与控制站只处理**控制面元数据**:账号/设备记录、Host 绑定、ticket、SDP/ICE 信令、在线状态、流量统计。
197
+ - 每个 Host 自持 DTLS 证书(`~/.config/codingns4dsh/dtls-identity.json`)并发布 SHA-256 指纹,远端在握手时核对;不一致直接中断(`Host DTLS fingerprint 校验失败`),不会接受被替换的证书;同一指纹显示在中转卡片中供人工比对。
198
+ - 密码只用于登录请求;refresh token 与设备凭据留在 Host。诊断日志只记录协议元数据(方向、类型、流 ID、状态、字节数),不记录正文、票据、Cookie 或 DSH Web 内容。
537
199
 
538
200
  ---
539
201
 
540
- ## Roadmap
202
+ ## 安装
541
203
 
542
- Planned for upcoming releases — design targets, not promises for the current version:
204
+ **环境要求**:DSH 在 `>=0.1.5-rc.3 <=0.1.7-rc.2` 范围内(插件与 DSH 版本独立发布,安装期与运行期都会拒绝不兼容版本)· Node.js `>= 22.19` · `PATH` 中有 `pnpm`(`dsh plugin` 转发给 pnpm)· 可选:Agent CLI,以及 macOS/Linux 上用于持久终端的 `tmux`(`brew install tmux` / `sudo apt install tmux`)。
543
205
 
544
- - **PeerHost** — direct Host-to-Host resource discovery and collaboration.
545
- - **Enhanced file management** — browse, search, upload, download and common file operations inside a workspace.
546
- - **Enhanced workspace sessions** — deeper organization, filtering, metadata and cross-device synchronization.
547
- - **Debug service proxy, completed** — authenticated bindings and WebSocket support on top of today's HTTP-only proxy.
548
- - **Git management** — repository status, branches, commits, diffs and common Git operations.
549
- - **SKILL management** — discover, install, enable, disable and update reusable Agent skills.
550
- - **More** — additional workspace automation and collaboration modules driven by community feedback.
206
+ ### 最简单的安装方式:使用内置 `web` Profile
551
207
 
552
- ---
553
-
554
- ## Development
555
-
556
- Requirements: Node.js `>= 22.19` and pnpm.
208
+ DSH 的 `web` Profile 会在首次使用时自动初始化,不需要手动创建配置文件,也不需要执行 `--dump-config`:
557
209
 
558
210
  ```bash
559
- pnpm install
560
- pnpm build # version check → tsc → client bundle → H5 bundle
561
- pnpm test # build, then node --test tests/*.spec.ts
562
- pnpm typecheck # tsc --noEmit
563
- ```
564
-
565
- Useful scripts:
566
-
567
- | Script | Purpose |
568
- | --- | --- |
569
- | `pnpm build` | Clean `data/build/`, emit TypeScript, bundle the browser client and the H5 entry. |
570
- | `pnpm test` | Full build plus the test suites in `tests/`. |
571
- | `pnpm dev:link <profile>` | Symlink this checkout into `$DSH_HOME/profiles/<profile>/node_modules`. |
572
- | `pnpm dev:watch` | Rebuild in watch mode; restart DSH after a rebuild. |
573
- | `pnpm run version:check` | Verify that `version.json`, the sources and the manifests agree. |
574
- | `pnpm run version:set-plugin -- <version>` | Update the plugin version across the version sources. |
575
- | `pnpm run version:set-dsh -- <version> [range]` | Update the tested DSH version and compatibility range. |
576
-
577
- Repository layout:
578
-
579
- | Path | Contents |
580
- | --- | --- |
581
- | `src/host/` | Host layer: Agent adapters, terminal controller, LAN listener, auth, relay/device runtime, debug service, RPC table. |
582
- | `src/client/` | Browser layer: Settings cards, terminal UI, composer slots, session-row enhancements, debug panel, locale, theme. |
583
- | `src/shared/contracts/` | Version, settings, feature, Agent, terminal and debug contracts shared by both layers. |
584
- | `src/features/` | Feature registry: dependency ordering, state transitions and resource disposal. |
585
- | `src/transport/` | DSH transport/tunnel: envelopes, framing, multiplexer, WebRTC carrier, diagnostics. |
586
- | `tests/` | 58 suites covering contracts, modules, terminal backends, transport and client behaviour. |
587
- | `specs/`, `docs/` | Design records and module/UI development rules. |
588
- | `profile/` | Reference profile used by the Codingns4DSH shell; it selects only the Codingns4DSH bundle. |
589
- | `data/build/` | Build output (git-ignored; produced by `pnpm build`). |
590
-
591
- Publishing: pushing a `v*` tag runs the GitHub Actions workflow, which validates the tag against `version.json`, installs with a frozen lockfile, runs the type check and tests, verifies the package contents and publishes to npm with provenance (prerelease versions use the `next` dist-tag).
592
-
593
- ---
594
-
595
- ## Community
596
-
597
- - QQ discussion group: **1092985965**
598
- - Repository: [github.com/jingyi0605/Codingns4DSH](https://github.com/jingyi0605/Codingns4DSH)
599
- - npm package: [`@jingyi0605/codingns4dsh`](https://www.npmjs.com/package/@jingyi0605/codingns4dsh)
600
- - Issues and feature requests: [GitHub Issues](https://github.com/jingyi0605/Codingns4DSH/issues)
601
-
602
- When reporting a problem, please include the DSH version, Codingns4DSH version, operating system, the module you were using and the relevant error message.
603
-
604
- ---
605
-
606
- ## 中文说明
607
-
608
- [返回 English](#codingns-for-deepseek-harness)
609
-
610
- ### 鸣谢
611
-
612
- Codingns4DSH 的项目灵感以及部分实现思路来自 **[CodexHost](https://github.com/BytePioneer-AI/codex-host)**。
613
-
614
- CodexHost 把 Pi、Claude Code、Grok Build 等 Agent Harness 原生地运行在 Codex Desktop 中。它展示了 Codingns4DSH 从另一侧沿用的方向:宿主应用应当把**其他 Harness 作为一等 Agent 接入**,而不是替换它们。Codingns4DSH 的多 Harness 适配器模型、把 CLI 事件流投影为宿主原生会话,以及让每个 Agent 的会话留在宿主侧栏与输入框中,都源自该项目的设计思路。
615
-
616
- 感谢 CodexHost 的作者与社区。Codingns4DSH 是独立项目,与 CodexHost 没有从属关系。
617
-
618
- > **不只是局域网:中转访问服务让你在互联网上的任何位置访问自己的 DSH Web 服务** —— 不需要公网 IP、路由器端口映射或 VPN;并且中转链路**端到端加密**,Relay 只能看到连接元数据,看不到你的 DSH 对话、终端输出或文件内容。详见 [远程访问](#远程访问)。
619
-
620
- ### 项目简介
621
-
622
- **DeepSeek Harness(DSH)** 是 DeepSeek 的编码 Agent 运行框架,由 CLI 和 Web 应用组成,在你的项目工作区里运行 Agent 循环,提供会话、工具、权限、设置和浏览器界面。
623
-
624
- DSH 支持扩展:一个 **Profile** 就是若干插件 **Bundle** 组成的分层栈,而 Bundle 可以同时提供 **Host 层**(运行在 DSH 进程里的 Node/Cordis 插件)和 **浏览器层**(注入 DSH Web 界面的 UI 模块)。
625
-
626
- **Codingns4DSH 就是这样一个 Bundle。** 把它装进 Profile 后,你会得到:
627
-
628
- - **把已有的 Agent CLI 变成 DSH 里的一等 Agent**:Claude Code、Codex、Kimi CLI、Gemini CLI、Pi Agent、OpenCode、Grok Build、Command Code 都会出现在 DSH 输入框的 Agent 选择器里,流式输出、工具调用、权限确认、提问、用量和思考强度都由 DSH 原生对话界面渲染。
629
- - **重启也不会丢的终端**:侧栏终端按工作区或按会话绑定,DSH 重启后自动恢复,并支持 Shell、主题、字体、光标和滚动缓冲区设置。
630
- - **工作区调试面板**:为每个工作区保存启动配置,在终端中启动命令、检查端口、停止实例、打开代理后的服务。
631
- - **远程访问**:把本机 DSH Web 暴露到局域网;**更不止于此——中转访问服务让你在互联网上的任何位置访问自己的 DSH Web**,无需公网 IP、端口映射或 VPN。
632
-
633
- DSH 的任何部分都不会被替换:对话、会话列表、侧栏、设置和权限确认仍然是原生组件,Codingns4DSH 只是向它们注册模块和 UI 插槽。
634
-
635
- **适合谁用**
636
-
637
- - 已经在用 DSH,希望在一个界面里驱动已有的 Agent CLI 订阅,而不是在多个终端之间切换;
638
- - 每个项目都开着好几个终端,希望 DSH 重启后终端还在;
639
- - 想用手机、平板或另一台电脑打开同一个 DSH(同一局域网,或通过中转);
640
- - 想在 DSH 内完成「启动服务 → 检查端口 → 打开服务」的工作区闭环。
641
-
642
- ### 工作原理
643
-
644
- ```
645
- ┌─ 你的机器(Host 主机) ─────────────────────────────────────────────┐
646
- │ DSH 进程(Node.js,Profile:codingns) │
647
- │ ├─ @deepseek-ai/dsh-web-app 提供浏览器界面 │
648
- │ └─ codingns4dsh(本 Bundle) │
649
- │ ├─ Host 层 外部 Agent 适配器、终端控制器、 │
650
- │ │ 局域网监听、中继隧道、调试服务 │
651
- │ └─ 浏览器层 Agent 选择器、侧栏终端、设置卡片、 │
652
- │ 会话 Logo、调试面板 │
653
- │ │
654
- │ Agent CLI(claude / codex / kimi / gemini …)作为 DSH 子进程运行, │
655
- │ 继续使用它们自己的凭据和上游服务。 │
656
- └─────────────────────────────────────────────────────────────────────┘
657
- ▲
658
- │ 浏览器:http://127.0.0.1:<DSH 端口>(本机)
659
- │ http://<局域网 IP>:<监听端口>(局域网访问模块)
660
- │ 中继隧道(中转访问模块:在互联网任何位置访问,
661
- │ 无需公网 IP)
211
+ dsh plugin --profile web add @jingyi0605/codingns4dsh@0.1.2
212
+ dsh web
662
213
  ```
663
214
 
664
- 由此带来的几个结论:
665
-
666
- - **浏览器只是视图**:Agent 进程、终端会话和工作区文件都在 Host 上,关掉浏览器不会中断它们。
667
- - **外部 Agent 仍然是「外部」的**:Codingns4DSH 启动你已经安装并登录好的 CLI,把事件投影进 DSH 会话;模型请求发往该 CLI 自己的上游,不经过 Codingns4DSH。
668
- - **远程访问是可选项**:局域网访问只是把 TCP 转发到本机 DSH Web 端口,不会离开你的网络;中转访问服务让你在互联网上的任何位置打开同一个 DSH Web,同样只在你启用模块并登录后才会建立连接,而且链路端到端加密(WebRTC/DTLS),Relay 承载的是密文而不是可读的 DSH 内容。
669
-
670
- ### 功能总览
671
-
672
- 所有模块都会出现在 **设置 → Codingns4DSH** 中。「生效方式」说明改动是立即生效还是需要重启 DSH。
673
-
674
- | 模块(设置卡片) | 提供的能力 | 使用位置 | 运行端 | 默认 | 生效方式 |
675
- | --- | --- | --- | --- | :---: | :---: |
676
- | **外部 Agent 集成** | 检测已安装的 Agent CLI,显示版本、命令路径和可用模型,可单独启停,并以 DSH 原生流式会话运行 | 输入框 Agent 选择器、**设置 → Codingns4DSH** | Host + 浏览器 | **开** | 实时 |
677
- | **工作区会话增强** | 会话行显示 Agent Logo、归档会话入口、输入框下方的订阅/用量信息 | DSH 会话列表 | 浏览器 | **关**<br>(依赖外部 Agent 集成) | 实时 |
678
- | **终端强化** | 持久终端后端,以及终端外观(默认 Shell、主题、颜色、字体、光标、滚动缓冲区) | **设置 → Codingns4DSH**、右侧栏终端 | 浏览器 + Host | **关** | **需重启** |
679
- | **局域网访问 DSH** | 监听端口并把局域网地址转发到当前本机 DSH Web;同时补齐明文 HTTP 来源所需的 `crypto.randomUUID` | **设置 → Codingns4DSH** | 浏览器 + Host | **常驻**(无开关) | 实时 |
680
- | **中转访问服务** | **在互联网上的任何位置访问自己的 DSH Web**,而不只是在局域网内:登录 Codingns4DSH、管理 DSH 设备、绑定 Host,并建立独立的 DSH–Codingns4DSH 中继隧道——无需公网 IP、端口映射或 VPN,且**端到端加密(WebRTC/DTLS)** | **设置 → Codingns4DSH** | 浏览器 + Host | **关** | 实时 |
681
- | **工作区调试** | 按工作区保存启动配置、启动/停止、端口检查、HTTP 服务代理 | 右侧栏 **调试** 面板 | 浏览器 + Host | **开** | 实时 |
682
-
683
- 补充说明:
684
-
685
- - 插件安装后右侧栏终端就已经存在;**终端强化** 只是把它从基础本地 PTY 切换为持久后端(macOS/Linux 使用 tmux,Windows 使用 ConPTY broker),并解锁外观设置。
686
- - 需要重启的模块会先保存你的选择,界面上同时显示「当前生效状态」和「下次启动目标」。关闭 **终端强化** 不会结束已经存在的 tmux/ConPTY 会话。
687
- - **工作区调试** 是目前唯一界面文案只有中文的模块。
215
+ ### 可选:使用独立 Profile
688
216
 
689
- ### 功能详解
690
-
691
- #### 外部 Agent 集成
692
-
693
- Codingns4DSH 在 **Host 机器** 上通过 `PATH` 查找 Agent CLI,再从 CLI 自身读取版本、命令路径和模型列表。每个 Agent 都可以单独启停,检测到的 Agent 默认启用;内置的 **DeepSeek Harness** Agent 始终排在选择器第一位。
694
-
695
- 在输入框选择 Agent 和模型后,Codingns4DSH 会以 DSH 子进程方式启动(或恢复)该 CLI,并把事件流投影成 **DSH 原生会话**:
696
-
697
- - 流式回复、思考强度和工具调用使用 DSH 自身组件渲染;
698
- - 权限确认和 Agent 提问变成 DSH 原生交互;
699
- - Agent 支持时显示订阅/用量信息;
700
- - 支持追问、打断,以及支持的 Agent 的插话(steering);
701
- - 按 Agent 记住上次使用的模型和思考强度。
702
-
703
- 这样创建的会话和普通会话一样留在 DSH 侧栏中,并带有所用 Agent 的 Logo,可以从会话行恢复或归档(见下文「工作区会话增强」)。会话索引保存在 Host 上,不包含凭据和原始消息。
704
-
705
- Agent 的安装和登录都在 DSH **之外** 用各家自己的工具完成,Codingns4DSH 不保存 Agent 凭据。
706
-
707
- #### 工作区会话增强
708
-
709
- 启用模块后有三个互相独立的开关,默认全部开启:
710
-
711
- - **Agent Logo**:在外部会话行显示所用 CLI 的图标,便于区分会话来源。
712
- - **归档会话入口**:在存在已归档外部会话的工作区中提供恢复入口。
713
- - **订阅与用量**:在输入框底部显示可读取额度的 Agent(Command Code、Codex、Claude Code、OpenCode、Grok,以及配置了上游用量来源时的内置 DSH Agent)的用量;配置了第三方上游时显示上游用量,而不是错误地显示官方额度。
714
-
715
- #### 终端
716
-
717
- 插件自带完整的终端链路:DSH 协议的 Host 控制器、浏览器终端 UI 和 xterm.js。同一个 Bundle generation 会成对停用官方终端相关行,保证系统中只有一个终端服务和一套终端界面。
718
-
719
- - **绑定范围**:按工作区(默认,同一工作区内的多个 DSH 会话共享终端)或按 DSH 会话(每个会话独立终端)。
720
- - **持久化**:强化模式下,macOS/Linux 由 `tmux` 承载、Windows 由 ConPTY broker 承载,DSH 重启后会自动恢复;默认的基础模式使用本地 PTY,重启后不保留。
721
- - **Shell**:「系统推荐」由 Host 根据操作系统和已安装 Shell 解析;也可以显式选择 zsh、bash、PowerShell、cmd、Git Bash,且只允许 Host 上实际检测到的 Shell。
722
- - **外观**:继承 DSH 主题,或自定义背景色、前景色、光标颜色、字体、字号、行高、光标形状、光标闪烁和滚动缓冲区(1,000–100,000 行)。
723
- - **需要重启**:启用/停用模块以及修改绑定范围,都在重启 DSH 后生效,设置卡片会显示当前生效状态与下次启动目标。
724
-
725
- #### 局域网访问 DSH
726
-
727
- 当 Host 和其他设备在同一网络时使用:
728
-
729
- 1. 选择 **监听网卡**(全部网卡或指定网卡)和 **监听端口**(默认 `13080`);
730
- 2. 让 Codingns4DSH **自动探测本机 DSH Web 端口**,或手动填写;
731
- 3. 启动映射,然后在另一台设备打开 `http://<局域网 IP>:<监听端口>`。
732
-
733
- 模块还会在浏览器里补齐 `crypto.randomUUID`:明文 HTTP 的局域网来源不是安全上下文,部分浏览器不提供该 API。开启 **自动启动** 后,下次 DSH 启动会恢复该映射。这条链路只在你自己的局域网内,不经过中转服务。
734
-
735
- 如需保护 DSH Web,在 **登录保护** 模块中设置用户名、至少 8 位密码、会话超时时间,并选择局域网或中继访问范围。本机 `127.0.0.1` / `::1` 永远放行,避免本地配置错误导致无法进入 DSH。认证发生在 Host 的转发边界:未登录请求不会被转发到 DSH Web,上游 DSH 启动时生成的一次性认证 Cookie 也只由 Host 自动接管,不会暴露给浏览器。密码使用 `scrypt` 哈希并以当前用户可读写的 `0600` 文件保存;浏览器仅持有 `HttpOnly`、`SameSite=Strict` 会话 Cookie。
736
-
737
- #### 中转访问服务
738
-
739
- **中转服务突破局域网限制:让你在互联网上的任何位置打开自己的 DSH Web 界面。** 局域网访问只在其他设备与 Host 处于同一网络时可用;中转则把同一个 DSH Web 会话跨网络、跨 NAT、跨移动数据送达——在另一个办公室、另一座城市,或用手机蜂窝网络都没问题,不需要公网 IP、路由器端口映射或 VPN。
740
-
741
- 当无法直连时(跨网络、NAT、没有端口映射),或只是不在本机网络附近时使用:
742
-
743
- 1. 配置 **Control API 地址**(默认 `https://channel.codingns.com:1443`,可保存多个地址切换);
744
- 2. 使用 Codingns4DSH 账号 **登录**;
745
- 3. **刷新设备列表** 并选择目标 DSH 设备;
746
- 4. **绑定当前 Host**,面板会显示 Host 标签、公钥和指纹。
747
-
748
- 隧道是独立的 DSH–Codingns4DSH 设备通道:Host 的本地 DSH 端口不会暴露到互联网,只有你绑定过的 Host 才能被访问。网络要求只有两点——Host 能出站访问 Control API(HTTPS),以及你使用的设备能连上 Codingns4DSH 的中转入口。密码只用于登录请求,refresh token 和设备凭据保存在 Host 凭据存储中,不写入浏览器设置。隧道内的 DSH 流量**端到端加密(WebRTC/DTLS)**,Relay 只处理连接元数据,看不到 DSH 内容,详见 [端到端加密](#端到端加密中转服务看不到你的-dsh-内容)。
749
-
750
- #### 工作区调试
751
-
752
- 每个工作区一份启动配置,保存在 `<工作区>/.codingns/debug.json`:
753
-
754
- - **名称**、**工作目录**(工作区内相对路径)、**命令与参数**、**环境变量**(形似密钥的键会被拒绝)以及启动所用的 **Shell/运行时**;
755
- - 可选的 **端口**(命令预期监听的端口);
756
- - 可选的 **反向代理** 开关,把该端口通过 DSH 暴露出来。
757
-
758
- 在右侧栏 **调试** 面板中,你可以启动配置对应的命令(在终端里运行)、查看端口状态(每隔几秒检查一次)、停止运行中的实例(只结束监听配置端口的那个进程,不影响终端运行时),并通过每个实例独立、不可猜测的绑定地址打开代理后的服务。代理范围是刻意收窄的:只代理当前运行实例实际监听的端口,并且目前仅支持 HTTP,WebSocket 代理尚未实现。
759
-
760
- ### 支持的外部 Agent
761
-
762
- 每个 Agent 都按命令名在 Host 上检测,版本和模型列表从 CLI 自身读取。能力支持情况取决于该 Agent 的协议和版本。
763
-
764
- | Agent | 适配器 id | `PATH` 中的命令 | 协议 | 能力 |
765
- | --- | --- | --- | --- | --- |
766
- | Command Code | `command-code` | `command-code`、`commandcode`、`cmdc` | 单轮 CLI(`--session` + `-p`) | 模型、流式、恢复、打断、工具事件、思考强度、用量 |
767
- | Claude Code | `claude-code` | `claude` | stream-json | 模型、流式、恢复、打断、工具事件、思考强度、用量 |
768
- | Kimi CLI | `kimi` | `kimi`、`kimi-cli` | stream-json | 模型、流式、恢复、打断、工具事件、思考强度、用量、权限确认、提问、插话 |
769
- | Gemini CLI | `gemini` | `gemini` | ACP | 模型、流式、恢复、打断、工具事件、思考强度、用量、权限确认 |
770
- | Pi Agent | `pi` | `pi`、`pi-agent` | JSON-RPC | 模型、流式、恢复、打断、工具事件、思考强度、用量、插话 |
771
- | Codex | `codex` | `codex` | JSON-RPC(app-server) | 模型、流式、恢复、打断、工具事件、思考强度、用量、权限确认、提问、插话 |
772
- | OpenCode | `opencode` | `opencode`(或通过 `OPENCODE_SERVER_URL` 复用已有服务,默认 `http://127.0.0.1:4096`) | HTTP + SSE | 模型、流式、恢复、打断、工具事件、思考强度、用量、权限确认、提问 |
773
- | Grok Build | `grok` | `grok`、`grok-build` | ACP | 模型、流式、工具事件、思考强度、用量、权限确认 |
774
-
775
- 能力含义:
776
-
777
- - **模型**:读取并展示该 Agent 的模型列表;
778
- - **流式**:回复边生成边流入 DSH 会话;
779
- - **恢复**:DSH 重启后可以继续已有的 Agent 会话;
780
- - **打断**:可以取消正在进行的回合;
781
- - **工具事件**:工具调用与结果在对话中渲染;
782
- - **思考强度**:暴露并可选择思考/推理强度;
783
- - **用量**:显示 token 或订阅用量;
784
- - **权限确认 / 提问**:Agent 的权限请求和提问变成 DSH 原生交互;
785
- - **插话**:Agent 工作过程中可以追加消息。
786
-
787
- 未列出的能力表示该 CLI 或其当前版本不支持。内置的 **DeepSeek Harness** Agent 始终可用,不需要任何外部 CLI。
788
-
789
- ### 安装
790
-
791
- #### 环境要求
792
-
793
- | 要求 | 说明 |
794
- | --- | --- |
795
- | **DSH `>=0.1.5-rc.3 <0.1.7-0`** | 已在 `0.1.6-alpha.2` 上验证。插件与 DSH 版本独立发布,请保持在该范围内。 |
796
- | **Node.js `>= 22.19`** | `dsh` 启动器和本 Bundle 都依赖该版本。 |
797
- | **`PATH` 中有 `pnpm`** | `dsh plugin` 会转发给 pnpm;缺失时 DSH 会提示 `dsh: pnpm was not found`。 |
798
- | **受支持的 Agent CLI** | 仅在使用外部 Agent 时需要,请用各家官方方式安装并登录。 |
799
- | **`tmux`(可选)** | 只有 macOS/Linux 上的持久终端(终端强化)需要;Windows 使用内置 ConPTY broker。 |
800
-
801
- 安装 tmux:macOS `brew install tmux`,Debian/Ubuntu `sudo apt install tmux`,Fedora/RHEL `sudo dnf install tmux`。
802
-
803
- #### 从 npm 安装(推荐)
804
-
805
- DSH 把插件安装到 **Profile** 中。Codingns4DSH 需要 Profile 同时包含 DSH Web 应用层,因此先用官方 `web` 模板创建独立 Profile,再安装插件:
217
+ 如果不想修改内置的 `web` Profile,再创建一个独立 Profile。这里的 `--dump-config` 只用于初始化并检查 Profile,不是插件安装的必需步骤:
806
218
 
807
219
  ```bash
808
- # 1. 用官方 web 模板创建独立 Profile。
809
- # --dump-config 只创建 Profile 并打印合成后的层结构,不会启动服务。
810
220
  dsh codingns --from-default-profile web --dump-config
811
-
812
- # 2. 把 Codingns4DSH 安装进该 Profile。
813
- dsh plugin --profile codingns add @jingyi0605/codingns4dsh@0.1.0
814
-
815
- # 3. 使用该 Profile 启动 DSH。
221
+ dsh plugin --profile codingns add @jingyi0605/codingns4dsh@0.1.2
816
222
  dsh codingns
817
223
  ```
818
224
 
819
- 如果你不想单独维护一个 Profile,也可以直接装进标准的 `web` Profile:
225
+ - **不要**用 `dsh plugin --profile <新名字> add …` 创建需要 Web 界面的独立 Profile:该命令只会从 `@deepseek-ai/dsh-base` 初始化,之后会报 `entry "terminal-controller" not found`。需要独立 Profile 时,请使用上面的 `--from-default-profile web`。
226
+ - npm 返回 404 说明该版本还没发布,请改用下面的源码安装。
820
227
 
821
228
  ```bash
822
- dsh plugin --profile web add @jingyi0605/codingns4dsh@0.1.0
823
- dsh web
824
- ```
825
-
826
- 安装命令做了什么:
229
+ # 可选:验证安装结果
230
+ dsh plugin --profile web list --depth 0 # -> codingns4dsh <版本>
827
231
 
828
- - 在 `$DSH_HOME/profiles/<profile>`(默认 `~/.dsh/profiles/<profile>`)中执行 `pnpm add`;
829
- - 安装前会执行 DSH 版本门禁:读取当前 `dsh --version`,不在插件 `engines.dsh` 范围内时直接终止安装;
830
- - Profile 不存在时由 DSH 自动初始化;
831
- - 由于 `@jingyi0605/codingns4dsh` 声明了 Bundle patch,包名会被自动追加到 `dsh.profile.bundles`,下次启动即加载插件的 Host 层和浏览器层;
832
- - Codingns4DSH 的 Bundle patch 会在同一个 Bundle generation 中停用官方终端相关行并插入 Codingns4DSH 终端,保证只有一个终端服务。
833
-
834
- 安装后续版本时,把 `0.1.0` 替换为 [npm 包页面](https://www.npmjs.com/package/@jingyi0605/codingns4dsh) 上的目标版本,并保持在上表声明的 DSH 兼容范围内。
835
-
836
- > **如果 npm 返回 `@jingyi0605/codingns4dsh` 404**:说明该版本还没有发布到 registry。请改用 [从源码安装](#从源码安装备选),把本地检出目录装进 Profile,其余步骤完全相同。
837
-
838
- > **不要**把 `dsh plugin --profile codingns4dsh add …` 当作新 Profile 的第一条命令:全新的自定义 Profile 只包含 `@deepseek-ai/dsh-base`,没有 Web 应用层,终端 patch 找不到目标(会出现 `patch: entry "terminal-controller" not found`),也没有可打开的浏览器界面。请按上面的步骤先用 `web` 模板创建 Profile。
839
-
840
- #### 验证安装
841
-
842
- ```bash
843
- dsh --version # DSH 版本,必须在支持范围内
844
- dsh plugin --profile codingns list --depth 0 # 应显示 codingns4dsh 0.1.0
845
- dsh --profile codingns --dump-config # 打印合成后的插件树
846
- ```
847
-
848
- 在合成结果中确认两点:
849
-
850
- - 存在 `id: codingns4dsh` 条目(Bundle 层);
851
- - 在 `@jingyi0605/codingns4dsh` patch 层下 `id: terminal-controller` 标记为 `disabled: true`,并且 stderr 中没有 `patch: entry … not found` 警告。
852
-
853
- #### 升级、降级与卸载
854
-
855
- ```bash
856
- # 升级或固定到指定版本
857
- dsh plugin --profile codingns add @jingyi0605/codingns4dsh@<版本>
858
-
859
- # 卸载(Bundle 条目会自动从 Profile 中移除)
860
- dsh plugin --profile codingns remove codingns4dsh
232
+ # 升级、固定版本、卸载(之后重启 DSH)
233
+ dsh plugin --profile web add @jingyi0605/codingns4dsh@<版本>
234
+ dsh plugin --profile web remove @jingyi0605/codingns4dsh
861
235
  ```
862
236
 
863
- 更换版本后请重启 DSH。设置保存在 DSH 设置文档中,升级不会重置模块开关和个人偏好。
864
-
865
- #### 从源码安装(备选)
866
-
867
- 当 npm 包暂时不可用,或你希望直接运行本地检出时使用:
237
+ **从源码安装**(npm 不可用,或直接运行本地检出):
868
238
 
869
239
  ```bash
870
- git clone https://github.com/jingyi0605/Codingns4DSH.git
871
- cd Codingns4DSH
872
- pnpm install
873
- pnpm build
874
-
875
- # 先创建 Profile(见上文),再安装本地检出
876
- dsh codingns --from-default-profile web --dump-config
877
- dsh plugin --profile codingns add "$PWD"
878
- dsh codingns
240
+ git clone https://github.com/jingyi0605/Codingns4DSH.git && cd Codingns4DSH
241
+ pnpm install && pnpm build
242
+ dsh plugin --profile web add "$PWD" # 或 npm pack 后 add ./jingyi0605-codingns4dsh-0.1.2.tgz
243
+ dsh web
879
244
  ```
880
245
 
881
- 安装目录会创建链接依赖,Profile 直接使用检出目录的构建产物:修改源码后重新执行 `pnpm build`(或保持 `pnpm dev:watch` 运行)并重启 DSH 即可。
246
+ 安装目录是链接依赖,改完源码后重新 `pnpm build`(或保持 `pnpm dev:watch`)并重启 DSH。
882
247
 
883
- 如果希望使用可分发产物,也可以先打包再安装:
884
-
885
- ```bash
886
- npm pack # 通过 prepack 自动构建,生成 codingns4dsh-<版本>.tgz
887
- dsh plugin --profile codingns add ./jingyi0605-codingns4dsh-0.1.0.tgz
888
- ```
889
-
890
- #### 文件位置
248
+ **磁盘状态**:设置保存在 `$DSH_HOME/settings.yaml`(默认 `~/.dsh/settings.yaml`)的 `codingns:` 命名空间。
891
249
 
892
250
  | 路径 | 内容 |
893
251
  | --- | --- |
894
- | `$DSH_HOME/profiles/<profile>`(默认 `~/.dsh/profiles/<profile>`) | DSH Profile:已安装的插件包与 `dsh.profile.bundles`。 |
895
- | `$DSH_HOME/settings.yaml`(默认 `~/.dsh/settings.yaml`) | `codingns:` 命名空间下的插件设置:模块开关、Agent 启停、Agent 偏好、局域网映射、终端外观。 |
896
- | `$DSH_HOME/codingns4dsh/host-id` | 本机终端宿主标识(每个 Profile 生成一次)。 |
897
- | `$DSH_HOME/codingns4dsh/terminals.json` | 用于重启后恢复终端的持久映射。 |
898
- | `~/.config/codingns4dsh/codingns-credentials.json` | 中转 refresh token 与设备凭据;可用 `CODINGNS4DSH_STATE_DIR` 修改目录。 |
899
- | `<工作区>/.codingns/debug.json` | 工作区调试启动配置(权限 `0600`,拒绝保存密钥)。 |
900
-
901
- ### 首次使用
902
-
903
- 1. **启动 DSH**:`dsh codingns` 会在浏览器中打开 DSH Web 界面。
904
- 2. **打开 设置 → Codingns4DSH**:每个模块一张卡片,显示当前状态以及是否需要重启。
905
- 3. **外部 Agent**:在 DSH **之外** 安装并登录需要的 Agent CLI,确认命令在 Host 的 `PATH` 中(`which claude`、`which codex` 等)。卡片会列出每个 Agent 的检测状态、版本、命令路径和模型,按需启用。
906
- 4. **开始会话**:在输入框选择 Agent 和模型(支持时再选思考强度),发送消息。输出会流式写入 DSH 原生会话,并带着 Agent Logo 出现在侧栏。
907
- 5. **终端**:在右侧栏终端面板为当前工作区新建终端。若希望重启后仍然保留,请在设置卡片启用 **终端强化** 并重启 DSH。
908
- 6. **工作区调试**:打开右侧栏 **调试** 面板,为工作区新增启动配置(命令、工作目录、可选端口)并启动;Codingns4DSH 会报告端口状态,启用代理后还会给出服务访问地址。
909
- 7. **远程访问(可选)**:同一网络内的设备使用 [局域网访问](#局域网);若想**在互联网上的任何位置**打开同一个 DSH Web,请登录 [中转服务](#中转)。
910
-
911
- ### 远程访问
912
-
913
- Codingns4DSH 提供两条互相独立的远程通道,可以只启用其一,也可以同时启用:
914
-
915
- | | [局域网访问 DSH](#局域网) | [中转访问服务](#中转) |
916
- | --- | --- | --- |
917
- | 从哪里连接 | 同一局域网内的设备 | **任何设备、任何位置——只要能上互联网** |
918
- | 典型场景 | 家里或办公室的手机、平板、第二台电脑 | 不在 Host 身边、跨 NAT、蜂窝网络或公司网络 |
919
- | 前提条件 | Host 与设备在同一网络,防火墙放行监听端口 | Host 能出站访问 Codingns4DSH Control API(HTTPS),你的设备能连上 Codingns4DSH 中转入口 |
920
- | 是否需要账号 | 否 | 需要 Codingns4DSH 账号并绑定 Host |
921
- | 是否暴露本地端口 | 是——在所选网卡和端口上开放监听 | 否——流量走独立设备隧道 |
922
- | 到 Host 的链路 | 你自己网络内的直连 TCP | DSH–Codingns4DSH 中继隧道 |
923
-
924
- 一句话概括:**局域网访问让你留在本地网络,中转访问服务让你在互联网上的任何位置访问自己的 DSH Web 服务。**
925
-
926
- #### 局域网
927
-
928
- 在 **局域网访问 DSH** 卡片中:
929
-
930
- 1. 选择 **监听网卡**(最简单是全部网卡 `0.0.0.0`,也可指定具体网卡);
931
- 2. 选择 **监听端口**(默认 `13080`);
932
- 3. 自动探测或手动填写 **本机 DSH Web 端口**;
933
- 4. 启动后,在另一台设备打开 `http://<局域网 IP>:<监听端口>`。
934
-
935
- 注意事项:两台设备需要在同一网络,并放行 Host 防火墙上的监听端口;如果同时运行了多个 DSH 实例,自动探测会列出所有候选端口,需要手动选择。开启 **自动启动** 后,每次 DSH 启动都会恢复该映射。
936
-
937
- #### 中转
938
-
939
- **这是从本地网络之外访问 DSH 的通道**——只要能上互联网,无论远端设备处于哪个网络都可以。Host 不需要公网 IP、端口映射或 VPN,只需要能出站访问 Control API。
940
-
941
- 在 **中转访问服务** 卡片中:
942
-
943
- 1. 填写 **Control API 地址**(默认 `https://channel.codingns.com:1443`,可保存多个地址并切换);
944
- 2. 使用 Codingns4DSH 账号 **登录**;
945
- 3. **刷新设备列表** 并选择目标 DSH 设备;
946
- 4. **绑定当前 Host**,卡片会显示 Host 标签、公钥和指纹。
947
-
948
- 在远端设备上通过 Codingns4DSH 入口连接已绑定的 Host,即可像在本地一样使用 DSH Web——会话、终端和工作区都与本地一致,因为它们实际运行在 Host 上。
252
+ | `$DSH_HOME/profiles/<profile>` | 已安装的插件包与 `dsh.profile.bundles` |
253
+ | `$DSH_HOME/codingns4dsh/` | 终端 `host-id` 与 `terminals.json`(恢复映射) |
254
+ | `~/.config/codingns4dsh/` | 中转凭据、DTLS 身份、登录保护哈希 |
255
+ | `<工作区>/.codingns/debug.json` | 调试启动配置(`0600`,拒绝保存密钥) |
949
256
 
950
- 中转通过独立设备隧道承载 DSH Web 连接:Host 的本地端口不会暴露到互联网,只有你绑定过的 Host 才能被访问,凭据保存在 Host 上。
951
-
952
- #### 端到端加密:中转服务看不到你的 DSH 内容
953
-
954
- 中转链路在设计上就是端到端加密的,使用它并不意味着把对话内容交给服务器。DSH 的流量始终走在 **WebRTC DataChannel 中,由两端之间的 DTLS 保护**——一端是你远端浏览器里的 DSH Client,另一端是你机器上的 DSH Host。隧道不会把业务消息交给 Relay:
955
-
956
- - **控制站与 Relay 能处理什么**:账号与设备记录、Host 绑定、ticket、SDP/ICE 信令、在线状态和流量统计——只有控制面元数据。
957
- - **哪些内容端到端加密**:DSH RPC 与模型消息、Agent 输出、终端(PTY)输入输出、任务、文件内容、端口,以及远程 DSH Web 本身。无论两端是直连还是经由 TURN 中转,载荷都保持端到端加密——Relay 始终只转发密文。
958
- - **客户端会校验 Host 身份**:每个 Host 生成并保存自己的 DTLS 证书(`~/.config/codingns4dsh/dtls-identity.json`),并对外发布 SHA-256 指纹;远端在 WebRTC 握手阶段核对指纹,不一致会直接中断连接(`Host DTLS fingerprint 校验失败`),而不是默默接受被替换的证书。同一个指纹也会显示在中转设置卡片中,方便你人工比对。
959
- - **凭据留在 Host**:账号密码只用于登录请求;refresh token 和设备凭据保存在 Host 凭据存储中,不写入浏览器。
960
- - **诊断日志不记录内容**:隧道诊断只记录协议元数据(方向、消息类型、流 ID、状态、字节数),不记录 Envelope 正文、票据、Cookie 或 DSH Web 内容。
961
-
962
- 这些是隧道的设计硬门禁,而不只是实现细节:控制站与 Relay 只允许处理控制面元数据,Gateway 不得把业务消息交给 Relay,所有 DSH 业务消息必须在 DSH Client 与 DSH Host 之间端到端加密。
963
-
964
- #### 安全说明
965
-
966
- - 局域网访问只是你自己网络内的明文 TCP 转发,请只在可信网络中使用。
967
- - 中转链路端到端加密(WebRTC/DTLS):Relay 与控制站只能看到连接元数据,看不到你的 DSH 对话、终端输出或文件内容。
968
- - 中转隧道只有在你登录并绑定 Host 后才工作,退出登录即可断开。
969
- - Agent 凭据不经过 Codingns4DSH,各 CLI 继续使用自己的配置。
970
- - 隧道诊断日志不会记录 Envelope 正文、票据、Cookie 或 DSH Web 内容。
971
-
972
- ### 设置项参考
973
-
974
- 设置保存在 DSH 设置文档(`$DSH_HOME/settings.yaml`,默认 `~/.dsh/settings.yaml`)的 `codingns` 命名空间下。建议通过设置页面修改。
975
-
976
- | 设置项 | 含义 | 默认值 |
977
- | --- | --- | --- |
978
- | `modules.<模块名>` | 模块启用意图(`cliAdapters`、`workspaceSessionEnhancement`、`terminalEnhancement`、`reverseProxy`、`debug`)。 | 各模块自身默认值 |
979
- | `agentAdapters.<适配器 id>` | 单个 Agent 的启用意图。 | 检测到的 Agent 全部启用 |
980
- | `agentAdapterPreferences.<适配器 id>` | 每个 Agent 最近使用的模型和思考强度。 | 按 Agent 记忆 |
981
- | `cliSessions` | Host 侧外部会话索引(不含凭据和消息)。 | — |
982
- | `lanAccessDsh.autoStart` | DSH 启动时恢复局域网映射。 | `false` |
983
- | `lanAccessDsh.listenHost` / `listenPort` | 监听网卡与端口。 | `0.0.0.0` / `13080` |
984
- | `lanAccessDsh.dshPort` | 本机 DSH Web 端口,`0` 表示自动探测。 | `0` |
985
- | `lan-access-login.json` | 局域网登录保护的用户名、`scrypt` 哈希和盐;仅 Host 当前用户可读写。 | `~/.config/codingns4dsh/` |
986
- | `terminalEnhancement.bindingScope` | `workspace`(按工作区共享终端)或 `session`。 | `workspace` |
987
- | `terminalEnhancement.defaultProfile` | 新终端默认 Shell(`system`、`zsh`、`bash`、`powershell`、`cmd`、`git-bash`)。 | `system` |
988
- | `terminalEnhancement.appearance.*` | 主题、颜色、字体、光标、滚动缓冲区;`null` 表示继承 DSH。 | 继承 |
989
- | `workspaceSessionEnhancement.showAdapterLogo` / `showArchivedSessions` / `showSubscriptionUsage` | 会话行增强开关。 | `true` |
990
- | `controlBaseUrl` / `controlBaseUrls` | 中转 Control API 地址。 | `https://channel.codingns.com:1443` |
991
-
992
- ### 故障排查
993
-
994
- #### 先确认版本
995
-
996
- ```bash
997
- dsh --version
998
- dsh plugin --profile codingns list --depth 0
999
- npm view @jingyi0605/codingns4dsh version
1000
- ```
1001
-
1002
- 请保持 DSH 在 `>=0.1.5-rc.3 <0.1.7-0` 范围内。Bundle 的启动胶水会校验运行中的 DSH 版本,对不支持的宿主会拒绝接管连接;这时应升级或降级 DSH,而不是混用版本。
1003
-
1004
- 安装脚本和启动胶水都会拒绝不兼容版本:安装阶段由插件和 Profile 的 `preinstall` 检查
1005
- 当前 `dsh --version`,启动阶段由 Host、Client 和 Bootstrap 再次读取实际 DSH 版本并执行
1006
- `assertSupportedDshVersion()`。即使跳过包管理器脚本,插件也不会在不支持的 DSH 上启用。
1007
-
1008
- #### 出现 `patch: entry "terminal-controller" not found`
1009
-
1010
- 说明该 Profile 缺少 DSH Web 应用层,通常是因为自定义 Profile 是由插件安装命令本身创建的。请用 `web` 模板重建 Profile 后重新安装:
1011
-
1012
- ```bash
1013
- dsh codingns --from-default-profile web --dump-config
1014
- dsh plugin --profile codingns add @jingyi0605/codingns4dsh@0.1.0
1015
- ```
1016
-
1017
- #### 检测不到某个 Agent
1018
-
1019
- - 在 **Host 机器** 的终端里确认命令可用:`claude --version`、`codex --version`、`kimi --version` 等;
1020
- - 确认该命令位于 **启动 DSH 的那个进程** 的 `PATH` 中(图形界面启动器的 `PATH` 往往比 Shell 更短);
1021
- - 用各家自己的工具完成登录,Codingns4DSH 只负责启动它;
1022
- - 修改 `PATH` 或安装 CLI 后重启 DSH,再重新打开设置卡片。
257
+ ---
1023
258
 
1024
- #### 终端问题
259
+ ## 首次使用
1025
260
 
1026
- - macOS/Linux 的持久终端需要 `tmux`,缺失时设置卡片会把运行时标记为不可用;安装 tmux 后重启 DSH。
1027
- - 启用/停用 **终端强化** 以及修改绑定范围都需要重启 DSH 才能生效;卡片会同时显示当前生效状态和下次启动目标。
1028
- - 终端按工作区寻址;如果终端看起来属于另一个会话,请检查绑定范围设置。
261
+ 1. `dsh codingns` 打开 DSH Web 界面。
262
+ 2. 打开 **设置 → Codingns4DSH** 查看模块卡片(需重启的模块会同时显示当前生效状态与下次启动目标)。
263
+ 3. 在 DSH **之外** 安装并登录 Agent CLI,确保命令在 Host 的 `PATH` 中,然后在 **外部Agent集成** 中启用。
264
+ 4. 在输入框选择 Agent、模型和思考强度并发送消息——输出流式写入原生会话,并带 Agent Logo 出现在侧栏。
265
+ 5. 右侧栏:终端面板为当前工作区开终端(要持久化请启用 **终端强化** 后重启);**调试** 面板添加启动配置并查看端口。
266
+ 6. 需要远程使用时,开启 **登录保护**、配置 **局域网访问DSH**,或登录 **中转访问服务** 从任意网络访问;账户入口会显示当前访问路径与 Host 负载。
1029
267
 
1030
- #### 局域网访问连不上
268
+ ---
1031
269
 
1032
- - 确认监听已启动:卡片会显示 `转发:<host>:<port> → DSH Web 127.0.0.1:<dshPort>`;
1033
- - 放行 Host 防火墙上的监听端口,并确认两台设备在同一网络且能访问 Host 的 IP;
1034
- - 自动探测不到端口时,先启动 DSH Web,再手动填写 DSH 端口。
270
+ ## 故障排查
1035
271
 
1036
- #### 中转登录或绑定失败
272
+ - **版本** —— `dsh --version`、`dsh plugin --profile web list --depth 0`(独立 Profile 请替换 `web`)、`npm view @jingyi0605/codingns4dsh version`;安装与启动都会拒绝范围外的 DSH。
273
+ - **`patch: entry "terminal-controller" not found`** —— Profile 缺少 Web 应用层,按上文用 `web` 模板重建。
274
+ - **检测不到 Agent** —— 在 Host 上执行 `<cli> --version`;确认其目录在启动 DSH 的进程的 `PATH` 中(图形启动器常不同);用各家工具登录后重启 DSH。
275
+ - **终端** —— macOS/Linux 持久模式需要 `tmux`;启停模块与修改绑定范围需重启;终端按工作区寻址。
276
+ - **局域网** —— 确认卡片转发信息、防火墙放行、两台设备同网络;多个 DSH 实例时手动选择探测到的端口;开启登录保护后需先登录。
277
+ - **中转** —— 检查 Control API 可达性,会话过期则重新登录,刷新设备后绑定 Host。
278
+ - **日志** —— 默认不输出调试日志;需要排查启动或 RPC 时使用 `CODINGNS4DSH_DEBUG=1 dsh --profile stage0 --no-open`。旧变量 `CODINGNS4DSH_TUNNEL_DEBUG=1` 仍兼容;pnpm 安装日志在 `$DSH_HOME/profiles/<profile>/.plugin-manager/logs/`。
279
+ - **反馈** —— 附上 DSH 与 Codingns4DSH 版本、操作系统、涉及模块和完整错误:[GitHub Issues](https://github.com/jingyi0605/Codingns4DSH/issues) 或 QQ **1092985965**。
1037
280
 
1038
- - 检查 Control API 地址,以及 Host 能否通过 HTTPS 访问它;
1039
- - 会话过期时重新登录,然后刷新设备列表;
1040
- - 需要先绑定 Host,隧道才会接受连接;卡片会显示已绑定 Host 的标签和指纹。
281
+ ---
1041
282
 
1042
- #### 诊断日志
283
+ ## 开发
1043
284
 
1044
- 隧道诊断默认关闭,可以通过环境变量开启:
285
+ 需要 Node `>= 22.19` 与 pnpm:
1045
286
 
1046
287
  ```bash
1047
- CODINGNS4DSH_TUNNEL_DEBUG=1 dsh codingns --no-open
288
+ pnpm install
289
+ pnpm build # 版本校验 → tsc → Client + H5 Bundle
290
+ pnpm test # 构建后运行 61 个测试套件
291
+ pnpm typecheck
292
+ pnpm run capability:check # DSH 能力注册表退休检查
1048
293
  ```
1049
294
 
1050
- 诊断记录包含连接方向、消息类型、流 ID、操作、作用域、状态和字节数;不会记录 Envelope 正文、票据、Cookie 或 DSH Web 内容。插件安装(pnpm)日志位于 `$DSH_HOME/profiles/<profile>/.plugin-manager/logs/`。
1051
-
1052
- #### 反馈问题
1053
-
1054
- 请附上 DSH 版本、Codingns4DSH 版本、操作系统、使用的模块、期望结果、实际结果和完整错误信息。反馈渠道:[GitHub Issues](https://github.com/jingyi0605/Codingns4DSH/issues) 或 QQ 群 **1092985965**。
295
+ 开发循环:`pnpm dev:watch` 配合 `pnpm dev:link <profile>`,然后重启 DSH。版本源是 `version.json`(`version:set-plugin` / `version:set-dsh`,由 `version:check` 守卫)。
1055
296
 
1056
- ### 路线图
297
+ 目录:`src/host`(Host 层)、`src/client`(浏览器层)、`src/dsh-capabilities`(DSH 能力注册与版本路由)、`src/shared/contracts`、`src/transport`(隧道与 WebRTC)、`src/features`(模块注册表)、`tests/`、`specs/`、`docs/`、`data/build`(已忽略)。
1057
298
 
1058
- 以下为后续版本的规划,属于设计目标而非当前版本的承诺:
299
+ 推送 `v*` tag 触发 GitHub Actions(tag/版本校验、冻结安装、类型检查、测试、`npm pack`)并以 provenance 发布,预发布版本用 `next` dist-tag。路线图:PeerHost、文件管理、工作区会话、调试代理完善(鉴权 + WebSocket)、Git、SKILL、更多。
1059
300
 
1060
- - **PeerHost**:Host 之间的直接资源发现与协作。
1061
- - **文件管理功能增强**:工作区内浏览、搜索、上传、下载和常用文件操作。
1062
- - **工作区会话功能增强**:更深入的会话组织、筛选、元数据和跨设备同步。
1063
- - **调试服务反向代理完善**:在现有仅 HTTP 代理的基础上加入鉴权绑定与 WebSocket 支持。
1064
- - **GIT 管理**:仓库状态、分支、提交、差异和常用 Git 操作。
1065
- - **SKILL 管理**:发现、安装、启用、停用和更新可复用的 Agent 技能。
1066
- - **更多**:由社区反馈驱动的其他工作区自动化与协作模块。
301
+ 截图素材与清单见 [assets/screenshots](assets/screenshots/README.md)。
1067
302
 
1068
- ### 开发
303
+ **英文版:[README.en.md](README.en.md)**
1069
304
 
1070
- 环境要求:Node.js `>= 22.19` 与 pnpm。
1071
-
1072
- ```bash
1073
- pnpm install
1074
- pnpm build # 版本校验 → tsc → Client Bundle → H5 Bundle
1075
- pnpm test # 先构建,再运行 node --test tests/*.spec.ts
1076
- pnpm typecheck # tsc --noEmit
1077
- ```
1078
-
1079
- 常用脚本:
305
+ ---
1080
306
 
1081
- | 脚本 | 作用 |
1082
- | --- | --- |
1083
- | `pnpm build` | 清理 `data/build/`,产出 TypeScript、浏览器 Client Bundle 和 H5 入口。 |
1084
- | `pnpm test` | 完整构建并运行 `tests/` 下的测试。 |
1085
- | `pnpm dev:link <profile>` | 把当前检出目录软链到 `$DSH_HOME/profiles/<profile>/node_modules`。 |
1086
- | `pnpm dev:watch` | 监听并增量构建;构建后重启 DSH 即可看到效果。 |
1087
- | `pnpm run version:check` | 校验 `version.json`、源码与清单中的版本一致。 |
1088
- | `pnpm run version:set-plugin -- <版本>` | 更新插件版本。 |
1089
- | `pnpm run version:set-dsh -- <版本> [兼容范围]` | 更新已验证的 DSH 版本与兼容范围。 |
307
+ ## 鸣谢
1090
308
 
1091
- 目录结构:
309
+ Codingns4DSH 的项目灵感与部分实现思路来自 **[CodexHost](https://github.com/BytePioneer-AI/codex-host)**——它把 Pi、Claude Code、Grok Build 等 Harness 原生跑在 Codex Desktop 里,展示了 Codingns4DSH 从另一侧沿用的方向:**把其他 Harness 作为一等 Agent 接入**,而不是替换它们。多 Harness 适配器模型、把 CLI 事件流投影为宿主原生会话、让每个 Agent 的会话留在宿主侧栏与输入框,都源自该项目的设计。感谢其作者与社区。
1092
310
 
1093
- | 路径 | 内容 |
1094
- | --- | --- |
1095
- | `src/host/` | Host 层:Agent 适配器、终端控制器、局域网监听、登录、中继/设备运行时、调试服务、RPC 表。 |
1096
- | `src/client/` | 浏览器层:设置卡片、终端 UI、输入框插槽、会话行增强、调试面板、多语言与主题。 |
1097
- | `src/shared/contracts/` | 两端共用的版本、设置、功能模块、Agent、终端与调试契约。 |
1098
- | `src/features/` | 功能模块注册表:依赖排序、状态迁移与资源释放。 |
1099
- | `src/transport/` | DSH Transport/Tunnel:Envelope、分帧、多路复用、WebRTC 承载与诊断。 |
1100
- | `tests/` | 58 个测试套件,覆盖契约、模块、终端后端、传输与浏览器行为。 |
1101
- | `specs/`、`docs/` | 设计记录以及模块/界面开发规范。 |
1102
- | `profile/` | Codingns4DSH 桌面壳使用的参考 Profile,只选择 Codingns4DSH Bundle。 |
1103
- | `data/build/` | 构建产物(已被 git 忽略,由 `pnpm build` 生成)。 |
1104
-
1105
- 发布流程:推送 `v*` tag 会触发 GitHub Actions,校验 tag 与 `version.json`、使用冻结锁文件安装、执行类型检查与测试、检查打包内容,并以 provenance 方式发布到 npm(预发布版本使用 `next` dist-tag)。
1106
-
1107
- ### 社区与反馈
1108
-
1109
- - QQ 讨论群:**1092985965**
1110
- - 代码仓库:[github.com/jingyi0605/Codingns4DSH](https://github.com/jingyi0605/Codingns4DSH)
1111
- - npm 包:[`@jingyi0605/codingns4dsh`](https://www.npmjs.com/package/@jingyi0605/codingns4dsh)
1112
- - 问题与建议:[GitHub Issues](https://github.com/jingyi0605/Codingns4DSH/issues)
1113
-
1114
- 反馈问题时请附上 DSH 版本、Codingns4DSH 版本、操作系统、启用的模块和完整错误信息。
311
+ Codingns4DSH 是独立项目,与 CodexHost 无隶属关系。