@xiaoqiong0v0/opencode-ssh-tool 0.2.7 → 0.4.0
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.md +34 -25
- package/dist/config.d.ts +2 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +5 -0
- package/dist/config.js.map +1 -1
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +1 -1
- package/dist/constants.js.map +1 -1
- package/dist/i18n.d.ts +275 -32
- package/dist/i18n.d.ts.map +1 -1
- package/dist/i18n.js +199 -30
- package/dist/i18n.js.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +305 -264
- package/dist/index.js.map +1 -1
- package/dist/local-session.d.ts +117 -0
- package/dist/local-session.d.ts.map +1 -0
- package/dist/local-session.js +365 -0
- package/dist/local-session.js.map +1 -0
- package/dist/server-manager.d.ts +3 -1
- package/dist/server-manager.d.ts.map +1 -1
- package/dist/server-manager.js +3 -2
- package/dist/server-manager.js.map +1 -1
- package/dist/server.d.ts +3 -1
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +135 -49
- package/dist/server.js.map +1 -1
- package/dist/session-store.d.ts +6 -0
- package/dist/session-store.d.ts.map +1 -1
- package/dist/session-store.js +15 -0
- package/dist/session-store.js.map +1 -1
- package/dist/utils.d.ts +7 -0
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +13 -1
- package/dist/utils.js.map +1 -1
- package/package.json +4 -3
package/README.md
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
# opencode-ssh-tool
|
|
2
2
|
|
|
3
|
-
opencode 插件:让 opencode
|
|
3
|
+
opencode 插件:让 opencode 像人一样操作**长驻交互式终端会话**——远程 SSH(ssh2 PTY)与本地/容器(Bun.Terminal,如 `pwsh`、`docker exec -it`)。连接一次,后续在会话里连续执行命令,保留当前目录、环境变量、交互状态;命令执行同样受 opencode 权限系统管控(类似内置 Bash 工具的审批)。
|
|
4
4
|
|
|
5
5
|
## 特性
|
|
6
6
|
|
|
7
|
-
- **长驻会话**:`
|
|
7
|
+
- **长驻会话**:`ssh_cli connect` 建立连接后,`ssh_cli exec` 在同一会话执行命令,保留 cwd/环境/后台进程/sudo 缓存
|
|
8
8
|
- **PTY 交互**:分配伪终端,可处理 sudo 密码、vi、top 等交互程序
|
|
9
9
|
- **权限管控**:只读白名单直接放行、危险命令黑名单硬拒、其余走 `context.ask()` 用户审批
|
|
10
10
|
- **命令完成判定**:哨兵标记 + 静默窗口 + 超时三重兜底,动画输出(进度条等)自动识别
|
|
@@ -23,17 +23,24 @@ opencode 插件:让 opencode 像人一样操作**长驻交互式 SSH 会话**
|
|
|
23
23
|
|
|
24
24
|
发布到 npm 后通过 `plugin` 数组引用;或本地调试时挂载到项目 `.opencode/` 文件夹。
|
|
25
25
|
|
|
26
|
-
## 工具
|
|
27
|
-
|
|
28
|
-
| 工具 | 入参 | 行为 |
|
|
29
|
-
|---|---|---|
|
|
30
|
-
| `
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
26
|
+
## 工具
|
|
27
|
+
|
|
28
|
+
| 工具 | 入参 | 行为 |
|
|
29
|
+
|---|---|---|
|
|
30
|
+
| `ssh_cli` | `args`(完整命令行字符串) | **CLI 风格单工具**:SSH / 本地 / 容器终端会话。子命令:`connect` / `local` / `exec` / `read` / `send` / `status` / `disconnect` / `help`;用 `help` 查看完整用法 |
|
|
31
|
+
|
|
32
|
+
```text
|
|
33
|
+
ssh_cli connect root@host:22 [-n name] [-p password|file:path] # SSH 连接
|
|
34
|
+
ssh_cli local "pwsh|docker exec -it <容器> sh" [-n name] [-c cwd] # 本地/容器终端
|
|
35
|
+
ssh_cli exec "<command>" [-n name] [-w] # 执行命令
|
|
36
|
+
ssh_cli read [-n name] [-s buffer|history] [-l limit] [--head] # 读输出
|
|
37
|
+
ssh_cli send "<text>" [-n name] # 发送按键(sudo 密码等)
|
|
38
|
+
ssh_cli status [-n name] # 状态
|
|
39
|
+
ssh_cli disconnect [-n name] # 断开
|
|
40
|
+
ssh_cli help # 完整用法
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
> 一个 opencode 会话可创建**多个命名终端**(如 `db`、`web`、`prod`),用不同 `name` 并行维护;同名重复创建会先关闭旧的。工具只暴露一个 `args` 字符串参数,模型像敲命令行一样调用,`help` 引导其学会所有用法(单工具多命令模式,省 token)。
|
|
37
44
|
|
|
38
45
|
## 配置
|
|
39
46
|
|
|
@@ -85,7 +92,7 @@ opencode 插件:让 opencode 像人一样操作**长驻交互式 SSH 会话**
|
|
|
85
92
|
3. **环境变量密码**:`SSH_PASS_<HOST大写>` 优先,回退 `SSH_PASSWORD`
|
|
86
93
|
|
|
87
94
|
> [!WARNING] 风险警告
|
|
88
|
-
> `
|
|
95
|
+
> `ssh_cli connect` 的 `password` 参数(明文或 `file:` 路径)允许模型直接凭密码建立连接,**绕过密钥认证,一旦建立便无法像正常会话那样可靠授权与撤销**——远程主机上的命令操作难以被 opencode 权限系统有效管控。
|
|
89
96
|
>
|
|
90
97
|
> **最佳用途**:仅用于一次性**辅助安装 opencode 到远程目标**(bootstrap),或完全可信的临时环境。
|
|
91
98
|
>
|
|
@@ -94,7 +101,7 @@ opencode 插件:让 opencode 像人一样操作**长驻交互式 SSH 会话**
|
|
|
94
101
|
## 权限管控
|
|
95
102
|
|
|
96
103
|
```text
|
|
97
|
-
|
|
104
|
+
ssh_cli exec(command)
|
|
98
105
|
├─ 命中 DENY 黑名单(rm -rf / shutdown reboot mkfs 等) → 直接拒绝
|
|
99
106
|
├─ 命中只读白名单 且 无 shell 元字符 → 直接放行
|
|
100
107
|
└─ 其他 → context.ask() 用户审批(:allow / :deny / :always)
|
|
@@ -102,11 +109,11 @@ ssh_exec(command)
|
|
|
102
109
|
|
|
103
110
|
- 只读白名单:`ls|cd|cat|grep|tail|head|ps|df|free|pwd|env|echo|curl|wget|git status|whoami|hostname|date|uname|uptime`
|
|
104
111
|
- 命令含 `;` `&&` `|` `$()` 等 shell 元字符 → 降级走 ask(防拼接绕过)
|
|
105
|
-
- 高危命令不进 ask 直接拒,`
|
|
112
|
+
- 高危命令不进 ask 直接拒,`ssh_cli connect` 也走审批
|
|
106
113
|
|
|
107
114
|
## HTTP 终端查看
|
|
108
115
|
|
|
109
|
-
服务默认开启(配置 `server.enabled`)。`
|
|
116
|
+
服务默认开启(配置 `server.enabled`)。`ssh_cli status` / `ssh_cli read`(history 模式)会返回实际地址(端口 0 时自动分配,避免冲突):
|
|
110
117
|
|
|
111
118
|
```
|
|
112
119
|
浏览器访问 http://127.0.0.1:<port> 查看可滚动、每 2s 自动刷新的终端记录
|
|
@@ -148,19 +155,21 @@ npm publish # 只发布 dist/
|
|
|
148
155
|
|
|
149
156
|
需真实 SSH 主机(可用 Docker 测试环境,见 `.tmp/ssh-test-docker.ps1`):
|
|
150
157
|
|
|
151
|
-
- [ ] `
|
|
152
|
-
- [ ] `
|
|
153
|
-
- [ ] `
|
|
154
|
-
- [ ] 交互场景:`
|
|
158
|
+
- [ ] `ssh_cli connect` → 登录成功,cwd 为登录目录
|
|
159
|
+
- [ ] `ssh_cli exec("ls")` 连续多次,确认永不重连(同一会话)
|
|
160
|
+
- [ ] `ssh_cli exec("cd /var/log && pwd")` 后 `ssh_cli exec("pwd")` = `/var/log`(目录保持)
|
|
161
|
+
- [ ] 交互场景:`ssh_cli exec("sudo ...")` 触发密码提示 → `ssh_cli read` 配合
|
|
155
162
|
- [ ] 白名单命令不弹审批直接执行;`rm -rf` 被拒绝
|
|
156
163
|
- [ ] 白名单外命令弹 `context.ask()`,`:deny` 拒绝 / `:allow` 放行
|
|
157
|
-
- [ ] 长命令超时:`
|
|
158
|
-
- [ ] `
|
|
159
|
-
- [ ] `
|
|
160
|
-
- [ ] `
|
|
164
|
+
- [ ] 长命令超时:`ssh_cli exec("sleep 60")` 30s 超时返回,不挂死会话
|
|
165
|
+
- [ ] `ssh_cli read` 取前/后 N 条历史输出(含 `includeCommand`、`source=buffer`)
|
|
166
|
+
- [ ] `ssh_cli status` / HTTP 页面浏览器可访问
|
|
167
|
+
- [ ] `ssh_cli disconnect` 后连接释放
|
|
161
168
|
|
|
162
169
|
## 文档
|
|
163
170
|
|
|
164
171
|
- `docs/requirements/需求说明.md` — 原始需求
|
|
165
172
|
- `docs/design/方案分析.md` — 技术分析、决策、风险
|
|
166
173
|
- `docs/design/结构设计.md` — 编码依据
|
|
174
|
+
|
|
175
|
+
|
package/dist/config.d.ts
CHANGED
package/dist/config.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAErC,gBAAgB;AAChB,MAAM,WAAW,YAAY;IAC3B,OAAO,EAAE,OAAO,CAAA;IAChB,IAAI,EAAE,MAAM,CAAA;CACb;AAED,wBAAwB;AACxB,MAAM,WAAW,aAAa;IAC5B,WAAW,EAAE,MAAM,CAAA;CACpB;AAED,wCAAwC;AACxC,MAAM,WAAW,gBAAgB;IAC/B,8CAA8C;IAC9C,IAAI,EAAE,MAAM,EAAE,CAAA;IACd,qDAAqD;IACrD,KAAK,EAAE,MAAM,EAAE,CAAA;CAChB;AAED,aAAa;AACb,MAAM,WAAW,UAAU;IACzB,MAAM,EAAE,YAAY,CAAA;IACpB,OAAO,EAAE,aAAa,CAAA;IACtB,4CAA4C;IAC5C,QAAQ,EAAE,IAAI,CAAA;IACd,UAAU,EAAE,gBAAgB,CAAA;CAC7B;
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAErC,gBAAgB;AAChB,MAAM,WAAW,YAAY;IAC3B,OAAO,EAAE,OAAO,CAAA;IAChB,IAAI,EAAE,MAAM,CAAA;CACb;AAED,wBAAwB;AACxB,MAAM,WAAW,aAAa;IAC5B,WAAW,EAAE,MAAM,CAAA;CACpB;AAED,wCAAwC;AACxC,MAAM,WAAW,gBAAgB;IAC/B,8CAA8C;IAC9C,IAAI,EAAE,MAAM,EAAE,CAAA;IACd,qDAAqD;IACrD,KAAK,EAAE,MAAM,EAAE,CAAA;CAChB;AAED,aAAa;AACb,MAAM,WAAW,UAAU;IACzB,MAAM,EAAE,YAAY,CAAA;IACpB,OAAO,EAAE,aAAa,CAAA;IACtB,4CAA4C;IAC5C,QAAQ,EAAE,IAAI,CAAA;IACd,8CAA8C;IAC9C,OAAO,EAAE,IAAI,CAAA;IACb,UAAU,EAAE,gBAAgB,CAAA;CAC7B;AA0ED;;;GAGG;AACH,wBAAgB,UAAU,IAAI,UAAU,CAiCvC"}
|
package/dist/config.js
CHANGED
|
@@ -14,6 +14,7 @@ const DEFAULT_CONFIG = {
|
|
|
14
14
|
maxMessages: 100,
|
|
15
15
|
},
|
|
16
16
|
toolLang: "en",
|
|
17
|
+
webLang: "en",
|
|
17
18
|
permission: {
|
|
18
19
|
deny: [],
|
|
19
20
|
allow: [],
|
|
@@ -39,6 +40,8 @@ const CONFIG_TEMPLATE = `{
|
|
|
39
40
|
},
|
|
40
41
|
// 工具描述语言:"en" | "zh"(默认 "en",可用环境变量 SSH_TOOL_LANG 覆盖)
|
|
41
42
|
"toolLang": "en",
|
|
43
|
+
// Web 界面语言:"en" | "zh"(默认 "en",可用环境变量 SSH_TOOL_LANG 覆盖)
|
|
44
|
+
"webLang": "en",
|
|
42
45
|
// 权限自定义正则(追加到内置默认,控制"拒绝"与"需审批"命令)
|
|
43
46
|
"permission": {
|
|
44
47
|
// 内置默认危险命令黑名单(命中直接拒绝,不需要重复添加):
|
|
@@ -84,6 +87,7 @@ export function loadConfig() {
|
|
|
84
87
|
const history = (raw.history ?? {});
|
|
85
88
|
const permission = (raw.permission ?? {});
|
|
86
89
|
const toolLang = raw.toolLang === "zh" ? "zh" : "en";
|
|
90
|
+
const webLang = raw.webLang === "zh" ? "zh" : "en";
|
|
87
91
|
return {
|
|
88
92
|
server: {
|
|
89
93
|
enabled: server.enabled ?? DEFAULT_CONFIG.server.enabled,
|
|
@@ -93,6 +97,7 @@ export function loadConfig() {
|
|
|
93
97
|
maxMessages: Math.max(1, history.maxMessages ?? DEFAULT_CONFIG.history.maxMessages),
|
|
94
98
|
},
|
|
95
99
|
toolLang,
|
|
100
|
+
webLang,
|
|
96
101
|
permission: {
|
|
97
102
|
deny: Array.isArray(permission.deny) ? permission.deny : [],
|
|
98
103
|
allow: Array.isArray(permission.allow) ? permission.allow : [],
|
package/dist/config.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,gEAAgE;AAEhE,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,SAAS,CAAA;AAC5E,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AACjC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,gEAAgE;AAEhE,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,SAAS,CAAA;AAC5E,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AACjC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAiChC,YAAY;AACZ,MAAM,cAAc,GAAe;IACjC,MAAM,EAAE;QACN,OAAO,EAAE,IAAI;QACb,6BAA6B;QAC7B,IAAI,EAAE,CAAC;KACR;IACD,OAAO,EAAE;QACP,qBAAqB;QACrB,WAAW,EAAE,GAAG;KACjB;IACD,QAAQ,EAAE,IAAI;IACd,OAAO,EAAE,IAAI;IACb,UAAU,EAAE;QACV,IA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"mappings":"AAEA,kCAAkC;AAClC,eAAO,MAAM,cAAc,QAC0F,CAAA;AAErH,6BAA6B;AAC7B,eAAO,MAAM,IAAI,
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAEA,kCAAkC;AAClC,eAAO,MAAM,cAAc,QAC0F,CAAA;AAErH,6BAA6B;AAC7B,eAAO,MAAM,IAAI,QACsmB,CAAA;AAEvnB,qCAAqC;AACrC,eAAO,MAAM,UAAU,QAAgB,CAAA;AAEvC,2BAA2B;AAC3B,eAAO,MAAM,eAAe,QAAS,CAAA;AAErC,+BAA+B;AAC/B,eAAO,MAAM,eAAe,MAAM,CAAA;AAElC,uCAAuC;AACvC,eAAO,MAAM,mBAAmB,OAAQ,CAAA;AAExC,oBAAoB;AACpB,eAAO,MAAM,gBAAgB,QAAS,CAAA;AAEtC,wBAAwB;AACxB,eAAO,MAAM,QAAQ,MAAM,CAAA;AAC3B,eAAO,MAAM,QAAQ,MAAM,CAAA;AAE3B,qBAAqB;AACrB,eAAO,MAAM,cAAc,QAAS,CAAA;AAEpC,gCAAgC;AAChC,eAAO,MAAM,QAAQ,kBAAkB,CAAA;AAEvC,8BAA8B;AAC9B,eAAO,MAAM,SAAS,8CAA8C,CAAA"}
|
package/dist/constants.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/** 只读命令白名单(整串匹配,含元字符的命令不适用白名单) */
|
|
3
3
|
export const ALLOW_READONLY = /^(?:ls|cd|cat|grep|tail|head|ps|df|free|pwd|env|echo|curl|wget|git status|whoami|hostname|date|uname|uptime)\b.*$/;
|
|
4
4
|
/** 高危命令黑名单(命中直接拒绝,不进 ask) */
|
|
5
|
-
export const DENY = /(?:rm\s+(?:-[a-z]*[fr][a-z]*(?:\s+-[a-z]*[fr][a-z]*)?\s+)?(?:\/(?:\s|$)|~|\.(?:\.)?|\/(?:etc|var|usr|boot|bin|sbin|lib|lib64|opt|root)(?:\s|$))|shutdown|reboot|halt|poweroff|mkfs|mkswap|fdisk|parted|dd\s|iptables|ufw|firewall-cmd|systemctl|service\s+\w+\s+(?:stop|restart|kill)|kill(?:all)?\s|pkill\s|passwd\s|useradd|userdel|groupadd|groupdel|chown\s+-R|chmod\s+-R\s+777\s+\/|apt\s+remove|apt-get\s+remove|npm\s+(?:uninstall|rm)\b|DROP\s+TABLE|TRUNCATE\s+TABLE|DROP\s+DATABASE|:\(\)\s*\{|>\s*\/etc\/(?:passwd|shadow|sudoers|fstab)|curl\s+.*\|\s*(?:ba)?sh|wget\s+.*\|\s*(?:ba)?sh|base64\s+-d\s*[|>])/;
|
|
5
|
+
export const DENY = /(?:rm\s+(?:-[a-z]*[fr][a-z]*(?:\s+-[a-z]*[fr][a-z]*)?\s+)?(?:\/(?:\s|$)|~|\.(?:\.)?|\/(?:etc|var|usr|boot|bin|sbin|lib|lib64|opt|root)(?:\s|$))|shutdown|reboot|halt|poweroff|mkfs|mkswap|fdisk|parted|dd\s+(?:if|of|bs|count|conv)\s*=|iptables|ufw|firewall-cmd|systemctl|service\s+\w+\s+(?:stop|restart|kill)|kill(?:all)?\s|pkill\s|passwd\s|useradd|userdel|groupadd|groupdel|chown\s+-R|chmod\s+-R\s+777\s+\/|apt\s+remove|apt-get\s+remove|npm\s+(?:uninstall|rm)\b|DROP\s+TABLE|TRUNCATE\s+TABLE|DROP\s+DATABASE|:\(\)\s*\{|>\s*\/etc\/(?:passwd|shadow|sudoers|fstab)|curl\s+.*\|\s*(?:ba)?sh|wget\s+.*\|\s*(?:ba)?sh|base64\s+-d\s*[|>])/;
|
|
6
6
|
/** shell 元字符(出现即降级走 ask,防白名单拼接绕过) */
|
|
7
7
|
export const SHELL_META = /[;|&`$()<>]/;
|
|
8
8
|
/** 单次 ssh_exec 默认超时(毫秒) */
|
package/dist/constants.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAEhC,kCAAkC;AAClC,MAAM,CAAC,MAAM,cAAc,GACzB,mHAAmH,CAAA;AAErH,6BAA6B;AAC7B,MAAM,CAAC,MAAM,IAAI,GACf,
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAEhC,kCAAkC;AAClC,MAAM,CAAC,MAAM,cAAc,GACzB,mHAAmH,CAAA;AAErH,6BAA6B;AAC7B,MAAM,CAAC,MAAM,IAAI,GACf,qnBAAqnB,CAAA;AAEvnB,qCAAqC;AACrC,MAAM,CAAC,MAAM,UAAU,GAAG,aAAa,CAAA;AAEvC,2BAA2B;AAC3B,MAAM,CAAC,MAAM,eAAe,GAAG,MAAM,CAAA;AAErC,+BAA+B;AAC/B,MAAM,CAAC,MAAM,eAAe,GAAG,GAAG,CAAA;AAElC,uCAAuC;AACvC,MAAM,CAAC,MAAM,mBAAmB,GAAG,KAAK,CAAA;AAExC,oBAAoB;AACpB,MAAM,CAAC,MAAM,gBAAgB,GAAG,MAAM,CAAA;AAEtC,wBAAwB;AACxB,MAAM,CAAC,MAAM,QAAQ,GAAG,GAAG,CAAA;AAC3B,MAAM,CAAC,MAAM,QAAQ,GAAG,GAAG,CAAA;AAE3B,qBAAqB;AACrB,MAAM,CAAC,MAAM,cAAc,GAAG,MAAM,CAAA;AAEpC,gCAAgC;AAChC,MAAM,CAAC,MAAM,QAAQ,GAAG,eAAe,CAAA;AAEvC,8BAA8B;AAC9B,MAAM,CAAC,MAAM,SAAS,GAAG,2CAA2C,CAAA"}
|
package/dist/i18n.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export type Lang = "en" | "zh";
|
|
2
2
|
/** 平铺文案键:值为 en/zh 字符串对的字典键(排除嵌套 args 对象) */
|
|
3
|
-
type FlatKey = {
|
|
3
|
+
export type FlatKey = {
|
|
4
4
|
[K in keyof typeof T]: (typeof T)[K] extends Record<Lang, string> ? K : never;
|
|
5
5
|
}[keyof typeof T];
|
|
6
6
|
/**
|
|
@@ -37,18 +37,18 @@ export declare const T: {
|
|
|
37
37
|
readonly zh: "密码认证密码(可选)。支持明文或 'file:<绝对路径>' 从文件读取(避免暴露在上下文中)。省略时回退到 SSH 私钥 / agent / 环境变量 SSH_PASSWORD。";
|
|
38
38
|
};
|
|
39
39
|
};
|
|
40
|
-
readonly
|
|
41
|
-
readonly en: "Execute a command in
|
|
42
|
-
readonly zh: "
|
|
40
|
+
readonly term_exec: {
|
|
41
|
+
readonly en: "Execute a command in an SSH, local or container terminal (by terminal name), preserving cwd and environment. Commands outside the read-only allowlist require user approval.";
|
|
42
|
+
readonly zh: "在 SSH / 本地 / 容器终端(按终端名)执行命令,保留 cwd 与环境变量;白名单外的命令需用户审批。";
|
|
43
43
|
};
|
|
44
|
-
readonly
|
|
44
|
+
readonly term_exec_args: {
|
|
45
45
|
readonly command: {
|
|
46
46
|
readonly en: "Shell command to execute";
|
|
47
47
|
readonly zh: "要执行的 shell 命令";
|
|
48
48
|
};
|
|
49
49
|
readonly waitResult: {
|
|
50
|
-
readonly en: "Wait for the command to finish and return its output. Default false: submit async, return immediately; read results later via
|
|
51
|
-
readonly zh: "是否等待命令完成并返回其输出。默认 false:异步提交,立即返回;稍后通过
|
|
50
|
+
readonly en: "Wait for the command to finish and return its output. Default false: submit async, return immediately; read results later via term_read.";
|
|
51
|
+
readonly zh: "是否等待命令完成并返回其输出。默认 false:异步提交,立即返回;稍后通过 term_read 读取结果。";
|
|
52
52
|
};
|
|
53
53
|
readonly name: {
|
|
54
54
|
readonly en: "Target terminal name, default 'default'. Must match a name from ssh_connect.";
|
|
@@ -56,18 +56,18 @@ export declare const T: {
|
|
|
56
56
|
};
|
|
57
57
|
};
|
|
58
58
|
readonly submitted: {
|
|
59
|
-
readonly en: "Command submitted (async). Running in background: check
|
|
60
|
-
readonly zh: "命令已异步提交,后台执行中:用
|
|
59
|
+
readonly en: "Command submitted (async). Running in background: check term_status for completion, then term_read to read output.";
|
|
60
|
+
readonly zh: "命令已异步提交,后台执行中:用 term_status 查完成状态,再用 term_read 读取输出。";
|
|
61
61
|
};
|
|
62
|
-
readonly
|
|
63
|
-
readonly en: "Read output of
|
|
64
|
-
readonly zh: "
|
|
62
|
+
readonly term_read: {
|
|
63
|
+
readonly en: "Read output of an SSH, local or container terminal: buffered (unconsumed, for interactive/polling) or history (completed command+output pairs, first N or last N). Returns browser URL for the full scrollable viewer when the HTTP server is on.";
|
|
64
|
+
readonly zh: "读取 SSH / 本地 / 容器终端输出:缓冲(未消费,交互/轮询用)或历史(已完成的命令+输出对,前 N 条或后 N 条)。HTTP 服务开启时返回浏览器查看完整记录的地址。";
|
|
65
65
|
};
|
|
66
|
-
readonly
|
|
67
|
-
readonly en: "Send text or keystrokes to
|
|
68
|
-
readonly zh: "
|
|
66
|
+
readonly term_send: {
|
|
67
|
+
readonly en: "Send text or keystrokes to an SSH, local or container terminal for interactive prompts (sudo password, confirmations, interrupts). Escapes: \\r or \\n = Enter, \\x03 = Ctrl-C, \\x04 = Ctrl-D, \\x1a = Ctrl-Z, \\x1b = Esc. After sending, read the result with term_read.";
|
|
68
|
+
readonly zh: "向 SSH / 本地 / 容器终端发送文本或按键,用于交互提示(sudo 密码、确认、中断等)。转义:\\r 或 \\n = 回车,\\x03 = Ctrl-C,\\x04 = Ctrl-D,\\x1a = Ctrl-Z,\\x1b = Esc。发送后用 term_read 读取结果。";
|
|
69
69
|
};
|
|
70
|
-
readonly
|
|
70
|
+
readonly term_send_args: {
|
|
71
71
|
readonly text: {
|
|
72
72
|
readonly en: "Text or key sequence to send. Use \\r or \\n for Enter, \\x03 for Ctrl-C, \\x1b for Esc. For sudo password prompts send the password followed by \\r.";
|
|
73
73
|
readonly zh: "要发送的文本或按键序列。回车用 \\r 或 \\n,Ctrl-C 用 \\x03,Esc 用 \\x1b。sudo 密码提示时发送密码后跟 \\r。";
|
|
@@ -85,7 +85,7 @@ export declare const T: {
|
|
|
85
85
|
readonly en: "SSH send";
|
|
86
86
|
readonly zh: "SSH 发送";
|
|
87
87
|
};
|
|
88
|
-
readonly
|
|
88
|
+
readonly term_read_args: {
|
|
89
89
|
readonly source: {
|
|
90
90
|
readonly en: "Where to read from: 'buffer' (unconsumed live output) or 'history' (completed pairs, default).";
|
|
91
91
|
readonly zh: "读取来源:'buffer'(实时未消费输出)或 'history'(已完成消息对,默认)。";
|
|
@@ -111,30 +111,226 @@ export declare const T: {
|
|
|
111
111
|
readonly zh: "目标终端名,默认 'default'。";
|
|
112
112
|
};
|
|
113
113
|
};
|
|
114
|
-
readonly
|
|
115
|
-
readonly en: "Check SSH
|
|
116
|
-
readonly zh: "按终端名检查 SSH
|
|
114
|
+
readonly term_status: {
|
|
115
|
+
readonly en: "Check SSH/local/container terminal state (busy, pending, connection) by terminal name (all terminals if omitted) and the HTTP server state (URL/port/session count). Use busy to poll completion instead of reading animated output.";
|
|
116
|
+
readonly zh: "按终端名检查 SSH / 本地 / 容器终端状态(busy、未消费量、连接;省略则列出全部终端)及 HTTP 服务状态(URL/端口/会话数)。用 busy 轮询完成情况,避免读取动画中间态。";
|
|
117
117
|
};
|
|
118
|
-
readonly
|
|
118
|
+
readonly term_status_args: {
|
|
119
119
|
readonly name: {
|
|
120
120
|
readonly en: "Terminal name to check; omit to list all terminals.";
|
|
121
121
|
readonly zh: "要检查的终端名;省略则列出全部终端。";
|
|
122
122
|
};
|
|
123
123
|
};
|
|
124
|
-
readonly
|
|
125
|
-
readonly en: "Close the
|
|
126
|
-
readonly zh: "
|
|
124
|
+
readonly term_disconnect: {
|
|
125
|
+
readonly en: "Close the terminal of a name (default 'default') for an SSH, local or container session, or all terminals when name is omitted, and clean up session state.";
|
|
126
|
+
readonly zh: "关闭指定名称(默认 'default')的 SSH / 本地 / 容器终端,name 省略则关闭全部终端,并清理会话态。";
|
|
127
127
|
};
|
|
128
|
-
readonly
|
|
128
|
+
readonly term_disconnect_args: {
|
|
129
129
|
readonly name: {
|
|
130
130
|
readonly en: "Terminal name to disconnect; omit to disconnect all terminals.";
|
|
131
131
|
readonly zh: "要断开的终端名;省略则断开全部终端。";
|
|
132
132
|
};
|
|
133
133
|
};
|
|
134
|
+
readonly local_connect: {
|
|
135
|
+
readonly en: "Start a local/container PTY terminal (e.g. pwsh, bash, docker exec -it <container> sh) in the current session. Same-session reconnect closes the previous one. Uses Bun.Terminal (runs in the opencode Bun runtime).";
|
|
136
|
+
readonly zh: "在当前会话启动本地/容器 PTY 终端(如 pwsh、bash、docker exec -it <容器> sh);同一会话重复启动会先关闭旧的。基于 Bun.Terminal(opencode Bun 运行时内运行)。";
|
|
137
|
+
};
|
|
138
|
+
readonly local_connect_args: {
|
|
139
|
+
readonly command: {
|
|
140
|
+
readonly en: "Command to launch, e.g. pwsh / bash / docker exec -it <container> sh";
|
|
141
|
+
readonly zh: "要启动的命令,如 pwsh / bash / docker exec -it <容器> sh";
|
|
142
|
+
};
|
|
143
|
+
readonly name: {
|
|
144
|
+
readonly en: "Terminal name within the session, default 'default'. Creating with an existing name closes the old one first.";
|
|
145
|
+
readonly zh: "会话内的终端名,默认 'default'。同名创建会先关闭旧终端。";
|
|
146
|
+
};
|
|
147
|
+
readonly cwd: {
|
|
148
|
+
readonly en: "Working directory, defaults to plugin cwd.";
|
|
149
|
+
readonly zh: "工作目录,默认插件所在目录。";
|
|
150
|
+
};
|
|
151
|
+
};
|
|
152
|
+
readonly local_connect_title_ok: {
|
|
153
|
+
readonly en: "Local terminal started";
|
|
154
|
+
readonly zh: "本地终端已启动";
|
|
155
|
+
};
|
|
156
|
+
readonly local_connect_ok: {
|
|
157
|
+
readonly en: "Started: {cmd} (terminal {name})";
|
|
158
|
+
readonly zh: "已启动:{cmd}(终端 {name})";
|
|
159
|
+
};
|
|
160
|
+
readonly local_connect_title_fail: {
|
|
161
|
+
readonly en: "Local terminal start failed";
|
|
162
|
+
readonly zh: "本地终端启动失败";
|
|
163
|
+
};
|
|
164
|
+
readonly ssh_cli: {
|
|
165
|
+
readonly en: "Unified CLI tool (CLI style): SSH / local / container terminal sessions. Subcommands: connect / local / exec / read / send / status / disconnect / help. Use 'help' for full usage.";
|
|
166
|
+
readonly zh: "统一命令行工具(CLI 风格):SSH/本地/容器终端会话。子命令: connect / local / exec / read / send / status / disconnect / help。用 'help' 查看完整用法。";
|
|
167
|
+
};
|
|
168
|
+
readonly ssh_cli_args: {
|
|
169
|
+
readonly en: "Full command line string, e.g. 'exec \"ls -la\" -w' or 'connect user@host'; defaults to 'help' when empty.";
|
|
170
|
+
readonly zh: "完整命令行字符串,如 'exec \"ls -la\" -w' 或 'connect user@host';空时默认 'help'。";
|
|
171
|
+
};
|
|
172
|
+
readonly ssh_cli_help: {
|
|
173
|
+
readonly en: `ssh_cli unified CLI tool: manage SSH / local / container terminal sessions.
|
|
174
|
+
|
|
175
|
+
Usage: ssh_cli <subcommand> [args]
|
|
176
|
+
|
|
177
|
+
Subcommands:
|
|
178
|
+
connect <target> [-u user] [-n name] [-p password|file:path]
|
|
179
|
+
target = user@host[:port] (e.g. root@server.local:22); open a long-lived SSH session
|
|
180
|
+
-p accepts plain text or file:<path> (read password from file, avoids exposure)
|
|
181
|
+
local "<command>" [-n name] [-c cwd]
|
|
182
|
+
start a local/container terminal (e.g. "pwsh" / "docker exec -it <container> sh")
|
|
183
|
+
exec "<command>" [-n name] [-w]
|
|
184
|
+
run a command in the terminal (default: submit async and return immediately; -w waits for result)
|
|
185
|
+
read [-n name] [-s buffer|history] [-l limit] [--head] [--include-command]
|
|
186
|
+
read terminal output: buffer (live) / history (default tail last N)
|
|
187
|
+
send "<text>" [-n name]
|
|
188
|
+
send text/keystrokes (\\r Enter, \\x03 Ctrl-C, \\x04 Ctrl-D, \\x1a Ctrl-Z, \\x1b Esc)
|
|
189
|
+
status [-n name]
|
|
190
|
+
terminal state (busy/pending/connection); omit name to list all
|
|
191
|
+
disconnect [-n name]
|
|
192
|
+
close terminal; omit name to close all
|
|
193
|
+
help
|
|
194
|
+
show this help
|
|
195
|
+
|
|
196
|
+
Examples:
|
|
197
|
+
ssh_cli connect root@192.168.1.10
|
|
198
|
+
ssh_cli connect user@host -p file:C:\\secrets\\pw.txt
|
|
199
|
+
ssh_cli local "docker exec -it myctr bash" -n db
|
|
200
|
+
ssh_cli exec "ls -la" -w
|
|
201
|
+
ssh_cli exec "cd /var/log && tail -50 syslog"
|
|
202
|
+
ssh_cli send "mypass\\r" -n default
|
|
203
|
+
ssh_cli read -n db -s buffer
|
|
204
|
+
ssh_cli status
|
|
205
|
+
ssh_cli disconnect -n db
|
|
206
|
+
`;
|
|
207
|
+
readonly zh: `ssh_cli 统一命令行工具:管理 SSH / 本地 / 容器终端会话。
|
|
208
|
+
|
|
209
|
+
用法: ssh_cli <子命令> [参数]
|
|
210
|
+
|
|
211
|
+
子命令:
|
|
212
|
+
connect <target> [-u user] [-n name] [-p password|file:path]
|
|
213
|
+
target = user@host[:port](如 root@server.local:22);建立 SSH 长驻会话
|
|
214
|
+
-p 支持明文或 file:<路径>(从文件读密码,避免暴露)
|
|
215
|
+
local "<command>" [-n name] [-c cwd]
|
|
216
|
+
启动本地/容器终端(如 "pwsh" / "docker exec -it <容器> sh")
|
|
217
|
+
exec "<command>" [-n name] [-w]
|
|
218
|
+
在指定终端执行命令(默认异步提交立即返回;-w 同步等待结果)
|
|
219
|
+
read [-n name] [-s buffer|history] [-l limit] [--head] [--include-command]
|
|
220
|
+
读终端输出:buffer 实时 / history 历史(默认 tail 后 N 条)
|
|
221
|
+
send "<text>" [-n name]
|
|
222
|
+
发送文本/按键(\\r 回车、\\x03 Ctrl-C、\\x04 Ctrl-D、\\x1a Ctrl-Z、\\x1b Esc)
|
|
223
|
+
status [-n name]
|
|
224
|
+
终端状态(busy/pending/连接);省略 name 列出全部
|
|
225
|
+
disconnect [-n name]
|
|
226
|
+
断开终端;省略 name 断开全部
|
|
227
|
+
help
|
|
228
|
+
显示本帮助
|
|
229
|
+
|
|
230
|
+
示例:
|
|
231
|
+
ssh_cli connect root@192.168.1.10
|
|
232
|
+
ssh_cli connect user@host -p file:C:\\secrets\\pw.txt
|
|
233
|
+
ssh_cli local "docker exec -it myctr bash" -n db
|
|
234
|
+
ssh_cli exec "ls -la" -w
|
|
235
|
+
ssh_cli exec "cd /var/log && tail -50 syslog"
|
|
236
|
+
ssh_cli send "mypass\\r" -n default
|
|
237
|
+
ssh_cli read -n db -s buffer
|
|
238
|
+
ssh_cli status
|
|
239
|
+
ssh_cli disconnect -n db
|
|
240
|
+
`;
|
|
241
|
+
};
|
|
134
242
|
readonly denied: {
|
|
135
243
|
readonly en: "Denied by user.";
|
|
136
244
|
readonly zh: "用户已拒绝。";
|
|
137
245
|
};
|
|
246
|
+
readonly cli_bad_target: {
|
|
247
|
+
readonly en: "Bad target: \"{target}\"";
|
|
248
|
+
readonly zh: "目标格式错误: \"{target}\"";
|
|
249
|
+
};
|
|
250
|
+
readonly cli_connect_usage: {
|
|
251
|
+
readonly en: "Usage: connect user@host[:port] [-u user] [-n name] [-p password]";
|
|
252
|
+
readonly zh: "用法: connect user@host[:port] [-u user] [-n name] [-p password]";
|
|
253
|
+
};
|
|
254
|
+
readonly cli_need_user_host: {
|
|
255
|
+
readonly en: "Need user and host";
|
|
256
|
+
readonly zh: "需要 user 和 host";
|
|
257
|
+
};
|
|
258
|
+
readonly cli_local_usage: {
|
|
259
|
+
readonly en: "Usage: local \"<command>\" [-n name] [-c cwd]";
|
|
260
|
+
readonly zh: "用法: local \"<command>\" [-n name] [-c cwd]";
|
|
261
|
+
};
|
|
262
|
+
readonly cli_exec_usage: {
|
|
263
|
+
readonly en: "Usage: exec \"<command>\" [-n name] [-w]";
|
|
264
|
+
readonly zh: "用法: exec \"<command>\" [-n name] [-w]";
|
|
265
|
+
};
|
|
266
|
+
readonly cli_send_usage: {
|
|
267
|
+
readonly en: "Usage: send \"<text>\" [-n name]";
|
|
268
|
+
readonly zh: "用法: send \"<text>\" [-n name]";
|
|
269
|
+
};
|
|
270
|
+
readonly cli_need_command: {
|
|
271
|
+
readonly en: "Need a command";
|
|
272
|
+
readonly zh: "需要命令";
|
|
273
|
+
};
|
|
274
|
+
readonly cli_need_text: {
|
|
275
|
+
readonly en: "Need text to send";
|
|
276
|
+
readonly zh: "需要发送内容";
|
|
277
|
+
};
|
|
278
|
+
readonly cli_unknown: {
|
|
279
|
+
readonly en: "Unknown command: {cmd}";
|
|
280
|
+
readonly zh: "未知命令: {cmd}";
|
|
281
|
+
};
|
|
282
|
+
readonly st_name: {
|
|
283
|
+
readonly en: "name";
|
|
284
|
+
readonly zh: "名称";
|
|
285
|
+
};
|
|
286
|
+
readonly st_type: {
|
|
287
|
+
readonly en: "type";
|
|
288
|
+
readonly zh: "类型";
|
|
289
|
+
};
|
|
290
|
+
readonly st_connected: {
|
|
291
|
+
readonly en: "connected";
|
|
292
|
+
readonly zh: "已连接";
|
|
293
|
+
};
|
|
294
|
+
readonly st_busy: {
|
|
295
|
+
readonly en: "busy";
|
|
296
|
+
readonly zh: "忙碌";
|
|
297
|
+
};
|
|
298
|
+
readonly st_pending: {
|
|
299
|
+
readonly en: "pending";
|
|
300
|
+
readonly zh: "待消费";
|
|
301
|
+
};
|
|
302
|
+
readonly st_bytes: {
|
|
303
|
+
readonly en: "bytes";
|
|
304
|
+
readonly zh: "字节";
|
|
305
|
+
};
|
|
306
|
+
readonly st_host: {
|
|
307
|
+
readonly en: "host";
|
|
308
|
+
readonly zh: "主机";
|
|
309
|
+
};
|
|
310
|
+
readonly st_program: {
|
|
311
|
+
readonly en: "program";
|
|
312
|
+
readonly zh: "程序";
|
|
313
|
+
};
|
|
314
|
+
readonly st_last_active: {
|
|
315
|
+
readonly en: "lastActive";
|
|
316
|
+
readonly zh: "最后活动";
|
|
317
|
+
};
|
|
318
|
+
readonly st_connected_at: {
|
|
319
|
+
readonly en: "connectedAt";
|
|
320
|
+
readonly zh: "连接时间";
|
|
321
|
+
};
|
|
322
|
+
readonly st_http_server: {
|
|
323
|
+
readonly en: "httpServer";
|
|
324
|
+
readonly zh: "HTTP 服务";
|
|
325
|
+
};
|
|
326
|
+
readonly st_active_sessions: {
|
|
327
|
+
readonly en: "activeSessions";
|
|
328
|
+
readonly zh: "活跃会话";
|
|
329
|
+
};
|
|
330
|
+
readonly st_disabled: {
|
|
331
|
+
readonly en: "disabled";
|
|
332
|
+
readonly zh: "已禁用";
|
|
333
|
+
};
|
|
138
334
|
readonly denied_danger: {
|
|
139
335
|
readonly en: "Dangerous command, execution rejected.";
|
|
140
336
|
readonly zh: "危险命令,已拒绝执行。";
|
|
@@ -188,12 +384,12 @@ export declare const T: {
|
|
|
188
384
|
readonly zh: "SSH 会话已断开";
|
|
189
385
|
};
|
|
190
386
|
readonly status_busy_hint: {
|
|
191
|
-
readonly en: "\nHint: a command is still running. Wait and retry, or call
|
|
192
|
-
readonly zh: "\n提示:仍有命令在执行,请等待后重试或调用
|
|
387
|
+
readonly en: "\nHint: a command is still running. Wait and retry, or call term_read for partial output.";
|
|
388
|
+
readonly zh: "\n提示:仍有命令在执行,请等待后重试或调用 term_read 获取部分输出。";
|
|
193
389
|
};
|
|
194
390
|
readonly status_idle_hint: {
|
|
195
|
-
readonly en: "\nHint: no command running. You can safely execute a new command or call
|
|
196
|
-
readonly zh: "\n提示:无命令在执行,可安全执行新命令或调用
|
|
391
|
+
readonly en: "\nHint: no command running. You can safely execute a new command or call term_read for remaining output.";
|
|
392
|
+
readonly zh: "\n提示:无命令在执行,可安全执行新命令或调用 term_read 读取剩余输出。";
|
|
197
393
|
};
|
|
198
394
|
readonly status_title: {
|
|
199
395
|
readonly en: "SSH session status";
|
|
@@ -223,6 +419,54 @@ export declare const T: {
|
|
|
223
419
|
readonly en: "SSH history (first {n} / total {total})";
|
|
224
420
|
readonly zh: "SSH 历史(前 {n} 条 / 共 {total} 条)";
|
|
225
421
|
};
|
|
422
|
+
readonly web_title: {
|
|
423
|
+
readonly en: "Terminal Records";
|
|
424
|
+
readonly zh: "终端记录";
|
|
425
|
+
};
|
|
426
|
+
readonly web_loading: {
|
|
427
|
+
readonly en: "Loading...";
|
|
428
|
+
readonly zh: "加载中...";
|
|
429
|
+
};
|
|
430
|
+
readonly web_load_failed: {
|
|
431
|
+
readonly en: "Failed to load records";
|
|
432
|
+
readonly zh: "记录加载失败";
|
|
433
|
+
};
|
|
434
|
+
readonly web_session_gone: {
|
|
435
|
+
readonly en: "Session not found or disconnected";
|
|
436
|
+
readonly zh: "会话不存在或已断开";
|
|
437
|
+
};
|
|
438
|
+
readonly web_time: {
|
|
439
|
+
readonly en: "Time";
|
|
440
|
+
readonly zh: "时间";
|
|
441
|
+
};
|
|
442
|
+
readonly web_terminals: {
|
|
443
|
+
readonly en: "terminals";
|
|
444
|
+
readonly zh: "终端";
|
|
445
|
+
};
|
|
446
|
+
readonly web_local: {
|
|
447
|
+
readonly en: "local";
|
|
448
|
+
readonly zh: "本地";
|
|
449
|
+
};
|
|
450
|
+
readonly web_commands: {
|
|
451
|
+
readonly en: "commands";
|
|
452
|
+
readonly zh: "条命令";
|
|
453
|
+
};
|
|
454
|
+
readonly web_auto_refresh: {
|
|
455
|
+
readonly en: "auto-refresh every 2s";
|
|
456
|
+
readonly zh: "每 2s 自动刷新";
|
|
457
|
+
};
|
|
458
|
+
readonly web_no_session: {
|
|
459
|
+
readonly en: "No session. Use ssh_cli connect first.";
|
|
460
|
+
readonly zh: "无会话,请先用 ssh_cli connect 建立连接。";
|
|
461
|
+
};
|
|
462
|
+
readonly web_running: {
|
|
463
|
+
readonly en: "[running] ";
|
|
464
|
+
readonly zh: "[运行中] ";
|
|
465
|
+
};
|
|
466
|
+
readonly web_new_messages: {
|
|
467
|
+
readonly en: "↓ New messages";
|
|
468
|
+
readonly zh: "↓ 新消息";
|
|
469
|
+
};
|
|
226
470
|
readonly disconnected_ok: {
|
|
227
471
|
readonly en: "SSH connection closed ({host}).";
|
|
228
472
|
readonly zh: "SSH 连接已断开({host})。";
|
|
@@ -236,8 +480,8 @@ export declare const T: {
|
|
|
236
480
|
readonly zh: "未连接";
|
|
237
481
|
};
|
|
238
482
|
readonly err_busy: {
|
|
239
|
-
readonly en: "Previous command still running, poll with
|
|
240
|
-
readonly zh: "上一条命令仍在执行,请先
|
|
483
|
+
readonly en: "Previous command still running, poll with term_status first";
|
|
484
|
+
readonly zh: "上一条命令仍在执行,请先 term_status 轮询";
|
|
241
485
|
};
|
|
242
486
|
readonly err_shell_open: {
|
|
243
487
|
readonly en: "Shell open failed";
|
|
@@ -254,5 +498,4 @@ export declare const T: {
|
|
|
254
498
|
};
|
|
255
499
|
/** 取某语言下的一条文案 */
|
|
256
500
|
export declare function tr(key: FlatKey, lang: Lang): string;
|
|
257
|
-
export {};
|
|
258
501
|
//# sourceMappingURL=i18n.d.ts.map
|
package/dist/i18n.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"i18n.d.ts","sourceRoot":"","sources":["../src/i18n.ts"],"names":[],"mappings":"AAIA,MAAM,MAAM,IAAI,GAAG,IAAI,GAAG,IAAI,CAAA;AAE9B,4CAA4C;AAC5C,
|
|
1
|
+
{"version":3,"file":"i18n.d.ts","sourceRoot":"","sources":["../src/i18n.ts"],"names":[],"mappings":"AAIA,MAAM,MAAM,IAAI,GAAG,IAAI,GAAG,IAAI,CAAA;AAE9B,4CAA4C;AAC5C,MAAM,MAAM,OAAO,GAAG;KAAG,CAAC,IAAI,MAAM,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,GAAG,CAAC,GAAG,KAAK;CAAE,CAAC,MAAM,OAAO,CAAC,CAAC,CAAA;AAEvH;;;;GAIG;AACH,wBAAgB,OAAO,CAAC,UAAU,GAAE,IAAW,GAAG,IAAI,CAKrD;AAED,kBAAkB;AAClB,eAAO,MAAM,CAAC;aACZ,WAAW;iBACT,EAAE,EAAE,wKAAwK;iBAC5K,EAAE,EAAE,uDAAuD;;aAE7D,gBAAgB;iBACd,IAAI;qBAAI,EA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