dsh-ssh-tui 0.3.7 → 0.3.9

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
@@ -72,10 +72,18 @@ because the manifest declares `dsh.bundle`.
72
72
  Optional: reuse a SuperGrok / grok-bridge token already on the machine:
73
73
 
74
74
  ```sh
75
- dsh plugin --profile tui add github:cyjyyd/dsh-llm-xai-oauth
76
- dsh plugin --profile headless add github:cyjyyd/dsh-llm-xai-oauth
75
+ dsh plugin --profile tui add dsh-llm-xai-oauth
76
+ dsh plugin --profile headless add dsh-llm-xai-oauth
77
77
  ```
78
78
 
79
+ SuperGrok access tokens last about an hour. The TUI refreshes a due token on open, and `/usage` force-refreshes once after HTTP 401. If dsh is not running overnight, install the companion refresher or the next session starts with 401:
80
+
81
+ ```sh
82
+ npx dsh-llm-xai-oauth daemon --install
83
+ ```
84
+
85
+ See [dsh-llm-xai-oauth](https://github.com/cyjyyd/dsh-llm-xai-oauth).
86
+
79
87
  Smoke the route before opening the TUI. The TUI exits immediately without a TTY:
80
88
 
81
89
  ```sh
@@ -102,13 +110,17 @@ approvals) and prints `tmux attach`. Locks live under `$DSH_HOME/tui-locks/`;
102
110
  a leftover file from a crash is stolen if the pid is dead.
103
111
  `DSH_TUI_NO_SESSION_LOCK=1` skips this.
104
112
 
113
+ New sessions inherit the directory you launched from. Resuming a session
114
+ `chdir`s into that session's recorded working directory. The footer shows
115
+ `目录:srv` (last path segment); click it to print the full path.
116
+
105
117
  On start the TUI checks npm for a newer `dsh-ssh-tui` and **notifies only**:
106
118
 
107
119
  ```text
108
120
  发现新版本 dsh-ssh-tui 0.3.5(当前 0.3.4)。更新:dsh plugin --profile tui add dsh-ssh-tui
109
121
  ```
110
122
 
111
- Set `DSH_TUI_NO_UPDATE_CHECK=1` to skip. `/status` also shows the plugin version.
123
+ Set `DSH_TUI_NO_UPDATE_CHECK=1` to skip. `/status` also shows the plugin version, the link chip, the quota window, and whether the subagent model is in the same family as the parent route.
112
124
 
113
125
  From git:
114
126
 
@@ -214,7 +226,7 @@ The plugin runs on Linux, macOS, and Windows (Node ≥ 22.19):
214
226
 
215
227
  | Key | Action |
216
228
  | --- | --- |
217
- | `Enter` | send; while running, steer; with empty input, toggle the selected card |
229
+ | `Enter` | send; while running, steer; with empty input, toggle the selected card. Oversized tool bodies open a dedicated inspect view; `Esc` returns |
218
230
  | `Tab` | complete the highlighted slash command |
219
231
  | `↑` / `↓` | empty input: move among cards; otherwise history. Same as `Ctrl+N` / `Ctrl+P` |
220
232
  | `Ctrl+R` | expand or collapse all cards |
@@ -230,11 +242,14 @@ The plugin runs on Linux, macOS, and Windows (Node ≥ 22.19):
230
242
  | `1..9` + `Enter` | answer an `ask_user_question` dialog |
231
243
 
232
244
  Type `/` to see slash-command suggestions — the panel merges the TUI's own
233
- commands (`/find`, `/model`, `/provider`, `/help`, ...) with every command the harness
245
+ commands (`/find`, `/model`, `/provider`, `/language`, `/help`, ...) with every command the harness
234
246
  registers (`/goal`, `/plan`, `/compact`, `/permission`, `/feedback`, ...).
235
247
  `/compact` shows a spinning 「压缩上下文」 card and footer until it
236
248
  finishes, then the tokens recovered. `Tab` completes, `Enter` runs.
237
- `/help` lists everything.
249
+ `/help` lists everything. `/language` (alias `/lang`) opens a picker, or
250
+ `/language zh` / `/language en` switches immediately. `DSH_TUI_LANG` wins,
251
+ then `ssh-tui.language` in `$DSH_HOME/settings.yaml`, then `LANG` /
252
+ `LC_MESSAGES`. Unknown and `C` locales stay Chinese.
238
253
 
239
254
  `/model` lists models for the **current** provider only. On SuperGrok that
240
255
  is `grok-4.6` / `grok-4.5` plus reasoning effort (`xhigh` on 4.6). `/provider`
@@ -249,11 +264,14 @@ configured catalog when the endpoint cannot be reached. Picking a model that
249
264
  is not stored in the provider profile automatically adds it to
250
265
  `llm-pi-ai.providers.<id>.models` so the harness can serve it.
251
266
 
252
- Subagents follow the parent session's provider by default and run on the
253
- lightweight `deepseek-v4-flash` model. `/submodel [model-id]` picks (or
254
- directly sets) the subagent model, and `/subeffort` picks the subagent
255
- reasoning effort or restores the provider default. Both commands are
256
- remembered under `ssh-tui-subagent` in `$DSH_HOME/settings.yaml`.
267
+ Subagents follow the parent session's provider by default. Switching
268
+ provider/model persists the subagent model automatically (closest name to
269
+ the parent's, `flash`-suffixed ids first — `deepseek-v4-flash`,
270
+ `grok-4.5`); no dialog is shown, and `/submodel` still overrides it.
271
+ `/submodel [model-id]` picks (or directly sets) the subagent model, and
272
+ `/subeffort` picks the subagent reasoning effort or restores the provider
273
+ default. Both commands are remembered under `ssh-tui-subagent` in
274
+ `$DSH_HOME/settings.yaml`.
257
275
  `/subagents` lists active subagents, and `/subagents kill <session-id> [more ids...]`
258
276
  releases selected continuable children using the harness 0.1.1
259
277
  `drainContinuableChildren` capability.
@@ -289,10 +307,12 @@ labelled `(images ok)` in the command list and completion hints.
289
307
  - **OpenCode Zen** is metered — the TUI points at `https://opencode.ai/zen`.
290
308
 
291
309
  OpenCode Go / SuperGrok quota is fetched silently at start and on a
292
- window-based cadence; the footer shows remaining %. A transcript line
293
- appears only when remaining crosses 50% / 25% / 10% / 5%. `/usage` or
294
- `/balance` still prints the full snapshot. Cadence: every 10 turns for a
295
- 5-hour cap (every 4 when near), every 50 for weekly (every 10 when near),
310
+ window-based cadence; the footer shows plan name + remaining bar + percent,
311
+ and on a narrow row drops the plan name first so the bar and percent stay.
312
+ DeepSeek official balance stays on `/balance` and never occupies the footer.
313
+ A transcript line appears only when remaining crosses 50% / 25% / 10% / 5%.
314
+ `/usage` or `/balance` still prints the full snapshot. Cadence: every 10 turns
315
+ for a 5-hour cap (every 4 when near), every 50 for weekly (every 10 when near),
296
316
  every 80 for monthly (every 20 when near).
297
317
 
298
318
  The startup screen shows the official DeepSeek whale logo (rendered from the
@@ -310,7 +330,9 @@ the raw reasoning as it arrives. Assistant replies render in bold white with
310
330
  terminal markdown support: heading levels (H1 enlarged/underlined, H2
311
331
  underlined, H3 colored), bold, italic, inline code, fenced code blocks,
312
332
  lists, quotes, and links all get ANSI styling while remaining
313
- width-wrapped for the terminal. Reasoning, tool, subagent, plan, and question cards are
333
+ width-wrapped for the terminal. System-prompt / `<system-reminder>` / `AGENTS.md` injections collapse to a
334
+ `提示词注入:系统预设 AGENTS.MD` card (sources joined when several match).
335
+ Reasoning, tool, subagent, plan, question, and prompt cards are
314
336
  each expandable/collapsible independently. Empty input: `↑`/`↓` (same as
315
337
  `Ctrl+N`/`Ctrl+P`) move the highlight, `Enter` toggles, `Ctrl+R` toggles all,
316
338
  `Esc` drops the selection. Click a card header to toggle it. Subagent cards
@@ -327,18 +349,17 @@ animated spinner plus `运行中 · 工具 N` while working, `✓ 已完成` for
327
349
  seconds after completion, and `待命` when idle. A terminal bell rings on
328
350
  completion (`DSH_TUI_NO_BELL=1` disables it).
329
351
 
330
- Tool calls render as compact cards instead of raw argument JSON. A colored
331
- dot leads each card yellow while running, green on success, red on failure
332
- (a shell command with a non-zero exit or signal also turns red, with a
333
- `[退出码 N]` / `[信号 X]` suffix). Shell tools show the command as
334
- `$ command`, file mutations (`edit` / `write` / `str_replace_editor`) render
335
- the applied change git-style: a path header, `-` lines on a light-red
336
- background, `+` lines on a light-green background, and a `└ +N -M · K file(s)`
337
- footer. File-mutation diffs are shown in full (never collapsed to a `… more`
338
- line) and their cards start expanded. Other tools show a short argument
339
- summary and start collapsed to a single line (the command, truncated with
340
- `…` when long); expand to reveal output or the result body. Expanded generic
341
- calls convert their JSON arguments and JSON results into readable indented
352
+ Tool calls render as compact cards instead of raw argument JSON. The title
353
+ stays the default foreground; only the status dot and `[ok]` / `[error]` /
354
+ `[running…]` (plus `[退出码 N]` / `[信号 X]`) are yellow / green / red.
355
+ Shell tools show the command as dim-grey `$ command`. File mutations
356
+ (`edit` / `write` / `str_replace_editor`) render the applied change
357
+ git-style: a path header, `-` lines on a dark-red background, `+` lines on
358
+ a dark-green background, and a `└ +N -M · K file(s)` footer. Expanding a
359
+ card whose body fits the workspace shows it in place; if it would overflow,
360
+ a dedicated inspect view opens (`Esc` returns to the session). Other tools
361
+ show a short argument summary and start collapsed. Expanded generic calls
362
+ convert their JSON arguments and JSON results into readable indented
342
363
  content — key/value fields, bullet lists, and multiline blocks for
343
364
  code/content — instead of raw JSON text.
344
365
 
package/README.md CHANGED
@@ -51,12 +51,14 @@ dsh --profile tui
51
51
  `▸ 已思考 · N 行`,可单独展开;思考过程中也能实时展开/收起查看原文;
52
52
  - 工作区支持 markdown 渲染:多级标题(H1 放大/下划线、H2 下划线、H3 着色)、
53
53
  粗体、斜体、行内代码、代码块、列表、引用与链接;模型最终回复以粗体白色显示;
54
- - 工具调用卡片化:彩色状态点(运行黄 / 成功绿 / 失败红)、shell 命令友好展示、
55
- 编辑工具 git 风格 diff(`-` 浅红底 / `+` 浅绿底 / 文件统计,编辑卡片默认展开且
56
- diff 内容不截断)、JSON 参数与结果自动转可读内容;
54
+ - 系统提示词 / `system-reminder` / `AGENTS.md` 等注入折叠为「提示词注入:系统预设 AGENTS.MD」卡片,默认收起,Enter 展开看全文;
55
+ - 工具调用卡片化:标题默认色,只把状态点与 `[ok]`/`[error]` 染成黄/绿/红;
56
+ shell 命令浅灰、路径 cyan;编辑工具 git 风格 diff(`-` 暗红底 / `+` 暗绿底 /
57
+ 文件统计)。正文超出窗口时单独全览(Esc 返回),放得下就在工作区展开;JSON 参数与结果自动转可读内容;
57
58
  - 转录区滚动回看(`PgUp`/`PgDn`、鼠标滚轮),点击思考/工具标题行直接展开收起;
58
59
  - 输入框下方两行底栏:第一行链路芯片 + 按宽度丢组的会话数字(轮次、入/出 token、速度);
59
- 第二行只留一个活动词(运行中 / 工具 N / 子代理 N / 压缩中…),身份收到右侧;
60
+ 第二行只留一个活动词(运行中 / 工具 N / 子代理 N / 压缩中…),身份收到右侧(含 `目录:srv`;点击打印完整工作目录);
61
+ - 恢复旧会话会切到该会话记录的工作目录;新建会话用启动时的当前目录;
60
62
  - 历史会话启动选择器:`dsh --profile tui --resume`(或 `resume`)先选会话再进入;
61
63
  - 终端窗口标题栏:运行中旋转图标 + `运行中 · 工具 N`,完成后 `✓ 已完成`,并响
62
64
  一声终端铃(`DSH_TUI_NO_BELL=1` 关闭);
@@ -79,10 +81,18 @@ dsh --profile tui
79
81
  可选:本机已有 SuperGrok / grok-bridge token 时再装配套 OAuth:
80
82
 
81
83
  ```bash
82
- dsh plugin --profile tui add github:cyjyyd/dsh-llm-xai-oauth
83
- dsh plugin --profile headless add github:cyjyyd/dsh-llm-xai-oauth
84
+ dsh plugin --profile tui add dsh-llm-xai-oauth
85
+ dsh plugin --profile headless add dsh-llm-xai-oauth
84
86
  ```
85
87
 
88
+ SuperGrok 的 access token 大约 1 小时过期。TUI 打开时会刷新即将过期的 token,`/usage` 遇到 401 也会再刷一次。机器长时间不开 dsh 时,请另开刷新进程,否则一打开就是 401:
89
+
90
+ ```bash
91
+ npx dsh-llm-xai-oauth daemon --install
92
+ ```
93
+
94
+ 说明见 [dsh-llm-xai-oauth](https://github.com/cyjyyd/dsh-llm-xai-oauth)。
95
+
86
96
  先确认链路再开 TUI(无 TTY 时 TUI 会直接退出):
87
97
 
88
98
  ```bash
@@ -111,7 +121,7 @@ tmux attach -t dsh
111
121
  发现新版本 dsh-ssh-tui 0.3.5(当前 0.3.4)。更新:dsh plugin --profile tui add dsh-ssh-tui
112
122
  ```
113
123
 
114
- `DSH_TUI_NO_UPDATE_CHECK=1` 可关掉。`/status` 里也能看到当前插件版本。
124
+ `DSH_TUI_NO_UPDATE_CHECK=1` 可关掉。`/status` 里也能看到当前插件版本、链路芯片、额度窗口,以及子代理模型是否与父路由同族。
115
125
 
116
126
  仓库内也可:`bash scripts/smoke-headless.sh`(记录出口摘要,不打印 token)。
117
127
 
@@ -184,12 +194,12 @@ dsh --profile tui --no-color
184
194
 
185
195
  | 键 | 作用 |
186
196
  | --- | --- |
187
- | `Enter` | 发送;运行中则插入指示;空输入且已选卡片时展开/收起 |
197
+ | `Enter` | 发送;运行中则插入指示;空输入且已选卡片时展开/收起。工具正文超出窗口则单独全览,`Esc` 返回 |
188
198
  | `↑` / `↓` | 空输入:在卡片间移动;有输入:历史。与 `Ctrl+N` / `Ctrl+P` 相同 |
189
199
  | `Ctrl+R` | 全部展开或全部收起 |
190
200
  | `Ctrl+T` | 折叠输入框(只影响显示) |
191
201
  | `Alt+1` / `2` / `3` / `4` | 跳到最新思考 / 计划 / 子代理 / 回复 |
192
- | `/find [类] 关键字` | 搜索并跳到该条完整消息(反色高亮)。类:`思考` `计划` `子代理` `回复`。`Ctrl+/` 或 `Alt+/` 打开 |
202
+ | `/find [类] 关键字` | 搜索并跳到该条完整消息(反色高亮)。类:`思考` `计划` `子代理` `回复` `提示词`。`Ctrl+/` 或 `Alt+/` 打开 |
193
203
  | `Ctrl+G` / `Alt+N` | 下一条搜索结果;`Alt+P` 上一条 |
194
204
  | 鼠标左键 | 点击卡片标题展开/收起 |
195
205
  | `PgUp` / `PgDn`、滚轮 | 转录回看 |
@@ -200,8 +210,9 @@ dsh --profile tui --no-color
200
210
 
201
211
  `/mode` 切换官方 preset:标准 (`standard`)、PTC (`ptc`;dsh 0.1.1 上仍是 `code`)、极简 (`minimal`)、创造 (`cordis`),以及本地安装的其它模式。
202
212
 
203
- 斜杠命令:`/help`、`/find`、`/model`、`/provider`、`/submodel`、`/subeffort`、`/mode`、`/resume`、
213
+ 斜杠命令:`/help`、`/find`、`/model`、`/provider`、`/language`(`/lang`)、`/submodel`、`/subeffort`、`/mode`、`/resume`、
204
214
  `/status`、`/subagents`、`/usage`(`/balance` 同义)、`/setup`、`/clear`,
215
+ 界面语言:`/language` 打开选择器,或 `/language zh` / `/language en` 直接切。优先 `DSH_TUI_LANG`,其次 `$DSH_HOME/settings.yaml` 的 `ssh-tui.language`,再跟 `LANG`/`LC_MESSAGES`。未知和 `C` locale 默认中文。
205
216
  以及 harness 自带命令(`/goal`、`/plan`、`/compact` 等)。`/compact` 进行中会显示
206
217
  「压缩上下文」卡片和底栏转圈,结束时写出回收的 token 数。模型请求失败会显示重试
207
218
  进度;会话标题由模型生成后写到窗口标题。harness 命令若声明
@@ -213,9 +224,10 @@ dsh --profile tui --no-color
213
224
  每个提供商上次的模型和思考强度会分开记住。`/setup` 只新增或更新当前这条
214
225
  API Key 提供商,不会冲掉其它路由。SuperGrok / X Premium 走本机 OAuth,不需要填 Key。
215
226
 
216
- 子代理默认跟随父会话的提供方,并尽量选同一家的轻量模型:DeepSeek 用
217
- `deepseek-v4-flash` / `deepseek-v4-flash-vision-exp`,xAI 用 `grok-4.5`。
218
- `/model` 或 `/setup` 换提供商(OAuth / API Key 都一样)时会自动同步子代理:
227
+ 子代理默认跟随父会话的提供方,并尽量选同一家的轻量模型:按父会话所选模型名
228
+ 近似匹配,`flash` 结尾的优先——DeepSeek `deepseek-v4-flash`,xAI 用
229
+ `grok-4.5`。`/model` 或 `/provider` 换提供商(OAuth / API Key 都一样)时会
230
+ **自动落盘**子代理模型(不弹窗;想手动改再用 `/submodel`):
219
231
 
220
232
  - `/submodel [model-id]`:打开子代理模型选择器;带参数时直接指定模型;
221
233
  - `/subeffort`:选择子代理思考强度,或恢复为“跟随提供商默认”;
@@ -247,7 +259,7 @@ API Key 提供商,不会冲掉其它路由。SuperGrok / X Premium 走本机 O
247
259
  - **OpenCode Go**:官方 `/v1/usage`,滚动 5 小时 / 本周 / 本月剩余%;
248
260
  - **OpenCode Zen**:按量计费、没有固定额度,提示到 `https://opencode.ai/zen`。
249
261
 
250
- OpenCode Go / SuperGrok 启动和运行中都静默查询,底栏只显示剩余%;跨过 50% / 25% / 10% / 5% 才往工作区打 ⚠。`/usage` 或 `/balance` 仍打印完整结果。查询节奏按最紧窗口:5 小时额度每 10 轮(接近改 4 轮),周额度每 50 轮(接近改 10 轮),月额度每 80 轮(接近改 20 轮)。
262
+ OpenCode Go / SuperGrok 启动和运行中都静默查询,底栏显示套餐名 + 剩余条 + 百分比;窄屏先丢掉套餐名,只留条和百分比。DeepSeek 官方余额只出现在 `/balance`,不进底栏。跨过 50% / 25% / 10% / 5% 才往工作区打 ⚠。`/usage` 或 `/balance` 仍打印完整结果。查询节奏按最紧窗口:5 小时额度每 10 轮(接近改 4 轮),周额度每 50 轮(接近改 10 轮),月额度每 80 轮(接近改 20 轮)。
251
263
 
252
264
  ## 配置
253
265
 
@@ -264,6 +276,8 @@ ssh-tui-subagent:
264
276
  model: deepseek-v4-flash
265
277
  # provider 可省略:省略时子代理跟随父会话提供方
266
278
  # reasoningEffort 可省略:省略时跟随提供商/模型默认
279
+ ssh-tui:
280
+ language: zh # 或 en;/language 写入这里。DSH_TUI_LANG 优先
267
281
  ```
268
282
 
269
283
  `/model`、`/mode`、`/submodel` 与 `/subeffort` 的修改会写回这里,
@@ -326,6 +340,7 @@ src/session-list.ts 历史会话扫描与标签(共享给 /resume)
326
340
  src/session-lock.ts 同会话防双开
327
341
  src/update-check.ts npm 最新版提示(不自动升级)
328
342
  src/tui.ts 终端渲染、交互、统计、标题/铃声
343
+ src/i18n/ 中英界面字典(/language、DSH_TUI_LANG)
329
344
  cordis.patch.yml dsh bundle patch(挂载 TUI 与 agent-presets)
330
345
  scripts/ 安装 / 卸载 / 验证脚本
331
346
  ```