dsh-ssh-tui 0.3.2 → 0.3.4

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 CHANGED
@@ -1,12 +1,13 @@
1
1
  # dsh-ssh-tui
2
2
 
3
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.
4
+ SSH. Plain ANSI and incremental redraws. No browser required.
5
5
 
6
6
  中文部署指南:[README.md](README.md)
7
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.
8
+ If you mostly work over SSH a jump host, a test box, a keyboard-only
9
+ session — start here. A local desktop terminal with themes and layout
10
+ you already like can stay as it is.
10
11
 
11
12
  ## Official headless vs this TUI
12
13
 
@@ -27,6 +28,19 @@ own card, the plan strip pinned above the input.
27
28
 
28
29
  Singles: [headless stdout](docs/screenshots/headless.png) · [dsh-ssh-tui](docs/screenshots/workspace.png)
29
30
 
31
+ ## Still visible on a slow SSH pipe
32
+
33
+ Same task, replayed at **2 kB/s** through the real incremental painter
34
+ (88×30, one `stdout.write` per frame). Official headless on that pipe
35
+ would stay blank until the final markdown. Here reasoning, the edit
36
+ diff, subagent cards, and the plan strip appear as the bytes arrive.
37
+
38
+ ![Same task replayed at 2 kB/s SSH](docs/screenshots/slow-link.gif)
39
+
40
+ Reproducible, no model in the loop: `npm run screenshots:slow` writes
41
+ `docs/screenshots/slow-link.json`. This capture is 14 paints, about
42
+ **15.5 KB**, **7.6 s** at 2 kB/s. Byte ledger for this event sequence.
43
+
30
44
  ## Requirements
31
45
 
32
46
  - Node.js >= 22.19
@@ -175,7 +189,9 @@ The plugin runs on Linux, macOS, and Windows (Node ≥ 22.19):
175
189
  Type `/` to see slash-command suggestions — the panel merges the TUI's own
176
190
  commands (`/find`, `/model`, `/help`, ...) with every command the harness
177
191
  registers (`/goal`, `/plan`, `/compact`, `/permission`, `/feedback`, ...).
178
- `Tab` completes, `Enter` runs. `/help` lists everything.
192
+ `/compact` shows a spinning 「压缩上下文」 card and footer until it
193
+ finishes, then the tokens recovered. `Tab` completes, `Enter` runs.
194
+ `/help` lists everything.
179
195
 
180
196
  `/model` lists models for the **current** provider first. On SuperGrok that
181
197
  is `grok-4.6` / `grok-4.5` plus reasoning effort (`xhigh` on 4.6). Switching
@@ -220,14 +236,17 @@ Interrupted streaming output keeps the already-generated prefix and is marked
220
236
  system messages. Harness slash commands that accept image attachments are
221
237
  labelled `(images ok)` in the command list and completion hints.
222
238
 
223
- `/usage` (alias `/quota`) works when the current provider is an OpenCode
224
- source and keeps the two billing models distinct:
239
+ `/usage` (alias `/quota`) follows the **current** provider:
225
240
 
226
- - **OpenCode Go** queries the official quota endpoint and shows rolling
227
- 5-hour / weekly / monthly usage percentages, limit state, and reset times;
228
- - **OpenCode Zen** is metered per API bill and has no fixed quota, so the TUI
229
- points to `https://opencode.ai/zen` for balance/billing and shows the
230
- session token usage it has recorded instead of inventing a quota.
241
+ - **SuperGrok** reads `GET cli-chat-proxy.grok.com/v1/billing` (weekly remaining %);
242
+ - **OpenCode Go** reads the official `/v1/usage` windows (5-hour / week / month);
243
+ - **OpenCode Zen** is metered the TUI points at `https://opencode.ai/zen`.
244
+
245
+ Quota is fetched at startup. Recheck cadence follows the tightest window:
246
+ every 10 turns for a 5-hour cap (every 4 when near a threshold), every 50
247
+ for weekly (every 10 when near), every 80 for monthly (every 20 when near).
248
+ Crossing 50% / 25% / 10% / 5% remaining posts a ⚠ planning reminder. The
249
+ footer shows the tightest window.
231
250
 
232
251
  The startup screen shows the official DeepSeek whale logo (rendered from the
233
252
  harness favicon) in the DeepSeek brand color, with the wordmark below it. The
@@ -323,12 +342,10 @@ switching while running.
323
342
  ## Jump-host / proxied SSH
324
343
 
325
344
  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
- ```
345
+ corporate proxy does not see one SSH packet per line. Local ttys use 80 ms.
346
+ Over SSH the TUI probes CSI 6n once and picks 80 / 160 / 250 / 400 ms from
347
+ the round-trip. `DSH_TUI_PAINT_MS` always wins (40–1000). `/status` and the
348
+ footer show the active tier.
332
349
 
333
350
  ## Development
334
351
 
package/README.md CHANGED
@@ -1,12 +1,12 @@
1
1
  # dsh-ssh-tui
2
2
 
3
3
  给跳板机、无桌面服务器、高延迟 SSH 用的 DeepSeek Harness 终端。纯 ANSI、增量重绘,
4
- 不需要浏览器,也不需要 Ink / React 那套皮肤。
4
+ 不需要浏览器。
5
5
 
6
6
  English: [README.en.md](README.en.md)
7
7
 
8
- 适合谁:SSH 直连的远程机器、慢链路、只有键盘的会话。不适合谁:本机想要多主题、
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
 
@@ -23,6 +23,14 @@ SuperGrok / X Premium 订阅走配套插件 [dsh-llm-xai-oauth](https://github.c
23
23
 
24
24
  单独看:[headless stdout](docs/screenshots/headless.png) · [dsh-ssh-tui](docs/screenshots/workspace.png)
25
25
 
26
+ ## 弱网 SSH 上过程还在
27
+
28
+ 同一条任务,按 **2 kB/s** 限速回放真实增量绘制(88×30,一帧一次 `stdout.write`)。官方 headless 这条链路上只会在全部结束后突然打出最终 Markdown;这里思考、`edit` diff、子代理卡和计划条是随着字节到达逐步出现的。
29
+
30
+ ![2 kB/s SSH 上回放同一任务](docs/screenshots/slow-link.gif)
31
+
32
+ 协议(可复现,不靠模型估):`npm run screenshots:slow` → `docs/screenshots/slow-link.json`。这次回放 14 次绘制、约 **15.5 KB**,在 2 kB/s 上大约 **7.6 s** 画完。数字是这条固定事件序的 stdout 字节账。
33
+
26
34
  ## 功能一览
27
35
 
28
36
  - 纯终端渲染,无需浏览器/鼠标/重量级终端框架,适合慢速或远程 SSH;
@@ -157,7 +165,9 @@ dsh --profile tui --no-color
157
165
 
158
166
  斜杠命令:`/help`、`/find`、`/model`、`/submodel`、`/subeffort`、`/mode`、`/resume`、
159
167
  `/status`、`/subagents`、`/usage`(`/quota` 同义)、`/setup`、`/clear`,
160
- 以及 harness 自带命令(`/goal`、`/plan`、`/compact` 等)。harness 命令若声明
168
+ 以及 harness 自带命令(`/goal`、`/plan`、`/compact` 等)。`/compact` 进行中会显示
169
+ 「压缩上下文」卡片和底栏转圈,结束时写出回收的 token 数。模型请求失败会显示重试
170
+ 进度;会话标题由模型生成后写到窗口标题。harness 命令若声明
161
171
  支持图片附件,会在命令列表和补全提示中标注“可附图”。
162
172
 
163
173
  `/model` 默认列出**当前提供商**的模型。已经在 SuperGrok 时,直接选
@@ -192,12 +202,13 @@ SuperGrok / X Premium 走本机 OAuth,不需要填 Key。`/status` 和底栏
192
202
  `提问用户` 卡片。`/goal` 是折叠的 `目标` 卡片。`/find 思考 padAnsi` 或 `Alt+1..4`
193
203
  可跳到对应类别的最新卡片。
194
204
 
195
- `/usage` 在当前提供商为 OpenCode 源时可用,并区分两种计费方式:
205
+ `/usage`(`/quota` 同义)按**当前提供商**查额度:
206
+
207
+ - **SuperGrok**:`GET cli-chat-proxy.grok.com/v1/billing`,显示本周剩余%;
208
+ - **OpenCode Go**:官方 `/v1/usage`,滚动 5 小时 / 本周 / 本月剩余%;
209
+ - **OpenCode Zen**:按量计费、没有固定额度,提示到 `https://opencode.ai/zen`。
196
210
 
197
- - **OpenCode Go**:调用官方额度接口,显示滚动 5 小时 / 本周 / 本月用量
198
- 百分比、限流状态与重置时间;
199
- - **OpenCode Zen**:按 API 账单计费、没有固定额度,TUI 不假装查询余额,
200
- 只提示到 `https://opencode.ai/zen` 查看,并附本会话已记录的 token 用量。
211
+ 启动时查一次。之后按最紧窗口调查询:5 小时额度每 10 轮(接近阈值改 4 轮),周额度每 50 轮(接近改 10 轮),月额度每 80 轮(接近改 20 轮)。剩余跨过 50% / 25% / 10% / 5% 时用 ⚠ 提示合理规划。底栏显示最紧窗口的剩余百分比。
201
212
 
202
213
  ## 配置
203
214
 
@@ -290,10 +301,7 @@ npm run build
290
301
  - **标题栏或铃声不生效**:确认终端支持 OSC 0 与 BEL;铃声可用
291
302
  `DSH_TUI_NO_BELL=1` 关闭。
292
303
  - **滚轮误触取消**:已加入转义序列缓冲,网络拆包也不会把 `ESC` 当取消。
293
- - **跳板机 / 多层代理 SSH 发画**:每一帧只发脏行,并且拼成一次 `stdout.write`,避免一行一个 SSH 包。默认约 160 ms 合一帧,多数跳板机不用改。特别慢时:
294
- ```bash
295
- export DSH_TUI_PAINT_MS=250 # 40–1000;越大越省链路,流式字越顿
296
- ```
304
+ - **跳板机 / 多层代理 SSH 发画**:每一帧只发脏行,并且拼成一次 `stdout.write`。本机 80 ms;SSH 启动时用 CSI 6n 测往返,按 RTT 选 80/160/250/400 ms。`DSH_TUI_PAINT_MS` 始终优先(40–1000)。`/status` 和底栏显示当前档。
297
305
 
298
306
  ## License
299
307
 
Binary file