dsh-code 0.5.0 → 0.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.en.md +219 -0
- package/README.md +148 -137
- package/bin/deepseek.mjs +38 -3
- package/lib/devtools-CdTl3MNy.mjs +3643 -0
- package/lib/index.mjs +26440 -499
- package/lib/rolldown-runtime-CMFfr-1z.mjs +26 -0
- package/lib/types/app.d.ts +10 -0
- package/lib/types/history.d.ts +79 -0
- package/lib/types/kernel-panels.d.ts +25 -0
- package/lib/types/render/animations.d.ts +10 -1
- package/lib/types/render/inspector.d.ts +2 -0
- package/lib/types/render/projection.d.ts +31 -8
- package/lib/types/render/status.d.ts +129 -14
- package/package.json +117 -117
- package/src/app.ts +2543 -2205
- package/src/history.ts +136 -0
- package/src/index.ts +253 -52
- package/src/kernel-panels.ts +168 -3
- package/src/render/animations.ts +14 -1
- package/src/render/export.ts +4 -0
- package/src/render/inspector.ts +12 -3
- package/src/render/lines.ts +21 -10
- package/src/render/projection.ts +82 -15
- package/src/render/status.ts +520 -66
- package/src/whale-glyph.ts +23 -23
- package/README.zh.md +0 -204
package/src/whale-glyph.ts
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
// GENERATED by scripts/gen-whale-glyph.ts — do not edit by hand. Rerun the
|
|
2
|
-
// generator after changing the FishLogo path. Half-block rendering of the
|
|
3
|
-
// DeepSeek fish logo (figma I39:24057;88:8943 fillGeometry, exact extract;
|
|
4
|
-
// native 23.16x17.04 → 26 columns × 8 half-block rows).
|
|
5
|
-
// Blank cells are part of the glyph's fixed 26-column grid: pad, never trim.
|
|
6
|
-
|
|
7
|
-
/** Half-block whale glyph rows; render with the brand color. */
|
|
8
|
-
export const WHALE_GLYPH: readonly string[] = [
|
|
9
|
-
' ▄▄▄▄▄▄▄▄█ ▄█▄ ▄',
|
|
10
|
-
' ▄▄██████████▄▄ ▀███▄████',
|
|
11
|
-
'▄███████████████▄ ███▀▀▀ ',
|
|
12
|
-
'██ ▀▀█████▄▀██████ ',
|
|
13
|
-
'██▄ ▀████▄▄████ ',
|
|
14
|
-
' ██▄ ▀██████▀ ',
|
|
15
|
-
' ▀██▄▄ ██▄ ▀███▄▄ ',
|
|
16
|
-
' ▀▀███████▀▀ ▀▀▀ ',
|
|
17
|
-
]
|
|
18
|
-
|
|
19
|
-
/** Fixed glyph width in terminal columns. */
|
|
20
|
-
export const WHALE_GLYPH_COLUMNS = 26
|
|
21
|
-
|
|
22
|
-
/** Fixed glyph height in half-block rows. */
|
|
23
|
-
export const WHALE_GLYPH_ROWS = 8
|
|
1
|
+
// GENERATED by scripts/gen-whale-glyph.ts — do not edit by hand. Rerun the
|
|
2
|
+
// generator after changing the FishLogo path. Half-block rendering of the
|
|
3
|
+
// DeepSeek fish logo (figma I39:24057;88:8943 fillGeometry, exact extract;
|
|
4
|
+
// native 23.16x17.04 → 26 columns × 8 half-block rows).
|
|
5
|
+
// Blank cells are part of the glyph's fixed 26-column grid: pad, never trim.
|
|
6
|
+
|
|
7
|
+
/** Half-block whale glyph rows; render with the brand color. */
|
|
8
|
+
export const WHALE_GLYPH: readonly string[] = [
|
|
9
|
+
' ▄▄▄▄▄▄▄▄█ ▄█▄ ▄',
|
|
10
|
+
' ▄▄██████████▄▄ ▀███▄████',
|
|
11
|
+
'▄███████████████▄ ███▀▀▀ ',
|
|
12
|
+
'██ ▀▀█████▄▀██████ ',
|
|
13
|
+
'██▄ ▀████▄▄████ ',
|
|
14
|
+
' ██▄ ▀██████▀ ',
|
|
15
|
+
' ▀██▄▄ ██▄ ▀███▄▄ ',
|
|
16
|
+
' ▀▀███████▀▀ ▀▀▀ ',
|
|
17
|
+
]
|
|
18
|
+
|
|
19
|
+
/** Fixed glyph width in terminal columns. */
|
|
20
|
+
export const WHALE_GLYPH_COLUMNS = 26
|
|
21
|
+
|
|
22
|
+
/** Fixed glyph height in half-block rows. */
|
|
23
|
+
export const WHALE_GLYPH_ROWS = 8
|
package/README.zh.md
DELETED
|
@@ -1,204 +0,0 @@
|
|
|
1
|
-
# DSH-Code
|
|
2
|
-
|
|
3
|
-
[English](README.md) | 中文
|
|
4
|
-
|
|
5
|
-
<p align="center"><img alt="Typing SVG" src="https://readme-typing-svg.herokuapp.com?font=JetBrains+Mono&weight=500&size=22&duration=4000&pause=700&color=4176E6&center=true&vCenter=true&width=680&lines=DeepSeek+Harness+Code;DSH+%E5%86%85%E6%A0%B8%E7%9A%84%E7%BB%88%E7%AB%AF%E7%BC%96%E7%A0%81%E7%95%8C%E9%9D%A2"></p>
|
|
6
|
-
<p align="center">
|
|
7
|
-
<a href="https://github.com/deepseek-ai/deepseek-harness"><img alt="DeepSeek Harness" src="https://img.shields.io/badge/DeepSeek-Harness-4176E6?style=for-the-badge&logo=deepseek&logoColor=white&labelColor=1c1917"></a>
|
|
8
|
-
<a href="https://github.com/UNLINEARITY/dsh-code/stargazers"><img alt="GitHub stars" src="https://img.shields.io/github/stars/UNLINEARITY/dsh-code?label=Stars&style=for-the-badge&logo=github&logoColor=white&color=4176E6&labelColor=1c1917"></a>
|
|
9
|
-
<a href="https://www.npmjs.com/package/dsh-code"><img alt="npm version" src="https://img.shields.io/npm/v/dsh-code?label=npm&style=for-the-badge&logo=npm&color=cb3837&labelColor=1c1917"></a>
|
|
10
|
-
<a href="https://github.com/UNLINEARITY/dsh-code/blob/main/LICENSE"><img alt="License" src="https://img.shields.io/github/license/UNLINEARITY/dsh-code?label=License&style=for-the-badge&logo=opensourceinitiative&color=4176E6&labelColor=1c1917"></a>
|
|
11
|
-
</p>
|
|
12
|
-
|
|
13
|
-
<p align="center"><img src="docs/pictures/1.png" width="95%" alt="带斜杠命令补全的 DSH-Code 终端"></p>
|
|
14
|
-
|
|
15
|
-
**DSH-Code 是 [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness)(`dsh`)的终端编码界面。** 它以树外 bundle 的形式组合在官方 `@deepseek-ai/dsh-base` 之上,与 Harness Web UI 使用同一套 Agent、Session、工具、命令、技能、权限、sandbox、上下文压缩与插件服务。
|
|
16
|
-
|
|
17
|
-
DSH-Code 没有另外实现一套 Agent loop,而是在 DSH 运行时上增加面向编码工作的 TUI。会话处理参考 [Codex CLI](https://github.com/openai/codex),终端交互参考 [Claude Code](https://code.claude.com/docs/en/overview)。
|
|
18
|
-
|
|
19
|
-
---
|
|
20
|
-
|
|
21
|
-
## 项目概览
|
|
22
|
-
|
|
23
|
-
DeepSeek Harness 将模型、工具、存储、策略和界面作为插件,通过 Cordis 注册。持久化会话事件记录恢复对话与运行状态所需的信息。
|
|
24
|
-
|
|
25
|
-
DSH-Code 保留这套结构,并补充适合编码任务的终端工作流。
|
|
26
|
-
|
|
27
|
-
| 参考项目 | DSH-Code 使用的机制 |
|
|
28
|
-
| --- | --- |
|
|
29
|
-
| **DeepSeek Harness** | 插件组合、作用域服务、Agent Preset、持久会话、工具、技能、策略、sandbox 与委派 |
|
|
30
|
-
| **Codex CLI** | 会话导航、有界浮层、历史检查、稳定底部布局与缩放处理 |
|
|
31
|
-
| **Claude Code** | 斜杠命令发现、思考折叠、审批、提问与 turn steering |
|
|
32
|
-
|
|
33
|
-
界面采用开发者熟悉的终端操作方式,运行行为仍由 DSH 服务和配置决定。
|
|
34
|
-
|
|
35
|
-
## 快速开始
|
|
36
|
-
|
|
37
|
-
需要 Node `^22.19 || >=24`、预览版 `dsh` CLI,以及 `DEEPSEEK_API_KEY`。
|
|
38
|
-
|
|
39
|
-
```sh
|
|
40
|
-
npm install -g @deepseek-ai/dsh@next dsh-code
|
|
41
|
-
npm install -g pnpm
|
|
42
|
-
dsh plugin --profile cli add dsh-code
|
|
43
|
-
```
|
|
44
|
-
|
|
45
|
-
可用的启动指令:
|
|
46
|
-
```sh
|
|
47
|
-
deepseek
|
|
48
|
-
dsh --profile cli
|
|
49
|
-
dsh-code
|
|
50
|
-
```
|
|
51
|
-
|
|
52
|
-
`dsh --profile cli`、`deepseek` 与 `dsh-code` 是并列的启动命令。`deepseek` 与 `dsh-code` 都是 `dsh --profile cli` 的全局别名,后续参数会原样转发,例如 `deepseek --resume abc123`。
|
|
53
|
-
|
|
54
|
-
### 源码开发安装
|
|
55
|
-
|
|
56
|
-
本地 checkout 可使用:
|
|
57
|
-
|
|
58
|
-
```sh
|
|
59
|
-
dsh plugin --profile cli add file:C:/path/to/dsh-code
|
|
60
|
-
```
|
|
61
|
-
|
|
62
|
-
GitHub 安装可用于源码开发:
|
|
63
|
-
|
|
64
|
-
```sh
|
|
65
|
-
dsh plugin --profile cli add github:unlinearity/dsh-code
|
|
66
|
-
```
|
|
67
|
-
|
|
68
|
-
Git 包会在安装阶段构建。若 pnpm 要求添加 `allowBuilds`,请把它输出的完整条目复制到 `~/.dsh/profiles/cli/pnpm-workspace.yaml`,再重新执行命令。该键包含 Git URL 与 commit,不能只写 `dsh-code`。
|
|
69
|
-
|
|
70
|
-
> DeepSeek Harness 目前仍处于 developer preview,可能出现破坏兼容性的变化;DSH-Code 会持续跟随其插件接口演进。
|
|
71
|
-
|
|
72
|
-
安装、原生模块和插件加载问题,请查看[常见问题与排障](docs/problems.md)。
|
|
73
|
-
|
|
74
|
-
## DSH-Code 如何接入 DSH
|
|
75
|
-
## 终端交互
|
|
76
|
-
|
|
77
|
-
DSH-Code 在整个进程中只保留一个 Ink owner。`/new` 和 `/resume` 替换的是活动 Agent,而不是终端本身。若 Agent 忙碌,切换会等待当前 turn 自然结束;最新请求优先,目标加载失败也不会破坏当前会话。
|
|
78
|
-
|
|
79
|
-
所有动态内容都受到明确的视口约束。流式输出、思考过程、审批、问题、`/help`、`/model`、`/mode`、`/resume`、`/plugin` 与 Ctrl+O 使用统一的终端预算。输入框始终紧贴状态栏上方;终端宽度稳定后,界面会根据保存的会话记录重新绘制一次。
|
|
80
|
-
|
|
81
|
-
在第一次 turn 之前使用 `/mode`,查看或选择当前会话的 Agent Preset。
|
|
82
|
-
|
|
83
|
-
<p align="center"><img src="docs/pictures/2.png" width="95%" alt="每会话 Agent Preset 选择器"></p>
|
|
84
|
-
|
|
85
|
-
使用 `/resume` 搜索持久会话,无需重新启动 TUI。
|
|
86
|
-
|
|
87
|
-
<p align="center"><img src="docs/pictures/3.png" width="95%" alt="可搜索的会话恢复选择器"></p>
|
|
88
|
-
|
|
89
|
-
### 运行时组合
|
|
90
|
-
|
|
91
|
-
DSH-Code 读取 Harness 的实时注册表,不在本地维护另一套副本。模型适配器、工具 provider、技能来源、命令、权限策略、持久化后端、sandbox 和 subagent provider 都可以通过 DSH composition 添加或替换。
|
|
92
|
-
|
|
93
|
-
`/plugin` 提供当前 Cordis loader 状态的只读视图。
|
|
94
|
-
|
|
95
|
-
### 会话级 Agent Preset
|
|
96
|
-
|
|
97
|
-
Host 持有共享基础设施——注册表、持久化、会话查询、权限和 sandbox 策略;每个会话则获得一个隔离的 Agent scope,并由 **Agent Preset** 进行组合:
|
|
98
|
-
|
|
99
|
-
- `standard`——功能完整的通用编码 Agent
|
|
100
|
-
- `code`——面向 Code Mode / PTC 的多操作工作流
|
|
101
|
-
- `minimal`——只保留持久 shell 和 `str_replace_editor`
|
|
102
|
-
- `cordis`——完整 Agent,加上运行时检查与 Preset 编写指导
|
|
103
|
-
- 用户预设——自行定义工具、提示词段落、技能、上下文压缩、plan mode 与 subagent 行为
|
|
104
|
-
|
|
105
|
-
在第一次 turn 之前使用 `/mode`,或通过 `--mode <preset>` 直接启动。选中的 preset 会写入会话,并在恢复时还原。
|
|
106
|
-
|
|
107
|
-
### 会话记录与恢复
|
|
108
|
-
|
|
109
|
-
提示词、流式 chunk、工具调用与结果、模型选择、plan 状态、权限、标题和 preset 选择都由持久 Session 事件投影得到。会话恢复、导出、历史检查、上下文统计和终端重放使用同一份记录。
|
|
110
|
-
|
|
111
|
-
React state 只保存输入草稿、光标、当前面板、选中项和滚动位置等临时界面状态。
|
|
112
|
-
|
|
113
|
-
```text
|
|
114
|
-
dsh profile
|
|
115
|
-
└─ Host plane:注册表 · 持久化 · 查询 · 权限 · sandbox
|
|
116
|
-
├─ Agent 会话 A + preset code
|
|
117
|
-
├─ Agent 会话 B + preset minimal
|
|
118
|
-
└─ DSH-Code TUI
|
|
119
|
-
持久事件 → 纯投影 → 只追加的历史转录
|
|
120
|
-
└→ 有界面板 → 输入框 → 状态栏
|
|
121
|
-
```
|
|
122
|
-
|
|
123
|
-
## 常用命令
|
|
124
|
-
|
|
125
|
-
```sh
|
|
126
|
-
dsh --profile cli # 新建 standard 会话
|
|
127
|
-
dsh --profile cli --mode code # 使用 Agent Preset 启动
|
|
128
|
-
dsh --profile cli --continue # 恢复当前目录最新会话
|
|
129
|
-
dsh --profile cli --resume abc123 # 按 id 或唯一前缀恢复持久会话
|
|
130
|
-
dsh --profile cli --session my-id # 使用指定 id 新建会话
|
|
131
|
-
```
|
|
132
|
-
|
|
133
|
-
进入 TUI 后:
|
|
134
|
-
|
|
135
|
-
| 操作 | 用途 |
|
|
136
|
-
| --- | --- |
|
|
137
|
-
| `/new [preset]` | 不重启终端,创建并进入另一个会话 |
|
|
138
|
-
| `/resume [id\|前缀]` | 搜索根会话或全部对话,并按 cwd、排序和密度筛选 |
|
|
139
|
-
| `/mode [preset]` | 检查或选择空会话的 Agent 组合 |
|
|
140
|
-
| `/model` | 在实时 LLM 注册表提供的模型间切换 |
|
|
141
|
-
| `/plugin [query]` | 检查 loader 条目、启用状态、模块身份和 fiber 阶段 |
|
|
142
|
-
| `/permission <name>` | 切换权限预设;Shift+Tab 可循环切换 |
|
|
143
|
-
| `/help` | 浏览本地命令、Harness 命令、技能和快捷键 |
|
|
144
|
-
| `Ctrl+O` | 打开独占历史详情视图,切换条目并滚动完整内容 |
|
|
145
|
-
| `Ctrl+R` | 折叠或展开模型思考过程 |
|
|
146
|
-
| `@` | 引用工作区文件或持久会话的有界快照 |
|
|
147
|
-
| `Esc` / `Ctrl+C` | 关闭最上层界面或中断当前 turn |
|
|
148
|
-
|
|
149
|
-
## 功能
|
|
150
|
-
|
|
151
|
-
### Agent 与扩展
|
|
152
|
-
|
|
153
|
-
- 每会话 Agent Preset:组合工具、提示词、技能、上下文压缩、plan mode 与委派能力
|
|
154
|
-
- 从共享 Harness 注册表实时发现斜杠命令和用户技能
|
|
155
|
-
- 通过 `/plugin` 只读诊断 Cordis loader
|
|
156
|
-
- 从实时 LLM 注册表路由模型,并按持久会话恢复选择
|
|
157
|
-
- 支持 plan、goal、todo、权限、sandbox、subagent 与运行中 steering
|
|
158
|
-
|
|
159
|
-
### 会话与上下文
|
|
160
|
-
|
|
161
|
-
- `/new`、`/resume`、`--continue` 与显式 session id,且无需重新挂载 Ink
|
|
162
|
-
- Codex 风格可搜索恢复面板,支持根/全部对话、cwd、排序和密度筛选
|
|
163
|
-
- 标题快照按需折叠,完整转录仅在显式请求时加载并支持全量滚动
|
|
164
|
-
- subagent 对话只读检查,以及通过 `@` 注入有界会话引用
|
|
165
|
-
- Markdown 导出、持久标题、上下文占用、缓存、token、TTFT 与耗时指标
|
|
166
|
-
|
|
167
|
-
### 审批与交互
|
|
168
|
-
|
|
169
|
-
- sandbox 升级与 hook `ask` 决策的一次性工具审批条
|
|
170
|
-
- 结构化 `ask_user_question` 与 plan review 菜单,支持多选和自定义答案
|
|
171
|
-
- 在下一个 step 边界进行 turn steering,并提供明确的中断语义
|
|
172
|
-
- Agent mode、plan、权限 preset、goal 与 sandbox 状态相互独立
|
|
173
|
-
|
|
174
|
-
### 终端渲染
|
|
175
|
-
|
|
176
|
-
- 已落定历史只追加,流式可变区域严格有界
|
|
177
|
-
- 思考折叠、终端 Markdown、紧凑工具摘要与完整结构化详情
|
|
178
|
-
- Ctrl+O 独占历史检查,支持切换条目与完整纵向滚动
|
|
179
|
-
- CJK/控制字符宽度安全、短终端主动降级、缩放防抖重放
|
|
180
|
-
- 固定底部顺序:内容或面板 → notice → 输入框 → 状态栏
|
|
181
|
-
|
|
182
|
-
## 参考
|
|
183
|
-
|
|
184
|
-
- 运行时服务、事件、插件作用域和持久化模型遵循 **DeepSeek Harness**。
|
|
185
|
-
- 会话导航、浮层尺寸、scrollback、底部布局与缩放处理参考 **Codex CLI**。
|
|
186
|
-
- 斜杠发现、turn steering、思考折叠、审批和提问流程参考 **Claude Code**。
|
|
187
|
-
|
|
188
|
-
DSH-Code 是独立的 MIT 社区项目,与 OpenAI 或 Anthropic 无隶属关系。
|
|
189
|
-
|
|
190
|
-
## 开发
|
|
191
|
-
|
|
192
|
-
```sh
|
|
193
|
-
pnpm install
|
|
194
|
-
pnpm test
|
|
195
|
-
pnpm typecheck
|
|
196
|
-
pnpm build
|
|
197
|
-
pnpm run gen:whale # 从 vendored Logo 路径重新生成 src/whale-glyph.ts
|
|
198
|
-
```
|
|
199
|
-
|
|
200
|
-
鲸鱼字形由 `scripts/fish-logo.ts` 中 vendored 的 DeepSeek FishLogo 几何数据生成(来源:DeepSeek Harness,MIT)。
|
|
201
|
-
|
|
202
|
-
## 许可
|
|
203
|
-
|
|
204
|
-
[MIT](LICENSE)。vendored FishLogo 几何数据来自 DeepSeek Harness(MIT)。
|