dsh-ssh-tui 0.3.0 → 0.3.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.
- package/README.en.md +87 -40
- package/README.md +71 -31
- package/cordis.patch.yml +2 -0
- package/docs/screenshots/compare.png +0 -0
- package/docs/screenshots/headless.png +0 -0
- package/docs/screenshots/workspace.png +0 -0
- package/lib/index.js.map +1 -1
- package/lib/reasoning.js +5 -3
- package/lib/reasoning.js.map +1 -1
- package/lib/subagent-model.js +82 -2
- package/lib/subagent-model.js.map +1 -1
- package/lib/tui.js +1099 -139
- package/lib/tui.js.map +1 -1
- package/lib/types/index.d.ts +2 -0
- package/lib/types/subagent-model.d.ts +17 -2
- package/lib/types/tui.d.ts +149 -5
- package/package.json +6 -2
package/README.en.md
CHANGED
|
@@ -1,14 +1,32 @@
|
|
|
1
1
|
# dsh-ssh-tui
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
session as a plain-ANSI chat transcript, streams model output, shows tool calls,
|
|
6
|
-
answers approvals and `ask_user_question` prompts from the keyboard, and lets
|
|
7
|
-
you resume persisted sessions. No browser, no mouse, no heavy terminal
|
|
8
|
-
framework — designed for slow/remote SSH links.
|
|
3
|
+
A DeepSeek Harness terminal for jump hosts, headless servers, and high-latency
|
|
4
|
+
SSH. Plain ANSI and incremental redraws. No browser, no Ink/React skin.
|
|
9
5
|
|
|
10
6
|
中文部署指南:[README.md](README.md)
|
|
11
7
|
|
|
8
|
+
Who it is for: a keyboard-only SSH session on a remote box. Who it is not for:
|
|
9
|
+
a local desktop TUI with many themes — that lane already has a clear winner.
|
|
10
|
+
|
|
11
|
+
## Official headless vs this TUI
|
|
12
|
+
|
|
13
|
+
There is no shipped TUI. The default terminal entry on a remote box is
|
|
14
|
+
`dsh --profile headless`: one task, then the **last assistant message** on
|
|
15
|
+
stdout. Reasoning, tool calls, subagents, and the plan stay in the session
|
|
16
|
+
log.
|
|
17
|
+
|
|
18
|
+
Both frames below are the **same task**. Top: official headless stdout
|
|
19
|
+
(`@deepseek-ai/dsh-headless` prints `outcome.text` only). Bottom: this plugin
|
|
20
|
+
painting the same events in an 88-column SSH window.
|
|
21
|
+
|
|
22
|
+

|
|
23
|
+
|
|
24
|
+
Top: `$ dsh --profile headless "…"` then the final markdown.
|
|
25
|
+
Bottom: reasoning collapsed, full-row red/green diff, each subagent on its
|
|
26
|
+
own card, the plan strip pinned above the input.
|
|
27
|
+
|
|
28
|
+
Singles: [headless stdout](docs/screenshots/headless.png) · [dsh-ssh-tui](docs/screenshots/workspace.png)
|
|
29
|
+
|
|
12
30
|
## Requirements
|
|
13
31
|
|
|
14
32
|
- Node.js >= 22.19
|
|
@@ -17,6 +35,26 @@ framework — designed for slow/remote SSH links.
|
|
|
17
35
|
|
|
18
36
|
## Install
|
|
19
37
|
|
|
38
|
+
On a remote box with `dsh` and pnpm already installed (no clone):
|
|
39
|
+
|
|
40
|
+
```sh
|
|
41
|
+
dsh plugin --profile tui add dsh-ssh-tui
|
|
42
|
+
# optional: reuse a SuperGrok / grok-bridge token already on the machine
|
|
43
|
+
dsh plugin --profile tui add github:cyjyyd/dsh-llm-xai-oauth
|
|
44
|
+
dsh plugin --profile headless add github:cyjyyd/dsh-llm-xai-oauth
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
Smoke the route before opening the TUI. The TUI exits immediately without a TTY:
|
|
48
|
+
|
|
49
|
+
```sh
|
|
50
|
+
dsh --profile headless "Reply with exactly: tui-install-ok. Do not use tools."
|
|
51
|
+
dsh --profile tui
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
From a checkout: `bash scripts/smoke-headless.sh` (prints an outcome summary, never a token).
|
|
55
|
+
|
|
56
|
+
From git:
|
|
57
|
+
|
|
20
58
|
```sh
|
|
21
59
|
git clone https://github.com/cyjyyd/dsh-ssh-tui.git
|
|
22
60
|
cd dsh-ssh-tui
|
|
@@ -31,14 +69,6 @@ npm run build
|
|
|
31
69
|
dsh plugin --profile tui add "link:$(pwd)"
|
|
32
70
|
```
|
|
33
71
|
|
|
34
|
-
Or install the published npm package directly (requires `@deepseek-ai/dsh` and
|
|
35
|
-
`pnpm`, no local clone needed):
|
|
36
|
-
|
|
37
|
-
```sh
|
|
38
|
-
dsh plugin --profile tui add dsh-ssh-tui
|
|
39
|
-
# or from a repo checkout: bash scripts/install-npm.sh
|
|
40
|
-
```
|
|
41
|
-
|
|
42
72
|
For the optional **智能路由模式 (routing-suite)** mode, also run:
|
|
43
73
|
|
|
44
74
|
```sh
|
|
@@ -127,28 +157,31 @@ The plugin runs on Linux, macOS, and Windows (Node ≥ 22.19):
|
|
|
127
157
|
|
|
128
158
|
| Key | Action |
|
|
129
159
|
| --- | --- |
|
|
130
|
-
| `Enter` | send
|
|
160
|
+
| `Enter` | send; while running, steer; with empty input, toggle the selected card |
|
|
131
161
|
| `Tab` | complete the highlighted slash command |
|
|
132
|
-
| `↑` / `↓` |
|
|
133
|
-
| `Ctrl+N` / `Ctrl+P` | move among collapsible cards |
|
|
162
|
+
| `↑` / `↓` | empty input: move among cards; otherwise history. Same as `Ctrl+N` / `Ctrl+P` |
|
|
134
163
|
| `Ctrl+R` | expand or collapse all cards |
|
|
135
|
-
| `
|
|
164
|
+
| `Ctrl+T` | fold the input box (display-only) |
|
|
165
|
+
| `Alt+1` / `2` / `3` / `4` | jump to latest thinking / plan / subagent / reply |
|
|
166
|
+
| `/find [kind] query` | search and jump to the full matching message (`thinking` `plan` `subagent` `reply`). `Ctrl+/` or `Alt+/` opens it |
|
|
167
|
+
| `Ctrl+G` / `Alt+N` | next search hit; `Alt+P` previous |
|
|
168
|
+
| `Esc` | drop selection → scroll to bottom → cancel the running turn |
|
|
169
|
+
| `Ctrl+C` | cancel the running turn; exit when idle |
|
|
136
170
|
| `Ctrl+D` | exit |
|
|
137
171
|
| `Ctrl+L` | redraw |
|
|
138
|
-
| `Ctrl+T` | fold/unfold the input box (display-only; submission keeps the full text) |
|
|
139
|
-
| `↑` / `↓` | input history |
|
|
140
172
|
| `y` / `n` / `Esc` | answer an approval prompt |
|
|
141
173
|
| `1..9` + `Enter` | answer an `ask_user_question` dialog |
|
|
142
174
|
|
|
143
175
|
Type `/` to see slash-command suggestions — the panel merges the TUI's own
|
|
144
|
-
commands with every command the harness
|
|
145
|
-
`/compact`, `/permission`, `/feedback`, ...).
|
|
146
|
-
`/help` lists everything.
|
|
176
|
+
commands (`/find`, `/model`, `/help`, ...) with every command the harness
|
|
177
|
+
registers (`/goal`, `/plan`, `/compact`, `/permission`, `/feedback`, ...).
|
|
178
|
+
`Tab` completes, `Enter` runs. `/help` lists everything.
|
|
147
179
|
|
|
148
|
-
`/model`
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
180
|
+
`/model` lists models for the **current** provider first. On SuperGrok that
|
|
181
|
+
is `grok-4.6` / `grok-4.5` plus reasoning effort (`xhigh` on 4.6). Switching
|
|
182
|
+
to DeepSeek or OpenCode is an explicit “change provider” step. `/setup` is
|
|
183
|
+
only for API-key providers; SuperGrok / X Premium uses local OAuth and does
|
|
184
|
+
not need a key. `/status` and the footer show the same route.
|
|
152
185
|
|
|
153
186
|
For OpenCode and other third-party providers, `/model` queries the provider's
|
|
154
187
|
endpoint (`GET {baseURL}/models`) for a live model list, falling back to the
|
|
@@ -166,16 +199,21 @@ releases selected continuable children using the harness 0.1.1
|
|
|
166
199
|
`drainContinuableChildren` capability.
|
|
167
200
|
|
|
168
201
|
Each subagent is its own collapsible card. One or many children start collapsed,
|
|
169
|
-
so the parent transcript stays readable; `Enter`, click,
|
|
170
|
-
`Ctrl+R` expand or collapse them independently. Running cards show a spinner,
|
|
202
|
+
so the parent transcript stays readable; `Enter`, click, empty-input `↑`/`↓`,
|
|
203
|
+
and `Ctrl+R` expand or collapse them independently. Running cards show a spinner,
|
|
171
204
|
and the status/title line shows `⠋ 子代理 N` instead of mixing child output
|
|
172
205
|
into the parent stream.
|
|
173
206
|
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
207
|
+
The plan strip pins only the **latest incomplete plan**. When the model
|
|
208
|
+
opens a new plan in the same turn, the previous one archives into the
|
|
209
|
+
scrolling transcript and the dock shows the new one. A finished plan says
|
|
210
|
+
「计划任务已全部完成」, not 「计划模式已关闭」. If a turn ends with open todos, the strip says 「本轮未收尾」, stops
|
|
211
|
+
spinning, and sends one follow-up asking the model to `todo_write` the
|
|
212
|
+
real statuses. The `/` menu and
|
|
213
|
+
approval/question dialogs yield that bottom space. `exit_plan_mode` is
|
|
214
|
+
markdown. `ask_user_question` still opens a dialog and leaves a collapsed
|
|
215
|
+
`提问用户` card. `/goal` is a collapsed `目标` card. `/find thinking foo`
|
|
216
|
+
or `Alt+1..4` jumps to the matching category.
|
|
179
217
|
|
|
180
218
|
Interrupted streaming output keeps the already-generated prefix and is marked
|
|
181
219
|
`⚠ interrupted`; team collaboration session events (`team/*`) are surfaced as
|
|
@@ -207,12 +245,11 @@ terminal markdown support: heading levels (H1 enlarged/underlined, H2
|
|
|
207
245
|
underlined, H3 colored), bold, italic, inline code, fenced code blocks,
|
|
208
246
|
lists, quotes, and links all get ANSI styling while remaining
|
|
209
247
|
width-wrapped for the terminal. Reasoning, tool, subagent, plan, and question cards are
|
|
210
|
-
each expandable/collapsible independently
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
also toggles it. Subagent cards start collapsed even when several run at once.
|
|
248
|
+
each expandable/collapsible independently. Empty input: `↑`/`↓` (same as
|
|
249
|
+
`Ctrl+N`/`Ctrl+P`) move the highlight, `Enter` toggles, `Ctrl+R` toggles all,
|
|
250
|
+
`Esc` drops the selection. Click a card header to toggle it. Subagent cards
|
|
251
|
+
start collapsed even when several run at once. `Alt+1..4` jumps to the latest
|
|
252
|
+
thinking / plan / subagent / reply.
|
|
216
253
|
|
|
217
254
|
The transcript is scrollable: `PgUp`/`PgDn` or the mouse wheel move back
|
|
218
255
|
through earlier reasoning blocks and tool calls, a `↑ 已回看 N 行` indicator
|
|
@@ -283,6 +320,16 @@ and resumes directly. `dsh --profile tui --new` explicitly starts fresh
|
|
|
283
320
|
without the picker. The in-app `/resume` command remains available for
|
|
284
321
|
switching while running.
|
|
285
322
|
|
|
323
|
+
## Jump-host / proxied SSH
|
|
324
|
+
|
|
325
|
+
Each paint is one `stdout.write` of dirty rows only, so a jump host or
|
|
326
|
+
corporate proxy does not see one SSH packet per line. Default cadence is
|
|
327
|
+
about 160 ms, enough for most jump hosts. On a very slow path:
|
|
328
|
+
|
|
329
|
+
```sh
|
|
330
|
+
export DSH_TUI_PAINT_MS=250 # 40–1000; higher = fewer packets, choppier stream
|
|
331
|
+
```
|
|
332
|
+
|
|
286
333
|
## Development
|
|
287
334
|
|
|
288
335
|
```sh
|
package/README.md
CHANGED
|
@@ -1,15 +1,28 @@
|
|
|
1
1
|
# dsh-ssh-tui
|
|
2
2
|
|
|
3
|
-
DeepSeek Harness
|
|
4
|
-
|
|
5
|
-
进度与完成提示音。
|
|
3
|
+
给跳板机、无桌面服务器、高延迟 SSH 用的 DeepSeek Harness 终端。纯 ANSI、增量重绘,
|
|
4
|
+
不需要浏览器,也不需要 Ink / React 那套皮肤。
|
|
6
5
|
|
|
7
6
|
English: [README.en.md](README.en.md)
|
|
8
7
|
|
|
9
|
-
|
|
8
|
+
适合谁:SSH 直连的远程机器、慢链路、只有键盘的会话。不适合谁:本机想要多主题、
|
|
9
|
+
官网级交互的桌面终端——那条赛道已经有明确赢家。
|
|
10
10
|
|
|
11
11
|
SuperGrok / X Premium 订阅走配套插件 [dsh-llm-xai-oauth](https://github.com/cyjyyd/dsh-llm-xai-oauth),复用本机 grok-bridge token,不需要 xAI API Key。
|
|
12
12
|
|
|
13
|
+
## 官方 headless 和这个 TUI
|
|
14
|
+
|
|
15
|
+
官方没有预置 TUI。远程机器上的默认终端入口是 `dsh --profile headless`:跑完一个任务,把**最后一条助手回复**打到 stdout 就退出。思考、工具调用、子代理、计划都在会话日志里,终端上看不到。
|
|
16
|
+
|
|
17
|
+
下面两帧是**同一条任务**。上:官方 headless 的 stdout(按 `@deepseek-ai/dsh-headless` 的契约:只打印最终文本)。下:本插件把同一组事件画进 88 列 SSH 窗口。
|
|
18
|
+
|
|
19
|
+

|
|
20
|
+
|
|
21
|
+
上:`$ dsh --profile headless "…"` 之后只有最终 Markdown。
|
|
22
|
+
下:思考默认折叠、`edit` 整行红/绿 diff、两个子代理各自一张卡、计划条钉在输入框上方。
|
|
23
|
+
|
|
24
|
+
单独看:[headless stdout](docs/screenshots/headless.png) · [dsh-ssh-tui](docs/screenshots/workspace.png)
|
|
25
|
+
|
|
13
26
|
## 功能一览
|
|
14
27
|
|
|
15
28
|
- 纯终端渲染,无需浏览器/鼠标/重量级终端框架,适合慢速或远程 SSH;
|
|
@@ -40,7 +53,25 @@ SuperGrok / X Premium 订阅走配套插件 [dsh-llm-xai-oauth](https://github.c
|
|
|
40
53
|
|
|
41
54
|
## 部署指南
|
|
42
55
|
|
|
43
|
-
|
|
56
|
+
远程机器最短路径(已有 `dsh` 和 pnpm,无需 clone):
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
dsh plugin --profile tui add dsh-ssh-tui
|
|
60
|
+
# 可选:本机已有 SuperGrok / grok-bridge token 时
|
|
61
|
+
dsh plugin --profile tui add github:cyjyyd/dsh-llm-xai-oauth
|
|
62
|
+
dsh plugin --profile headless add github:cyjyyd/dsh-llm-xai-oauth
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
先确认链路再开 TUI(无 TTY 时 TUI 会直接退出):
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
dsh --profile headless "Reply with exactly: tui-install-ok. Do not use tools."
|
|
69
|
+
dsh --profile tui # 必须在真实终端 / SSH 会话里
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
仓库内也可:`bash scripts/smoke-headless.sh`(记录出口摘要,不打印 token)。
|
|
73
|
+
|
|
74
|
+
### 方式一:从 git clone 安装
|
|
44
75
|
|
|
45
76
|
```bash
|
|
46
77
|
git clone https://github.com/cyjyyd/dsh-ssh-tui.git
|
|
@@ -66,14 +97,10 @@ npm run build
|
|
|
66
97
|
dsh plugin --profile tui add "link:$(pwd)"
|
|
67
98
|
```
|
|
68
99
|
|
|
69
|
-
###
|
|
70
|
-
|
|
71
|
-
前置要求:已全局安装 `@deepseek-ai/dsh`(`npm i -g @deepseek-ai/dsh`)且有 pnpm。
|
|
100
|
+
### 方式三:指定其它 profile 的 npm 安装
|
|
72
101
|
|
|
73
102
|
```bash
|
|
74
|
-
|
|
75
|
-
# 或在仓库内快捷执行:bash scripts/install-npm.sh
|
|
76
|
-
# 指定其它 profile:bash scripts/install-npm.sh work
|
|
103
|
+
bash scripts/install-npm.sh work
|
|
77
104
|
```
|
|
78
105
|
|
|
79
106
|
`dsh plugin add` 会从 npm 拉取包、写入 profile 依赖,并自动把 `dsh-ssh-tui`
|
|
@@ -114,28 +141,34 @@ dsh --profile tui --no-color
|
|
|
114
141
|
|
|
115
142
|
| 键 | 作用 |
|
|
116
143
|
| --- | --- |
|
|
117
|
-
| `Enter` |
|
|
118
|
-
| `↑` / `↓` |
|
|
119
|
-
| `Ctrl+
|
|
120
|
-
| `Ctrl+
|
|
121
|
-
| `
|
|
122
|
-
|
|
|
123
|
-
| `
|
|
124
|
-
|
|
|
125
|
-
| `
|
|
144
|
+
| `Enter` | 发送;运行中则插入指示;空输入且已选卡片时展开/收起 |
|
|
145
|
+
| `↑` / `↓` | 空输入:在卡片间移动;有输入:历史。与 `Ctrl+N` / `Ctrl+P` 相同 |
|
|
146
|
+
| `Ctrl+R` | 全部展开或全部收起 |
|
|
147
|
+
| `Ctrl+T` | 折叠输入框(只影响显示) |
|
|
148
|
+
| `Alt+1` / `2` / `3` / `4` | 跳到最新思考 / 计划 / 子代理 / 回复 |
|
|
149
|
+
| `/find [类] 关键字` | 搜索并跳到该条完整消息(反色高亮)。类:`思考` `计划` `子代理` `回复`。`Ctrl+/` 或 `Alt+/` 打开 |
|
|
150
|
+
| `Ctrl+G` / `Alt+N` | 下一条搜索结果;`Alt+P` 上一条 |
|
|
151
|
+
| 鼠标左键 | 点击卡片标题展开/收起 |
|
|
152
|
+
| `PgUp` / `PgDn`、滚轮 | 转录回看 |
|
|
153
|
+
| `Esc` | 取消选择 → 回底部 → 取消当前轮次 |
|
|
154
|
+
| `Ctrl+C` | 中断当前轮次;空闲退出 |
|
|
126
155
|
| `Ctrl+D` | 退出 |
|
|
127
|
-
| `Ctrl+L` |
|
|
156
|
+
| `Ctrl+L` | 重绘整个画面 |
|
|
128
157
|
|
|
129
|
-
斜杠命令:`/help`、`/model`、`/submodel`、`/subeffort`、`/mode`、`/resume`、
|
|
158
|
+
斜杠命令:`/help`、`/find`、`/model`、`/submodel`、`/subeffort`、`/mode`、`/resume`、
|
|
130
159
|
`/status`、`/subagents`、`/usage`(`/quota` 同义)、`/setup`、`/clear`,
|
|
131
160
|
以及 harness 自带命令(`/goal`、`/plan`、`/compact` 等)。harness 命令若声明
|
|
132
161
|
支持图片附件,会在命令列表和补全提示中标注“可附图”。
|
|
133
162
|
|
|
134
|
-
`/model`
|
|
135
|
-
|
|
136
|
-
|
|
163
|
+
`/model` 默认列出**当前提供商**的模型。已经在 SuperGrok 时,直接选
|
|
164
|
+
`grok-4.6` / `grok-4.5` 和思考强度(`grok-4.6` 含 `xhigh`);要换 DeepSeek
|
|
165
|
+
或 OpenCode 再选「更换提供商」。`/setup` 只用于配置 API Key 提供商,
|
|
166
|
+
SuperGrok / X Premium 走本机 OAuth,不需要填 Key。`/status` 和底栏同样
|
|
167
|
+
显示这条路由。
|
|
137
168
|
|
|
138
|
-
|
|
169
|
+
子代理默认跟随父会话的提供方,并尽量选同一家的轻量模型:DeepSeek 用
|
|
170
|
+
`deepseek-v4-flash` / `deepseek-v4-flash-vision-exp`,xAI 用 `grok-4.5`。
|
|
171
|
+
`/model` 或 `/setup` 换提供商(OAuth / API Key 都一样)时会自动同步子代理:
|
|
139
172
|
|
|
140
173
|
- `/submodel [model-id]`:打开子代理模型选择器;带参数时直接指定模型;
|
|
141
174
|
- `/subeffort`:选择子代理思考强度,或恢复为“跟随提供商默认”;
|
|
@@ -150,11 +183,14 @@ SuperGrok / X Premium 订阅、OpenCode Go、OpenCode Zen。`/status` 和底栏
|
|
|
150
183
|
用户消息、工具调用和结果;`Ctrl+R` 可一次展开或收起全部卡片。运行中的卡片带旋转
|
|
151
184
|
动画,状态栏和窗口标题显示 `⠋ 子代理 N`。
|
|
152
185
|
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
186
|
+
计划条只钉**最新一条未完成的计划**。同一轮次里模型再开新计划时,旧计划归档进
|
|
187
|
+
工作区随转录上滚,底栏换成新计划。任务全部完成后计划条会说「计划任务已全部完成」,
|
|
188
|
+
不再误报「计划模式已关闭」。一轮结束时若待办仍是进行中/待处理,计划条改成「本轮未收尾」并停止转圈,
|
|
189
|
+
同时自动追问模型补一次 `todo_write`(同一列表只问一次,不改会话里的旧状态)。
|
|
190
|
+
打开 `/` 命令选单或批准/提问对话框时,计划条让出底栏。
|
|
191
|
+
`exit_plan_mode` 按 markdown 渲染。`ask_user_question` 仍弹对话框,并留下折叠的
|
|
192
|
+
`提问用户` 卡片。`/goal` 是折叠的 `目标` 卡片。`/find 思考 padAnsi` 或 `Alt+1..4`
|
|
193
|
+
可跳到对应类别的最新卡片。
|
|
158
194
|
|
|
159
195
|
`/usage` 在当前提供商为 OpenCode 源时可用,并区分两种计费方式:
|
|
160
196
|
|
|
@@ -254,6 +290,10 @@ npm run build
|
|
|
254
290
|
- **标题栏或铃声不生效**:确认终端支持 OSC 0 与 BEL;铃声可用
|
|
255
291
|
`DSH_TUI_NO_BELL=1` 关闭。
|
|
256
292
|
- **滚轮误触取消**:已加入转义序列缓冲,网络拆包也不会把 `ESC` 当取消。
|
|
293
|
+
- **跳板机 / 多层代理 SSH 发画**:每一帧只发脏行,并且拼成一次 `stdout.write`,避免一行一个 SSH 包。默认约 160 ms 合一帧,多数跳板机不用改。特别慢时:
|
|
294
|
+
```bash
|
|
295
|
+
export DSH_TUI_PAINT_MS=250 # 40–1000;越大越省链路,流式字越顿
|
|
296
|
+
```
|
|
257
297
|
|
|
258
298
|
## License
|
|
259
299
|
|
package/cordis.patch.yml
CHANGED
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,qBAAqB,EAAiE,MAAM,wBAAwB,CAAA;AAG7H,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAA;AAEjD,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAA;AACpD,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AACxC,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAA;AAC/C,OAAO,EAAE,QAAQ,EAAsB,MAAM,UAAU,CAAA;AACvD,OAAO,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAA;AACvD,OAAO,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAA;AAE7D,MAAM,CAAC,MAAM,IAAI,GAAG,SAAS,CAAA;AAE7B,6EAA6E;AAC7E,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,QAAQ,EAAE,mBAAmB,CAAC,CAAA;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,qBAAqB,EAAiE,MAAM,wBAAwB,CAAA;AAG7H,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAA;AAEjD,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAA;AACpD,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AACxC,OAAO,EAA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c,EAAE,EAAE;YACnC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,yBAAyB,gBAAgB,sBAAsB,UAAU,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;YAC1G,MAAM,IAAI,GAAG,GAAG,CAAC,GAAG,CAAC,SAAS,CAAC,CAAA;YAC/B,IAAI,IAAI,KAAK,SAAS;gBAAE,IAAI,CAAC,CAAC,CAAC,CAAA;;gBAC1B,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;QACtB,CAAC,CAAC,CAAA;QAEF,OAAO,KAAK,IAAmB,EAAE;YAC/B,QAAQ,GAAG,IAAI,CAAA;YACf,WAAW,CAAC,KAAK,EAAE,CAAA;YACnB,MAAM,UAAU,EAAE,OAAO,EAAE,CAAA;YAC3B,MAAM,MAAM,EAAE,OAAO,EAAE,CAAA;QACzB,CAAC,CAAA;IACH,CAAC,EAAE,SAAS,CAAC,CAAA;AACf,CAAC"}
|
package/lib/reasoning.js
CHANGED
|
@@ -25,9 +25,11 @@ export async function defaultReasoningEffort(llm, provider, model) {
|
|
|
25
25
|
const nonOff = efforts.filter(effort => effort.id !== 'off');
|
|
26
26
|
if (nonOff.length === 0)
|
|
27
27
|
return undefined;
|
|
28
|
-
const
|
|
29
|
-
|
|
30
|
-
|
|
28
|
+
const preferred = nonOff.find(effort => effort.id === 'max')
|
|
29
|
+
?? nonOff.find(effort => effort.id === 'xhigh')
|
|
30
|
+
?? nonOff.find(effort => effort.id === 'high')
|
|
31
|
+
?? nonOff[0];
|
|
32
|
+
return preferred?.id;
|
|
31
33
|
}
|
|
32
34
|
catch {
|
|
33
35
|
return undefined;
|
package/lib/reasoning.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reasoning.js","sourceRoot":"","sources":["../src/reasoning.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAIH;;;;;;;GAOG;AACH,MAAM,CAAC,KAAK,UAAU,sBAAsB,CAC1C,GAAe,EACf,QA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E,KAAK,KAAK,CAAC;eACvD,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,EAAE,KAAK,OAAO,CAAC;eAC5C,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,EAAE,KAAK,MAAM,CAAC;eAC3C,MAAM,CAAC,CAAC,CAAC,CAAA;QACd,OAAO,SAAS,EAAE,EAAE,CAAA;IACtB,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,SAAS,CAAA;IAClB,CAAC;AACH,CAAC"}
|
package/lib/subagent-model.js
CHANGED
|
@@ -4,15 +4,95 @@
|
|
|
4
4
|
*
|
|
5
5
|
* The provider is deliberately inherited from the running parent session:
|
|
6
6
|
* the subagent selection only overrides the provider when the user stored an
|
|
7
|
-
* explicit route.
|
|
7
|
+
* explicit route. When the parent provider changes, the TUI picks a
|
|
8
|
+
* same-family default (DeepSeek flash, Grok 4.5, otherwise the first listed
|
|
9
|
+
* lightweight model) unless `/submodel` stored an explicit model.
|
|
8
10
|
*/
|
|
9
11
|
import z from '@deepseek-ai/schemastery';
|
|
10
12
|
import { ReasoningEffortId } from '@deepseek-ai/dsh-llm';
|
|
11
13
|
import { installSettingsSection, settingsNamespace } from '@deepseek-ai/dsh-settings';
|
|
12
14
|
/** Settings namespace carrying the TUI's subagent model selection. */
|
|
13
15
|
export const SUBAGENT_SETTINGS_NAMESPACE = settingsNamespace('ssh-tui-subagent');
|
|
14
|
-
/** Lightweight default model used for subagent children. */
|
|
16
|
+
/** Lightweight default model used for DeepSeek-family subagent children. */
|
|
15
17
|
export const DEFAULT_SUBAGENT_MODEL = 'deepseek-v4-flash';
|
|
18
|
+
/** Preferred subagent default when the parent route is SuperGrok / xAI. */
|
|
19
|
+
export const DEFAULT_XAI_SUBAGENT_MODEL = 'grok-4.5';
|
|
20
|
+
/** Tokens that mark a DeepSeek-family model id. */
|
|
21
|
+
const DEEPSEEK_MODEL_MARKERS = ['deepseek', 'v4-flash', 'v4-pro'];
|
|
22
|
+
/** Tokens that mark a Grok / xAI model id. */
|
|
23
|
+
const GROK_MODEL_MARKERS = ['grok', 'xai'];
|
|
24
|
+
function providerFamily(provider) {
|
|
25
|
+
const id = provider.trim().toLowerCase();
|
|
26
|
+
if (id === 'deepseek-official' || id === 'deepseek' || id.startsWith('deepseek-'))
|
|
27
|
+
return 'deepseek';
|
|
28
|
+
if (id === 'xai' || id === 'grok' || id.startsWith('xai-') || id.startsWith('grok-'))
|
|
29
|
+
return 'xai';
|
|
30
|
+
return 'other';
|
|
31
|
+
}
|
|
32
|
+
function modelLooksLike(model, markers) {
|
|
33
|
+
const id = model.trim().toLowerCase();
|
|
34
|
+
return markers.some(marker => id.includes(marker));
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Rank a listed model for automatic subagent selection. Lower is better:
|
|
38
|
+
* exact preferred id, then flash/vision-lite, then other same-family ids.
|
|
39
|
+
*/
|
|
40
|
+
function scoreSubagentCandidate(model, preferred) {
|
|
41
|
+
const id = model.trim().toLowerCase();
|
|
42
|
+
const exact = preferred.findIndex(item => item.toLowerCase() === id);
|
|
43
|
+
if (exact >= 0)
|
|
44
|
+
return exact;
|
|
45
|
+
if (id.includes('flash') || id.includes('lite') || id.includes('mini') || id.includes('small'))
|
|
46
|
+
return preferred.length;
|
|
47
|
+
if (id.includes('vision'))
|
|
48
|
+
return preferred.length + 1;
|
|
49
|
+
return preferred.length + 8;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Choose the default subagent model for a parent provider, preferring a
|
|
53
|
+
* same-family listed model over a leftover DeepSeek flash id.
|
|
54
|
+
*/
|
|
55
|
+
export function defaultSubagentModelForProvider(provider, listed = []) {
|
|
56
|
+
const family = providerFamily(provider);
|
|
57
|
+
const preferred = family === 'xai'
|
|
58
|
+
? [DEFAULT_XAI_SUBAGENT_MODEL, 'grok-4.5', 'grok-4.3', 'grok-4.6']
|
|
59
|
+
: family === 'deepseek'
|
|
60
|
+
? [DEFAULT_SUBAGENT_MODEL, 'deepseek-v4-flash-vision-exp', 'deepseek-v4-flash']
|
|
61
|
+
: [];
|
|
62
|
+
const unique = [...new Set(listed.map(id => id.trim()).filter(id => id !== ''))];
|
|
63
|
+
if (unique.length > 0) {
|
|
64
|
+
const sameFamily = unique.filter(id => family === 'xai' ? modelLooksLike(id, GROK_MODEL_MARKERS)
|
|
65
|
+
: family === 'deepseek' ? modelLooksLike(id, DEEPSEEK_MODEL_MARKERS)
|
|
66
|
+
: true);
|
|
67
|
+
const pool = sameFamily.length > 0 ? sameFamily : unique;
|
|
68
|
+
return [...pool].sort((a, b) => {
|
|
69
|
+
const delta = scoreSubagentCandidate(a, preferred) - scoreSubagentCandidate(b, preferred);
|
|
70
|
+
return delta !== 0 ? delta : a.localeCompare(b);
|
|
71
|
+
})[0] ?? (preferred[0] ?? unique[0] ?? DEFAULT_SUBAGENT_MODEL);
|
|
72
|
+
}
|
|
73
|
+
return preferred[0] ?? DEFAULT_SUBAGENT_MODEL;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* True when the stored subagent model still belongs to the parent provider
|
|
77
|
+
* family. An explicit leftover DeepSeek flash id after switching to xAI is
|
|
78
|
+
* treated as stale so the TUI can pick a same-family default.
|
|
79
|
+
*/
|
|
80
|
+
export function subagentModelMatchesProvider(provider, model, listed = []) {
|
|
81
|
+
const id = model.trim();
|
|
82
|
+
if (id === '')
|
|
83
|
+
return false;
|
|
84
|
+
const family = providerFamily(provider);
|
|
85
|
+
if (listed.length > 0)
|
|
86
|
+
return listed.includes(id);
|
|
87
|
+
if (family === 'xai')
|
|
88
|
+
return modelLooksLike(id, GROK_MODEL_MARKERS);
|
|
89
|
+
if (family === 'deepseek')
|
|
90
|
+
return modelLooksLike(id, DEEPSEEK_MODEL_MARKERS);
|
|
91
|
+
// Unknown catalog: a leftover Grok id is stale on a non-xAI route.
|
|
92
|
+
if (modelLooksLike(id, GROK_MODEL_MARKERS))
|
|
93
|
+
return false;
|
|
94
|
+
return true;
|
|
95
|
+
}
|
|
16
96
|
/** Settings schema for `$DSH_HOME/settings.yaml`. */
|
|
17
97
|
export const SUBAGENT_SETTINGS_SCHEMA = z.object({
|
|
18
98
|
provider: z.string(),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"subagent-model.js","sourceRoot":"","sources":["../src/subagent-model.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"subagent-model.js","sourceRoot":"","sources":["../src/subagent-model.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,CAAC,MAAM,0BAA0B,CAAA;AAExC,OAAO,EAAE,iBAAiB,EAA6C,MAAM,sBAAsB,CAAA;AACnG,OAAO,EAAE,sBAAsB,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAA;AAErF,sEAAsE;AACtE,MAAM,CAAC,MAAM,2BAA2B,GAAG,iBAAiB,CAAC,kBAAkB,CAAC,CAAA;AAEhF,4EAA4E;AAC5E,MAAM,CAAC,MAAM,sBAAsB,GAAG,mBAAmB,CAAA;AAEzD,2EAA2E;AAC3E,MAAM,CAAC,MAAM,0BAA0B,GAAG,UAAU,CAAA;AAEpD,mDAAmD;AACnD,MAAM,sBAAsB,GAAG,CAAC,UAAU,EAAE,UAAU,EAAE,QAAQ,CAAU,CAAA;AAE1E,8CAA8C;AAC9C,MAAM,kBAAkB,GAAG,CAAC,MAAM,EAAE,KAAK,CAAU,CAAA;AAEnD,SAAS,cAAc,CAAC,QAAgB;IACtC,MAAM,EAAE,GAAG,QAAQ,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAA;IACxC,IAAI,EAAE,KAAK,mBAAmB,IAAI,EAAE,KAAK,UAAU,IAAI,EAAE,CAAC,UAAU,CAAC,WAAW,CAAC;QAAE,OAAO,UAAU,CAAA;IACpG,IAAI,EAAE,KAAK,KAAK,IAAI,EAAE,KAAK,MAAM,IAAI,EAAE,CAAC,UAAU,CAAC,MAAM,C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