dsh-ssh-tui 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.
@@ -178,6 +178,7 @@ export declare class SshTui {
178
178
  private input;
179
179
  private cursor;
180
180
  private inputFolded;
181
+ private inPaste;
181
182
  private history;
182
183
  private historyIndex;
183
184
  private status;
@@ -326,6 +327,10 @@ export declare class SshTui {
326
327
  /** /usage and /quota: show Zen billing info or live Go quota usage. */
327
328
  private runUsageCommand;
328
329
  private readonly handleData;
330
+ /** Handle one data chunk that may contain bracketed-paste markers. */
331
+ private processPasteChunk;
332
+ /** Insert pasted text into the input buffer; CR/LF are literal newlines. */
333
+ private handlePasteText;
329
334
  private handlePlainText;
330
335
  private handleChar;
331
336
  private handleDialogChar;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-ssh-tui",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "description": "SSH-friendly interactive terminal TUI plugin for DeepSeek Harness",
5
5
  "keywords": [
6
6
  "deepseek-harness",
@@ -41,7 +41,7 @@
41
41
  "lib",
42
42
  "cordis.patch.yml",
43
43
  "README.md",
44
- "README.zh-CN.md",
44
+ "README.en.md",
45
45
  "LICENSE"
46
46
  ],
47
47
  "license": "MIT",
package/README.zh-CN.md DELETED
@@ -1,206 +0,0 @@
1
- # dsh-ssh-tui
2
-
3
- DeepSeek Harness(`dsh`)的 SSH 友好交互终端插件:纯 ANSI 聊天式转录、流式输出、
4
- 工具卡片、git 风格 diff、历史会话选择、滚动回看与鼠标点击展开,并带终端标题栏
5
- 进度与完成提示音。
6
-
7
- English: [README.md](README.md)
8
-
9
- ## 功能一览
10
-
11
- - 纯终端渲染,无需浏览器/鼠标/重量级终端框架,适合慢速或远程 SSH;
12
- - 模型思考流默认折叠,显示 `▸ 思考中 ⠹ · N 字 · Ns` 动画;结束后折叠为
13
- `▸ 已思考 · N 行`,可单独展开;思考过程中也能实时展开/收起查看原文;
14
- - 工作区支持 markdown 渲染:多级标题(H1 放大/下划线、H2 下划线、H3 着色)、
15
- 粗体、斜体、行内代码、代码块、列表、引用与链接;模型最终回复以粗体白色显示;
16
- - 工具调用卡片化:彩色状态点(运行黄 / 成功绿 / 失败红)、shell 命令友好展示、
17
- 编辑工具 git 风格 diff(`-` 浅红底 / `+` 浅绿底 / 文件统计,编辑卡片默认展开且
18
- diff 内容不截断)、JSON 参数与结果自动转可读内容;
19
- - 转录区滚动回看(`PgUp`/`PgDn`、鼠标滚轮),点击思考/工具标题行直接展开收起;
20
- - 输入框下方会话统计行:轮次/步数、模型与工具耗时、TTFT、tok/s、缓存命中率、
21
- 输入/输出 token(与 web 端口径一致);
22
- - 历史会话启动选择器:`dsh --profile tui --resume`(或 `resume`)先选会话再进入;
23
- - 终端窗口标题栏:运行中旋转图标 + `运行中 · 工具 N`,完成后 `✓ 已完成`,并响
24
- 一声终端铃(`DSH_TUI_NO_BELL=1` 关闭);
25
- - 审批、`ask_user_question`、子代理进度、`/mode` 模式切换、`/model` 模型切换、
26
- `/resume` 会话切换等完整支持。
27
-
28
- ## 环境要求
29
-
30
- - Node.js ≥ 22.19
31
- - DeepSeek Harness CLI:`npm i -g @deepseek-ai/dsh`
32
- - pnpm(`dsh plugin` 通过 pnpm 管理 profile 依赖)
33
- - 支持 ANSI 的终端(推荐 SSH 直连;Windows 用 PowerShell / Windows Terminal)
34
-
35
- ## 部署指南
36
-
37
- ### 方式一:一键脚本(推荐)
38
-
39
- ```bash
40
- git clone https://github.com/cyjyyd/dsh-ssh-tui.git
41
- cd dsh-ssh-tui
42
- bash scripts/install.sh # 默认安装到 tui profile
43
- ```
44
-
45
- 安装到其它 profile(例如自定义 `work` profile):
46
-
47
- ```bash
48
- bash scripts/install.sh work
49
- ```
50
-
51
- 脚本会依次:安装依赖 → 构建 `lib/` → 通过 `dsh plugin --profile <name> add link:<repo>`
52
- 把插件链接进 profile,并自动把 `dsh-ssh-tui` 加入该 profile 的 `dsh.profile.bundles`。
53
-
54
- ### 方式二:手动安装
55
-
56
- ```bash
57
- cd dsh-ssh-tui
58
- npm install --no-audit --no-fund
59
- npm run build
60
- dsh plugin --profile tui add "link:$(pwd)"
61
- ```
62
-
63
- ### 方式三:npm 安装(发布后)
64
-
65
- 前置要求:已全局安装 `@deepseek-ai/dsh`(`npm i -g @deepseek-ai/dsh`)且有 pnpm。
66
-
67
- ```bash
68
- dsh plugin --profile tui add dsh-ssh-tui
69
- # 或在仓库内快捷执行:bash scripts/install-npm.sh
70
- # 指定其它 profile:bash scripts/install-npm.sh work
71
- ```
72
-
73
- `dsh plugin add` 会从 npm 拉取包、写入 profile 依赖,并自动把 `dsh-ssh-tui`
74
- 加入该 profile 的 `dsh.profile.bundles`。
75
-
76
- ## 启动与命令行参数
77
-
78
- ```bash
79
- dsh --profile tui # 直接进入主界面(新建会话)
80
- dsh --profile tui --resume # 打开历史会话选择器
81
- dsh --profile tui resume # 同上(选择器)
82
- dsh --profile tui --resume <session-id> # 直接恢复指定会话
83
- dsh --profile tui resume <session-id> # 等价写法
84
- dsh --profile tui --new # 显式新建会话(默认即新建,供脚本使用)
85
- dsh --profile tui --model deepseek-v4-flash
86
- dsh --profile tui --provider <id>
87
- dsh --profile tui --no-color
88
- ```
89
-
90
- 选择器操作:`1-9` 选择历史会话;`0` / `Enter` 新建;`Esc` 取消退出。
91
-
92
- ## 交互与快捷键
93
-
94
- | 键 | 作用 |
95
- | --- | --- |
96
- | `Enter` | 发送;运行中则 steer 当前轮次;输入为空且有选中块时展开/收起 |
97
- | `↑` / `↓` | 输入为空时在思考/工具块间移动选择;有输入时切换历史 |
98
- | `Ctrl+N` / `Ctrl+P` | 在思考/工具块间移动选择 |
99
- | `Ctrl+R` | 全部展开/全部收起(逐项展开请用 `↑`/`↓` 选中后按 `Enter`) |
100
- | `Ctrl+T` | 折叠/展开输入框(折叠只影响显示,提交时仍为完整文本) |
101
- | 鼠标左键 | 点击思考/工具标题行直接展开/收起 |
102
- | `PgUp` / `PgDn`、滚轮 | 转录区滚动回看 |
103
- | `Esc` | 取消选择 / 回到底部 / 取消当前轮次 |
104
- | `Ctrl+C` | 中断当前轮次;空闲时退出 |
105
- | `Ctrl+D` | 退出 |
106
- | `Ctrl+L` | 重绘 |
107
-
108
- 斜杠命令:`/help`、`/model`、`/mode`、`/resume`、`/status`、`/subagents`、
109
- `/usage`(`/quota` 同义)、`/setup`、`/clear`,以及 harness 自带命令
110
- (`/goal`、`/plan`、`/compact` 等)。
111
-
112
- `/usage` 在当前提供商为 OpenCode 源时可用,并区分两种计费方式:
113
-
114
- - **OpenCode Go**:调用官方额度接口,显示滚动 5 小时 / 本周 / 本月用量
115
- 百分比、限流状态与重置时间;
116
- - **OpenCode Zen**:按 API 账单计费、没有固定额度,TUI 不假装查询余额,
117
- 只提示到 `https://opencode.ai/zen` 查看,并附本会话已记录的 token 用量。
118
-
119
- ## 配置
120
-
121
- ### 模型默认值(`$DSH_HOME/settings.yaml`)
122
-
123
- ```yaml
124
- agent-default-model:
125
- provider: opencode-go
126
- model: deepseek-v4-pro
127
- reasoningEffort: max
128
- agent-presets:
129
- default: standard
130
- ```
131
-
132
- `/model` 与 `/mode` 的修改会写回这里,web 端与 TUI 共用同一份设置。
133
-
134
- 对 OpenCode 和其他第三方提供商,`/model` 会先调用提供商的端点
135
- (`GET {baseURL}/models`)获取实时模型列表;端点不可达时回退到已配置的
136
- 模型列表。若选中的模型尚未写入提供商配置,会自动追加到
137
- `llm-pi-ai.providers.<id>.models`,保证 Harness 可以正常调用。
138
-
139
- 首次配置向导的自定义/OpenCode 提供商步骤中,输入模型 ID 前可按
140
- `Ctrl+F` 直接从端点拉取模型列表,免去手动输入。
141
-
142
- ### profile 用户层
143
-
144
- 每个 profile 的 `cordis.patch.yml` 是用户覆盖层,可覆盖插件 patch 的任何行;
145
- `--patch <file>` 可临时叠加。
146
-
147
- ## 验证
148
-
149
- ```bash
150
- bash scripts/verify.sh # 检查 profile 组合与 CLI 语法
151
- ```
152
-
153
- 或手动:
154
-
155
- ```bash
156
- dsh --profile tui --dump-config | grep -A12 'id: ssh-tui'
157
- dsh --profile tui --help
158
- ```
159
-
160
- ## 卸载
161
-
162
- ```bash
163
- bash scripts/uninstall.sh # 默认 tui profile
164
- bash scripts/uninstall.sh work # 指定 profile
165
- ```
166
-
167
- 卸载只移除 profile 中的插件依赖与 bundle 层,不会删除会话数据。
168
-
169
- ## 隐私与上传安全
170
-
171
- - 所有会话、凭据、设置都保存在 `$DSH_HOME`(默认 `~/.dsh`),**不落在本仓库**;
172
- - `.gitignore` 已排除 `node_modules/`、`lib/`、`.env*`、`*.key`、`session*.jsonl*`、
173
- `sessions/`、日志与临时文件;
174
- - 上传前请自查:`find . -type f | grep -Ei 'credential|\.env|\.key|session'`;
175
- - 插件本身不收集、不上传任何数据;会话日志仅按需读写于本机 `$DSH_HOME`。
176
-
177
- ## 开发与目录结构
178
-
179
- ```text
180
- src/index.ts 插件入口:启动选择器、会话创建/恢复/切换
181
- src/startup.ts 命令行参数解析(--resume / --new / --model ...)
182
- src/picker.ts 启动历史会话选择器
183
- src/session-list.ts 历史会话扫描与标签(共享给 /resume)
184
- src/tui.ts 终端渲染、交互、统计、标题/铃声
185
- cordis.patch.yml dsh bundle patch(挂载 TUI 与 agent-presets)
186
- scripts/ 安装 / 卸载 / 验证脚本
187
- ```
188
-
189
- ```bash
190
- npm install
191
- npm run typecheck
192
- npm run build
193
- ```
194
-
195
- ## 常见问题
196
-
197
- - **`dsh-ssh-tui: both stdin and stdout must be TTYs`**:必须从真实终端/SSH 会话启动。
198
- - **pnpm 拒绝 git 依赖的构建脚本**:git 安装的插件需要把 pnpm 打印的 key 加入
199
- profile 的 `pnpm-workspace.yaml` 的 `allowBuilds`。
200
- - **标题栏或铃声不生效**:确认终端支持 OSC 0 与 BEL;铃声可用
201
- `DSH_TUI_NO_BELL=1` 关闭。
202
- - **滚轮误触取消**:已加入转义序列缓冲,网络拆包也不会把 `ESC` 当取消。
203
-
204
- ## License
205
-
206
- MIT,见 [LICENSE](LICENSE)。