dsh-bash-terminal-ts 0.6.2 → 0.6.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 +5 -5
- package/README.md +15 -15
- package/cordis.patch.yml +2 -2
- package/dist/client.core.js +16 -6
- package/dist/client.js +17 -7
- package/dsh.plugin.json +22 -22
- package/lib/client.js +17 -7
- package/lib/dsh-types.d.ts +1 -1
- package/lib/index.js +6 -6
- package/lib/terminal.js +1 -1
- package/package.json +1 -1
- package/scripts/build-client.mjs +2 -2
- package/src/client.tsx +24 -9
- package/src/dsh-types.ts +1 -1
- package/src/index.ts +6 -6
- package/src/terminal.ts +1 -1
package/README.en.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# dsh-bash-terminal
|
|
1
|
+
# dsh-bash-terminal-ts
|
|
2
2
|
|
|
3
3
|
> Community: [LINUX DO](https://linux.do) · [GitHub](https://github.com/drscrewdriver/dsh-bash-terminal-ts)
|
|
4
4
|
|
|
@@ -10,7 +10,7 @@ A DeepSeek Harness (DSH) plugin: one `shell` tool that runs commands through **P
|
|
|
10
10
|
>
|
|
11
11
|
> | Branch | DSH segment | Package name | Status |
|
|
12
12
|
> |--------|-------------|--------------|--------|
|
|
13
|
-
> | `ts/0.1.5` | 0.1.5-alpha.1 – 0.1.5-rc.x | `dsh-bash-terminal` | this branch; `build` / `unit` / `apply` / `client` / `terminal` green locally |
|
|
13
|
+
> | `ts/0.1.5` | 0.1.5-alpha.1 – 0.1.5-rc.x | `dsh-bash-terminal-ts` | this branch; `build` / `unit` / `apply` / `client` / `terminal` green locally |
|
|
14
14
|
> | `main` | 0.1.2-alpha.1 – 0.1.2-rc.x | `dsh-bash-terminal-ts` | the TypeScript rewrite's mainline |
|
|
15
15
|
>
|
|
16
16
|
> The two lines **deliberately use different package names**, so they install side by side without overwriting each other. Pick the branch that covers your DSH build.
|
|
@@ -37,11 +37,11 @@ The **Default terminal** row in Settings -> General: the user picks PowerShell /
|
|
|
37
37
|
|
|
38
38
|
## Install
|
|
39
39
|
|
|
40
|
-
The package ships the official `dsh.bundle` manifest (its own `cordis.patch.yml`): listing `dsh-bash-terminal` in a profile's `dsh.profile.bundles` auto-applies the mount — no manual profile edits.
|
|
40
|
+
The package ships the official `dsh.bundle` manifest (its own `cordis.patch.yml`): listing `dsh-bash-terminal-ts` in a profile's `dsh.profile.bundles` auto-applies the mount — no manual profile edits.
|
|
41
41
|
|
|
42
42
|
```powershell
|
|
43
|
-
npm install -g dsh-bash-terminal
|
|
44
|
-
dsh plugin --profile web add dsh-bash-terminal # adds to profile bundles + applies the patch
|
|
43
|
+
npm install -g dsh-bash-terminal-ts
|
|
44
|
+
dsh plugin --profile web add dsh-bash-terminal-ts # adds to profile bundles + applies the patch
|
|
45
45
|
powershell -ExecutionPolicy Bypass -File install.ps1 install # patches the DSH settings-UI allowlist (see below)
|
|
46
46
|
# restart dsh web
|
|
47
47
|
```
|
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# dsh-bash-terminal
|
|
1
|
+
# dsh-bash-terminal-ts
|
|
2
2
|
|
|
3
3
|
> 🌐 [English](README.en.md) · 社区交流:[LINUX DO](https://linux.do) · [GitHub](https://github.com/drscrewdriver/dsh-bash-terminal-ts)
|
|
4
4
|
|
|
@@ -10,7 +10,7 @@ DSH(DeepSeek Harness)插件:一个 `shell` 工具,在 Windows 上统一
|
|
|
10
10
|
>
|
|
11
11
|
> | 分支 | DSH 段 | 包名 | 状态 |
|
|
12
12
|
> |------|--------|------|------|
|
|
13
|
-
> | `ts/0.1.5` | 0.1.5-alpha.1 – 0.1.5-rc.x | `dsh-bash-terminal` | 本分支;`build` / `unit` / `apply` / `client` / `terminal` 本机全绿 |
|
|
13
|
+
> | `ts/0.1.5` | 0.1.5-alpha.1 – 0.1.5-rc.x | `dsh-bash-terminal-ts` | 本分支;`build` / `unit` / `apply` / `client` / `terminal` 本机全绿 |
|
|
14
14
|
> | `main` | 0.1.2-alpha.1 – 0.1.2-rc.x | `dsh-bash-terminal-ts` | TypeScript 重写主线 |
|
|
15
15
|
>
|
|
16
16
|
> **两条线刻意使用不同包名**,因此可以并存安装、互不覆盖。请按你的 DSH 版本选分支。
|
|
@@ -46,8 +46,8 @@ DSH(DeepSeek Harness)插件:一个 `shell` 工具,在 Windows 上统一
|
|
|
46
46
|
|
|
47
47
|
```powershell
|
|
48
48
|
# 1. 安装插件包
|
|
49
|
-
npm install -g dsh-bash-terminal
|
|
50
|
-
dsh plugin --profile web add dsh-bash-terminal # 自动加进 profile 的 bundles 并应用 patch
|
|
49
|
+
npm install -g dsh-bash-terminal-ts
|
|
50
|
+
dsh plugin --profile web add dsh-bash-terminal-ts # 自动加进 profile 的 bundles 并应用 patch
|
|
51
51
|
|
|
52
52
|
# 2. patch DSH 设置白名单(DSH 限制,见下方说明)
|
|
53
53
|
powershell -ExecutionPolicy Bypass -File install.ps1 install
|
|
@@ -55,21 +55,21 @@ powershell -ExecutionPolicy Bypass -File install.ps1 install
|
|
|
55
55
|
# 3. 重启 dsh web
|
|
56
56
|
```
|
|
57
57
|
|
|
58
|
-
> 已用临时 profile 实测:`bundles: [dsh-bash-terminal]` → dump-config 自动出现 `tool-bash-terminal` entry。
|
|
58
|
+
> 已用临时 profile 实测:`bundles: [dsh-bash-terminal-ts]` → dump-config 自动出现 `tool-bash-terminal` entry。
|
|
59
59
|
|
|
60
60
|
### 本地开发安装(junction 直连,改源码即时生效)
|
|
61
61
|
|
|
62
62
|
```powershell
|
|
63
63
|
# 1. 链接插件包到 profile 的 node_modules(junction,改源码即时生效)
|
|
64
64
|
$profile = "$env:USERPROFILE\.dsh\profiles\web"
|
|
65
|
-
New-Item -ItemType Junction -Path "$profile\node_modules\dsh-bash-terminal" -Target "D:\workspace\projects\dsh-bash-terminal" | Out-Null
|
|
65
|
+
New-Item -ItemType Junction -Path "$profile\node_modules\dsh-bash-terminal-ts" -Target "D:\workspace\projects\dsh-bash-terminal-ts" | Out-Null
|
|
66
66
|
|
|
67
67
|
# 2. 让插件能解析 @deepseek-ai/* 依赖(junction 到 profile 的依赖树,插件与宿主共用同一份模块实例)
|
|
68
|
-
New-Item -ItemType Junction -Path "D:\workspace\projects\dsh-bash-terminal\node_modules\@deepseek-ai" -Target "$profile\..\node_modules\@deepseek-ai" | Out-Null
|
|
68
|
+
New-Item -ItemType Junction -Path "D:\workspace\projects\dsh-bash-terminal-ts\node_modules\@deepseek-ai" -Target "$profile\..\node_modules\@deepseek-ai" | Out-Null
|
|
69
69
|
|
|
70
|
-
# 3. 让 profile 通过官方 bundle 挂载插件(install.ps1 install 会自动做;等价于在 dsh.profile.bundles 加 "dsh-bash-terminal")
|
|
70
|
+
# 3. 让 profile 通过官方 bundle 挂载插件(install.ps1 install 会自动做;等价于在 dsh.profile.bundles 加 "dsh-bash-terminal-ts")
|
|
71
71
|
# 4. (仅修改前端源码后)重新打包 client bundle:
|
|
72
|
-
# cd D:\workspace\projects\dsh-bash-terminal && node scripts/build-client.mjs
|
|
72
|
+
# cd D:\workspace\projects\dsh-bash-terminal-ts && node scripts/build-client.mjs
|
|
73
73
|
# 5. 重启 dsh web
|
|
74
74
|
```
|
|
75
75
|
|
|
@@ -84,12 +84,12 @@ New-Item -ItemType Junction -Path "D:\workspace\projects\dsh-bash-terminal\node_
|
|
|
84
84
|
> 另:0.1.5 的 Web 设置面改为 `settings.describe()` 动态枚举,**不再有 namespace 白名单**
|
|
85
85
|
> (`settings-not-exposed` 已不存在),`install.ps1` 里的白名单 patch 只是历史遗留、可忽略。
|
|
86
86
|
|
|
87
|
-
> 当前已不再需要手动改 profile 的 `cordis.patch.yml`:插件包内自带 `dsh.bundle.patch`(包内 `cordis.patch.yml`),只要 profile 的 `dsh.profile.bundles` 里有 `dsh-bash-terminal`,DSH 就会自动挂载。
|
|
87
|
+
> 当前已不再需要手动改 profile 的 `cordis.patch.yml`:插件包内自带 `dsh.bundle.patch`(包内 `cordis.patch.yml`),只要 profile 的 `dsh.profile.bundles` 里有 `dsh-bash-terminal-ts`,DSH 就会自动挂载。
|
|
88
88
|
|
|
89
89
|
验证组合树(无需重启):
|
|
90
90
|
|
|
91
91
|
```powershell
|
|
92
|
-
node "$env:APPDATA\nvm\<node-version>\node_modules\@deepseek-ai\dsh\lib\bin.js" --profile web --dump-config | Select-String dsh-bash-terminal
|
|
92
|
+
node "$env:APPDATA\nvm\<node-version>\node_modules\@deepseek-ai\dsh\lib\bin.js" --profile web --dump-config | Select-String dsh-bash-terminal-ts
|
|
93
93
|
```
|
|
94
94
|
|
|
95
95
|
## 使用
|
|
@@ -132,7 +132,7 @@ node "$env:APPDATA\nvm\<node-version>\node_modules\@deepseek-ai\dsh\lib\bin.js"
|
|
|
132
132
|
npm 账号已启用 2FA 发布验证,需一次性验证码:
|
|
133
133
|
|
|
134
134
|
```powershell
|
|
135
|
-
cd D:\workspace\projects\dsh-bash-terminal
|
|
135
|
+
cd D:\workspace\projects\dsh-bash-terminal-ts
|
|
136
136
|
npm publish --otp <验证码> # 验证码来自你的认证器
|
|
137
137
|
```
|
|
138
138
|
|
|
@@ -146,9 +146,9 @@ npm publish --otp <验证码> # 验证码来自你的认证器
|
|
|
146
146
|
powershell -ExecutionPolicy Bypass -File install.ps1 uninstall
|
|
147
147
|
```
|
|
148
148
|
|
|
149
|
-
它会删除 junction、恢复设置白名单、清理旧版遗留的 `cordis.patch.yml` 挂载块,并从 `dsh.profile.bundles` 移除 `dsh-bash-terminal`。之后重启 dsh web 即可。
|
|
149
|
+
它会删除 junction、恢复设置白名单、清理旧版遗留的 `cordis.patch.yml` 挂载块,并从 `dsh.profile.bundles` 移除 `dsh-bash-terminal-ts`。之后重启 dsh web 即可。
|
|
150
150
|
|
|
151
|
-
手动卸载时,除了删除 `node_modules\dsh-bash-terminal`,还要记得从 profile `package.json` 的 `dsh.profile.bundles` 中移除 `dsh-bash-terminal`。
|
|
151
|
+
手动卸载时,除了删除 `node_modules\dsh-bash-terminal-ts`,还要记得从 profile `package.json` 的 `dsh.profile.bundles` 中移除 `dsh-bash-terminal-ts`。
|
|
152
152
|
|
|
153
153
|
## 交互式终端(terminal 工具)
|
|
154
154
|
|
|
@@ -194,7 +194,7 @@ powershell -ExecutionPolicy Bypass -File install.ps1 uninstall
|
|
|
194
194
|
## 测试
|
|
195
195
|
|
|
196
196
|
```powershell
|
|
197
|
-
cd D:\workspace\projects\dsh-bash-terminal
|
|
197
|
+
cd D:\workspace\projects\dsh-bash-terminal-ts
|
|
198
198
|
npm install # 安装依赖(含 typescript)
|
|
199
199
|
npm run build # tsc 编译 src/*.ts → lib/*.js;client.tsx → lib/client.js + dist/client.js;test/*.ts → test-dist/
|
|
200
200
|
npm test # node test-dist/unit.js → apply.js → client.js → terminal.js
|
package/cordis.patch.yml
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
# dsh-bash-terminal bundle layer — applied automatically when a profile lists
|
|
1
|
+
# dsh-bash-terminal-ts bundle layer — applied automatically when a profile lists
|
|
2
2
|
# this package in dsh.profile.bundles (dsh.bundle.patch declaration).
|
|
3
3
|
- insert:
|
|
4
4
|
- id: tool-bash-terminal
|
|
5
|
-
name: 'dsh-bash-terminal'
|
|
5
|
+
name: 'dsh-bash-terminal-ts'
|
package/dist/client.core.js
CHANGED
|
@@ -33,7 +33,7 @@ var SHELLS = ["powershell", "gitbash", "msys2", "wsl"];
|
|
|
33
33
|
var ROW_CSS = ".btRow{border-bottom:1px solid var(--dsw-alias-border-l2);align-items:center;gap:8px;padding:16px 0;display:flex}.btRowText{flex-direction:column;flex:1;gap:4px;min-width:0;padding-right:48px;display:flex}.btTitle{color:var(--dsw-alias-label-primary);font-size:14px;font-weight:400;line-height:22px}.btDesc{color:var(--dsw-alias-label-tertiary);font-size:12px;font-weight:400;line-height:18px}.btSelector{background:var(--dsw-alias-bg-module-platform);height:36px;font:inherit;color:var(--dsw-alias-label-primary);cursor:pointer;border:none;border-radius:18px;align-items:center;gap:12px;padding:0 14px;font-size:14px;line-height:22px;display:inline-flex}.btSelector:hover{background:var(--dsw-alias-interactive-bg-hover)}.btChevron{flex:none}";
|
|
34
34
|
if (typeof document !== "undefined" && document.querySelector('style[data-plugin-css="bash-terminal-row"]') === null) {
|
|
35
35
|
const tag = document.createElement("style");
|
|
36
|
-
tag.dataset.plugin = "dsh-bash-terminal";
|
|
36
|
+
tag.dataset.plugin = "dsh-bash-terminal-ts";
|
|
37
37
|
tag.dataset.pluginCss = "bash-terminal-row";
|
|
38
38
|
tag.textContent = ROW_CSS;
|
|
39
39
|
document.head.appendChild(tag);
|
|
@@ -44,7 +44,8 @@ var zh = {
|
|
|
44
44
|
"shell.powershell": "PowerShell",
|
|
45
45
|
"shell.gitbash": "Git Bash",
|
|
46
46
|
"shell.msys2": "MSYS2",
|
|
47
|
-
"shell.wsl": "WSL"
|
|
47
|
+
"shell.wsl": "WSL",
|
|
48
|
+
"shell.unavailable": "\u8BBE\u7F6E\u9762\u4E0D\u53EF\u7528\uFF1A\u5BBF\u4E3B\u672A\u63D0\u4F9B\u672C\u63D2\u4EF6\u7684 configForms \u6761\u76EE\uFF08\u68C0\u67E5 cordis.patch.yml \u7684 entry id\uFF09"
|
|
48
49
|
};
|
|
49
50
|
var en = {
|
|
50
51
|
"shell.title": "Default terminal",
|
|
@@ -52,14 +53,22 @@ var en = {
|
|
|
52
53
|
"shell.powershell": "PowerShell",
|
|
53
54
|
"shell.gitbash": "Git Bash",
|
|
54
55
|
"shell.msys2": "MSYS2",
|
|
55
|
-
"shell.wsl": "WSL"
|
|
56
|
+
"shell.wsl": "WSL",
|
|
57
|
+
"shell.unavailable": "Settings unavailable: the host exposes no configForms entry for this plugin (check the cordis.patch.yml entry id)"
|
|
56
58
|
};
|
|
57
59
|
var inject = ["slots", "locale", "configForms"];
|
|
58
60
|
function ShellPreferenceRow({ t, useStore, setShell }) {
|
|
59
61
|
const shell = useStore((s) => s.shell);
|
|
60
62
|
const writable = useStore((s) => s.writable);
|
|
63
|
+
const status = useStore((s) => s.status);
|
|
61
64
|
const [open, setOpen] = (0, import_react.useState)(false);
|
|
62
65
|
const items = SHELLS.map((id) => ({ id, label: t("shell." + id) }));
|
|
66
|
+
if (status === "unavailable") {
|
|
67
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "btRow", children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "btRowText", children: [
|
|
68
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "btTitle", children: t("shell.title") }),
|
|
69
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "btDesc", children: t("shell.unavailable") })
|
|
70
|
+
] }) });
|
|
71
|
+
}
|
|
63
72
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "btRow", children: [
|
|
64
73
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "btRowText", children: [
|
|
65
74
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "btTitle", children: t("shell.title") }),
|
|
@@ -103,19 +112,20 @@ function apply(ctx) {
|
|
|
103
112
|
ctx.effect(() => ctx.locale.register(SETTINGS_NS, { zh, en }), "bash-terminal: settings dictionaries");
|
|
104
113
|
const scope = ctx.configForms.get(ENTRY_ID);
|
|
105
114
|
const store = (0, import_dsh_client_store.defineStore)({
|
|
106
|
-
init: () => ({ shell: "powershell", revision: -1, writable: false }),
|
|
115
|
+
init: () => ({ shell: "powershell", revision: -1, writable: false, status: "loading" }),
|
|
107
116
|
actions: {
|
|
108
|
-
sync: (d, shell, revision, writable) => {
|
|
117
|
+
sync: (d, shell, revision, writable, status) => {
|
|
109
118
|
if (revision !== void 0 && revision <= d.revision) return;
|
|
110
119
|
if (shell !== void 0) d.shell = shell;
|
|
111
120
|
if (revision !== void 0) d.revision = revision;
|
|
112
121
|
if (writable !== void 0) d.writable = writable;
|
|
122
|
+
if (status !== void 0) d.status = status;
|
|
113
123
|
}
|
|
114
124
|
}
|
|
115
125
|
});
|
|
116
126
|
let bound;
|
|
117
127
|
const push = (snap) => {
|
|
118
|
-
bound?.sync(snap.value?.defaultShell, snap.revision, snap.writable);
|
|
128
|
+
bound?.sync(snap.value?.defaultShell, snap.revision, snap.writable, snap.status);
|
|
119
129
|
};
|
|
120
130
|
ctx.slots.inject(
|
|
121
131
|
"dsh-family.tab",
|
package/dist/client.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
window.__ModuleLoader__.load({
|
|
2
|
-
id: "dsh-bash-terminal",
|
|
2
|
+
id: "dsh-bash-terminal-ts",
|
|
3
3
|
factory: (require) => {
|
|
4
4
|
var module = { exports: {} };
|
|
5
5
|
var exports = module.exports;
|
|
@@ -38,7 +38,7 @@ var SHELLS = ["powershell", "gitbash", "msys2", "wsl"];
|
|
|
38
38
|
var ROW_CSS = ".btRow{border-bottom:1px solid var(--dsw-alias-border-l2);align-items:center;gap:8px;padding:16px 0;display:flex}.btRowText{flex-direction:column;flex:1;gap:4px;min-width:0;padding-right:48px;display:flex}.btTitle{color:var(--dsw-alias-label-primary);font-size:14px;font-weight:400;line-height:22px}.btDesc{color:var(--dsw-alias-label-tertiary);font-size:12px;font-weight:400;line-height:18px}.btSelector{background:var(--dsw-alias-bg-module-platform);height:36px;font:inherit;color:var(--dsw-alias-label-primary);cursor:pointer;border:none;border-radius:18px;align-items:center;gap:12px;padding:0 14px;font-size:14px;line-height:22px;display:inline-flex}.btSelector:hover{background:var(--dsw-alias-interactive-bg-hover)}.btChevron{flex:none}";
|
|
39
39
|
if (typeof document !== "undefined" && document.querySelector('style[data-plugin-css="bash-terminal-row"]') === null) {
|
|
40
40
|
const tag = document.createElement("style");
|
|
41
|
-
tag.dataset.plugin = "dsh-bash-terminal";
|
|
41
|
+
tag.dataset.plugin = "dsh-bash-terminal-ts";
|
|
42
42
|
tag.dataset.pluginCss = "bash-terminal-row";
|
|
43
43
|
tag.textContent = ROW_CSS;
|
|
44
44
|
document.head.appendChild(tag);
|
|
@@ -49,7 +49,8 @@ var zh = {
|
|
|
49
49
|
"shell.powershell": "PowerShell",
|
|
50
50
|
"shell.gitbash": "Git Bash",
|
|
51
51
|
"shell.msys2": "MSYS2",
|
|
52
|
-
"shell.wsl": "WSL"
|
|
52
|
+
"shell.wsl": "WSL",
|
|
53
|
+
"shell.unavailable": "\u8BBE\u7F6E\u9762\u4E0D\u53EF\u7528\uFF1A\u5BBF\u4E3B\u672A\u63D0\u4F9B\u672C\u63D2\u4EF6\u7684 configForms \u6761\u76EE\uFF08\u68C0\u67E5 cordis.patch.yml \u7684 entry id\uFF09"
|
|
53
54
|
};
|
|
54
55
|
var en = {
|
|
55
56
|
"shell.title": "Default terminal",
|
|
@@ -57,14 +58,22 @@ var en = {
|
|
|
57
58
|
"shell.powershell": "PowerShell",
|
|
58
59
|
"shell.gitbash": "Git Bash",
|
|
59
60
|
"shell.msys2": "MSYS2",
|
|
60
|
-
"shell.wsl": "WSL"
|
|
61
|
+
"shell.wsl": "WSL",
|
|
62
|
+
"shell.unavailable": "Settings unavailable: the host exposes no configForms entry for this plugin (check the cordis.patch.yml entry id)"
|
|
61
63
|
};
|
|
62
64
|
var inject = ["slots", "locale", "configForms"];
|
|
63
65
|
function ShellPreferenceRow({ t, useStore, setShell }) {
|
|
64
66
|
const shell = useStore((s) => s.shell);
|
|
65
67
|
const writable = useStore((s) => s.writable);
|
|
68
|
+
const status = useStore((s) => s.status);
|
|
66
69
|
const [open, setOpen] = (0, import_react.useState)(false);
|
|
67
70
|
const items = SHELLS.map((id) => ({ id, label: t("shell." + id) }));
|
|
71
|
+
if (status === "unavailable") {
|
|
72
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "btRow", children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "btRowText", children: [
|
|
73
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "btTitle", children: t("shell.title") }),
|
|
74
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "btDesc", children: t("shell.unavailable") })
|
|
75
|
+
] }) });
|
|
76
|
+
}
|
|
68
77
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "btRow", children: [
|
|
69
78
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "btRowText", children: [
|
|
70
79
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "btTitle", children: t("shell.title") }),
|
|
@@ -108,19 +117,20 @@ function apply(ctx) {
|
|
|
108
117
|
ctx.effect(() => ctx.locale.register(SETTINGS_NS, { zh, en }), "bash-terminal: settings dictionaries");
|
|
109
118
|
const scope = ctx.configForms.get(ENTRY_ID);
|
|
110
119
|
const store = (0, import_dsh_client_store.defineStore)({
|
|
111
|
-
init: () => ({ shell: "powershell", revision: -1, writable: false }),
|
|
120
|
+
init: () => ({ shell: "powershell", revision: -1, writable: false, status: "loading" }),
|
|
112
121
|
actions: {
|
|
113
|
-
sync: (d, shell, revision, writable) => {
|
|
122
|
+
sync: (d, shell, revision, writable, status) => {
|
|
114
123
|
if (revision !== void 0 && revision <= d.revision) return;
|
|
115
124
|
if (shell !== void 0) d.shell = shell;
|
|
116
125
|
if (revision !== void 0) d.revision = revision;
|
|
117
126
|
if (writable !== void 0) d.writable = writable;
|
|
127
|
+
if (status !== void 0) d.status = status;
|
|
118
128
|
}
|
|
119
129
|
}
|
|
120
130
|
});
|
|
121
131
|
let bound;
|
|
122
132
|
const push = (snap) => {
|
|
123
|
-
bound?.sync(snap.value?.defaultShell, snap.revision, snap.writable);
|
|
133
|
+
bound?.sync(snap.value?.defaultShell, snap.revision, snap.writable, snap.status);
|
|
124
134
|
};
|
|
125
135
|
ctx.slots.inject(
|
|
126
136
|
"dsh-family.tab",
|
package/dsh.plugin.json
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
{
|
|
2
|
-
"id": "dsh-bash-terminal",
|
|
3
|
-
"name": "dsh-bash-terminal",
|
|
4
|
-
"version": "0.6.
|
|
5
|
-
"description": {
|
|
6
|
-
"en": "One shell tool that runs commands through PowerShell, Git Bash, MSYS2 or WSL on Windows, with a user-chosen default terminal in the Web UI settings.",
|
|
7
|
-
"zh": "一个 shell 工具,可在 Windows 上通过 PowerShell / Git Bash / MSYS2 / WSL 执行命令,默认终端在 Web UI 设置中选择。"
|
|
8
|
-
},
|
|
9
|
-
"homepage": "https://github.com/drscrewdriver/dsh-bash-terminal-ts",
|
|
10
|
-
"repository": {
|
|
11
|
-
"type": "git",
|
|
12
|
-
"url": "https://github.com/drscrewdriver/dsh-bash-terminal-ts.git"
|
|
13
|
-
},
|
|
14
|
-
"license": "MIT",
|
|
15
|
-
"engines": {
|
|
16
|
-
"dsh": ">=0.1.7-rc.1 <0.1.8-0"
|
|
17
|
-
},
|
|
18
|
-
"components": {
|
|
19
|
-
"host": "lib/index.js",
|
|
20
|
-
"client": "dist/client.js"
|
|
21
|
-
}
|
|
22
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"id": "dsh-bash-terminal-ts",
|
|
3
|
+
"name": "dsh-bash-terminal-ts",
|
|
4
|
+
"version": "0.6.4",
|
|
5
|
+
"description": {
|
|
6
|
+
"en": "One shell tool that runs commands through PowerShell, Git Bash, MSYS2 or WSL on Windows, with a user-chosen default terminal in the Web UI settings.",
|
|
7
|
+
"zh": "一个 shell 工具,可在 Windows 上通过 PowerShell / Git Bash / MSYS2 / WSL 执行命令,默认终端在 Web UI 设置中选择。"
|
|
8
|
+
},
|
|
9
|
+
"homepage": "https://github.com/drscrewdriver/dsh-bash-terminal-ts",
|
|
10
|
+
"repository": {
|
|
11
|
+
"type": "git",
|
|
12
|
+
"url": "https://github.com/drscrewdriver/dsh-bash-terminal-ts.git"
|
|
13
|
+
},
|
|
14
|
+
"license": "MIT",
|
|
15
|
+
"engines": {
|
|
16
|
+
"dsh": ">=0.1.7-rc.1 <0.1.8-0"
|
|
17
|
+
},
|
|
18
|
+
"components": {
|
|
19
|
+
"host": "lib/index.js",
|
|
20
|
+
"client": "dist/client.js"
|
|
21
|
+
}
|
|
22
|
+
}
|
package/lib/client.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
window.__ModuleLoader__.load({
|
|
2
|
-
id: "dsh-bash-terminal",
|
|
2
|
+
id: "dsh-bash-terminal-ts",
|
|
3
3
|
factory: (require) => {
|
|
4
4
|
var module = { exports: {} };
|
|
5
5
|
var exports = module.exports;
|
|
@@ -38,7 +38,7 @@ var SHELLS = ["powershell", "gitbash", "msys2", "wsl"];
|
|
|
38
38
|
var ROW_CSS = ".btRow{border-bottom:1px solid var(--dsw-alias-border-l2);align-items:center;gap:8px;padding:16px 0;display:flex}.btRowText{flex-direction:column;flex:1;gap:4px;min-width:0;padding-right:48px;display:flex}.btTitle{color:var(--dsw-alias-label-primary);font-size:14px;font-weight:400;line-height:22px}.btDesc{color:var(--dsw-alias-label-tertiary);font-size:12px;font-weight:400;line-height:18px}.btSelector{background:var(--dsw-alias-bg-module-platform);height:36px;font:inherit;color:var(--dsw-alias-label-primary);cursor:pointer;border:none;border-radius:18px;align-items:center;gap:12px;padding:0 14px;font-size:14px;line-height:22px;display:inline-flex}.btSelector:hover{background:var(--dsw-alias-interactive-bg-hover)}.btChevron{flex:none}";
|
|
39
39
|
if (typeof document !== "undefined" && document.querySelector('style[data-plugin-css="bash-terminal-row"]') === null) {
|
|
40
40
|
const tag = document.createElement("style");
|
|
41
|
-
tag.dataset.plugin = "dsh-bash-terminal";
|
|
41
|
+
tag.dataset.plugin = "dsh-bash-terminal-ts";
|
|
42
42
|
tag.dataset.pluginCss = "bash-terminal-row";
|
|
43
43
|
tag.textContent = ROW_CSS;
|
|
44
44
|
document.head.appendChild(tag);
|
|
@@ -49,7 +49,8 @@ var zh = {
|
|
|
49
49
|
"shell.powershell": "PowerShell",
|
|
50
50
|
"shell.gitbash": "Git Bash",
|
|
51
51
|
"shell.msys2": "MSYS2",
|
|
52
|
-
"shell.wsl": "WSL"
|
|
52
|
+
"shell.wsl": "WSL",
|
|
53
|
+
"shell.unavailable": "\u8BBE\u7F6E\u9762\u4E0D\u53EF\u7528\uFF1A\u5BBF\u4E3B\u672A\u63D0\u4F9B\u672C\u63D2\u4EF6\u7684 configForms \u6761\u76EE\uFF08\u68C0\u67E5 cordis.patch.yml \u7684 entry id\uFF09"
|
|
53
54
|
};
|
|
54
55
|
var en = {
|
|
55
56
|
"shell.title": "Default terminal",
|
|
@@ -57,14 +58,22 @@ var en = {
|
|
|
57
58
|
"shell.powershell": "PowerShell",
|
|
58
59
|
"shell.gitbash": "Git Bash",
|
|
59
60
|
"shell.msys2": "MSYS2",
|
|
60
|
-
"shell.wsl": "WSL"
|
|
61
|
+
"shell.wsl": "WSL",
|
|
62
|
+
"shell.unavailable": "Settings unavailable: the host exposes no configForms entry for this plugin (check the cordis.patch.yml entry id)"
|
|
61
63
|
};
|
|
62
64
|
var inject = ["slots", "locale", "configForms"];
|
|
63
65
|
function ShellPreferenceRow({ t, useStore, setShell }) {
|
|
64
66
|
const shell = useStore((s) => s.shell);
|
|
65
67
|
const writable = useStore((s) => s.writable);
|
|
68
|
+
const status = useStore((s) => s.status);
|
|
66
69
|
const [open, setOpen] = (0, import_react.useState)(false);
|
|
67
70
|
const items = SHELLS.map((id) => ({ id, label: t("shell." + id) }));
|
|
71
|
+
if (status === "unavailable") {
|
|
72
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "btRow", children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "btRowText", children: [
|
|
73
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "btTitle", children: t("shell.title") }),
|
|
74
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "btDesc", children: t("shell.unavailable") })
|
|
75
|
+
] }) });
|
|
76
|
+
}
|
|
68
77
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "btRow", children: [
|
|
69
78
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "btRowText", children: [
|
|
70
79
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "btTitle", children: t("shell.title") }),
|
|
@@ -108,19 +117,20 @@ function apply(ctx) {
|
|
|
108
117
|
ctx.effect(() => ctx.locale.register(SETTINGS_NS, { zh, en }), "bash-terminal: settings dictionaries");
|
|
109
118
|
const scope = ctx.configForms.get(ENTRY_ID);
|
|
110
119
|
const store = (0, import_dsh_client_store.defineStore)({
|
|
111
|
-
init: () => ({ shell: "powershell", revision: -1, writable: false }),
|
|
120
|
+
init: () => ({ shell: "powershell", revision: -1, writable: false, status: "loading" }),
|
|
112
121
|
actions: {
|
|
113
|
-
sync: (d, shell, revision, writable) => {
|
|
122
|
+
sync: (d, shell, revision, writable, status) => {
|
|
114
123
|
if (revision !== void 0 && revision <= d.revision) return;
|
|
115
124
|
if (shell !== void 0) d.shell = shell;
|
|
116
125
|
if (revision !== void 0) d.revision = revision;
|
|
117
126
|
if (writable !== void 0) d.writable = writable;
|
|
127
|
+
if (status !== void 0) d.status = status;
|
|
118
128
|
}
|
|
119
129
|
}
|
|
120
130
|
});
|
|
121
131
|
let bound;
|
|
122
132
|
const push = (snap) => {
|
|
123
|
-
bound?.sync(snap.value?.defaultShell, snap.revision, snap.writable);
|
|
133
|
+
bound?.sync(snap.value?.defaultShell, snap.revision, snap.writable, snap.status);
|
|
124
134
|
};
|
|
125
135
|
ctx.slots.inject(
|
|
126
136
|
"dsh-family.tab",
|
package/lib/dsh-types.d.ts
CHANGED
|
@@ -241,7 +241,7 @@ export interface ApprovalSeam {
|
|
|
241
241
|
request(input: unknown): Promise<unknown>;
|
|
242
242
|
}
|
|
243
243
|
/**
|
|
244
|
-
* The structural context face dsh-bash-terminal programs against: the union
|
|
244
|
+
* The structural context face dsh-bash-terminal-ts programs against: the union
|
|
245
245
|
* of every `ctx.*` member touched by src/index.ts and src/terminal.ts.
|
|
246
246
|
*/
|
|
247
247
|
export interface BashTerminalContext {
|
package/lib/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// dsh-bash-terminal - one shell tool, four Windows terminals.
|
|
1
|
+
// dsh-bash-terminal-ts - one shell tool, four Windows terminals.
|
|
2
2
|
//
|
|
3
3
|
// Registers a model-facing shell tool. The terminal backend (powershell /
|
|
4
4
|
// gitbash / msys2 / wsl) is chosen by the USER in the Web UI settings (default
|
|
@@ -249,7 +249,7 @@ function spawnSpec(resolved, argv, env, signal) {
|
|
|
249
249
|
function collectedOutput(handle) {
|
|
250
250
|
const { stdout, stderr } = handle.collected;
|
|
251
251
|
if (!isCollectedStream(stdout) || !isCollectedStream(stderr)) {
|
|
252
|
-
throw new Error("dsh-bash-terminal: subprocess implementation dropped a requested collect stream");
|
|
252
|
+
throw new Error("dsh-bash-terminal-ts: subprocess implementation dropped a requested collect stream");
|
|
253
253
|
}
|
|
254
254
|
return { stdout, stderr };
|
|
255
255
|
}
|
|
@@ -290,7 +290,7 @@ async function runForeground(ctx, argv, resolved, env, signal, timeoutMs) {
|
|
|
290
290
|
function requireSubprocess(ctx) {
|
|
291
291
|
const subprocess = ctx.subprocess;
|
|
292
292
|
if (subprocess === null) {
|
|
293
|
-
throw new Error("dsh-bash-terminal: ctx.subprocess seam unavailable (missing inject service)");
|
|
293
|
+
throw new Error("dsh-bash-terminal-ts: ctx.subprocess seam unavailable (missing inject service)");
|
|
294
294
|
}
|
|
295
295
|
return subprocess;
|
|
296
296
|
}
|
|
@@ -493,7 +493,7 @@ const BACKGROUND_OUTPUT_PROPERTIES = {
|
|
|
493
493
|
// ---- plugin -------------------------------------------------------------------
|
|
494
494
|
export function apply(ctx, config = {}) {
|
|
495
495
|
if (process.platform !== "win32") {
|
|
496
|
-
ctx.logger?.info?.("dsh-bash-terminal: only meaningful on win32; skipping tool registration");
|
|
496
|
+
ctx.logger?.info?.("dsh-bash-terminal-ts: only meaningful on win32; skipping tool registration");
|
|
497
497
|
return;
|
|
498
498
|
}
|
|
499
499
|
const backgroundEnabled = true;
|
|
@@ -509,7 +509,7 @@ export function apply(ctx, config = {}) {
|
|
|
509
509
|
return typeof got === "string" ? got : DEFAULT_SHELL;
|
|
510
510
|
};
|
|
511
511
|
if (!SHELLS.includes(currentShell())) {
|
|
512
|
-
throw new Error(`dsh-bash-terminal: invalid defaultShell ${JSON.stringify(currentShell())}`);
|
|
512
|
+
throw new Error(`dsh-bash-terminal-ts: invalid defaultShell ${JSON.stringify(currentShell())}`);
|
|
513
513
|
}
|
|
514
514
|
/** Official sandbox-escalation surface (mirrors tool-bash): advertise the
|
|
515
515
|
* escalation modes whenever the deployment confines. */
|
|
@@ -653,7 +653,7 @@ export function apply(ctx, config = {}) {
|
|
|
653
653
|
const shell = currentShell();
|
|
654
654
|
const argv0 = buildArgv(shell, v.command, paths, v.distro);
|
|
655
655
|
if (argv0[0] === undefined) {
|
|
656
|
-
throw new Error(`dsh-bash-terminal: ${shell} backend unavailable - executable not found. Install it or set the corresponding *Path config.`);
|
|
656
|
+
throw new Error(`dsh-bash-terminal-ts: ${shell} backend unavailable - executable not found. Install it or set the corresponding *Path config.`);
|
|
657
657
|
}
|
|
658
658
|
// Only element 0 (the resolved executable) can be undefined; guarded above.
|
|
659
659
|
const argv = argv0;
|
package/lib/terminal.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// dsh-bash-terminal: interactive terminal tool over the official PTY seam.
|
|
1
|
+
// dsh-bash-terminal-ts: interactive terminal tool over the official PTY seam.
|
|
2
2
|
// ctx.subprocess.spawnTerminal (node-pty under the hood) allocates a real
|
|
3
3
|
// terminal; this module owns model-facing sessions: open / send / read /
|
|
4
4
|
// signal (Ctrl+C etc.) / close. The backend follows the user's default
|
package/package.json
CHANGED
package/scripts/build-client.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Build the browser client bundle for dsh-bash-terminal.
|
|
1
|
+
// Build the browser client bundle for dsh-bash-terminal-ts.
|
|
2
2
|
// Output: lib/client.js (primary, consumed by DSH loader/reload precheck) and
|
|
3
3
|
// dist/client.js (legacy compatibility) — a __ModuleLoader__.load({ id, factory })
|
|
4
4
|
// wrapper around the esbuild CJS bundle; shared deps (react, @deepseek-ai/*)
|
|
@@ -33,7 +33,7 @@ await build({
|
|
|
33
33
|
|
|
34
34
|
const core = readFileSync(join(root, "dist", "client.core.js"), "utf8");
|
|
35
35
|
const wrapper = `window.__ModuleLoader__.load({
|
|
36
|
-
id: "dsh-bash-terminal",
|
|
36
|
+
id: "dsh-bash-terminal-ts",
|
|
37
37
|
factory: (require) => {
|
|
38
38
|
var module = { exports: {} };
|
|
39
39
|
var exports = module.exports;
|
package/src/client.tsx
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// dsh-bash-terminal client plugin: a "Default terminal" preference row in the
|
|
1
|
+
// dsh-bash-terminal-ts client plugin: a "Default terminal" preference row in the
|
|
2
2
|
// Web UI General settings, mirroring the shipped EnterBehaviorRow grammar
|
|
3
3
|
// (row layout, capsule selector with chevron, --dsw-* tokens).
|
|
4
4
|
//
|
|
@@ -33,7 +33,7 @@ const ROW_CSS =
|
|
|
33
33
|
".btChevron{flex:none}";
|
|
34
34
|
if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=\"bash-terminal-row\"]") === null) {
|
|
35
35
|
const tag = document.createElement("style");
|
|
36
|
-
tag.dataset.plugin = "dsh-bash-terminal";
|
|
36
|
+
tag.dataset.plugin = "dsh-bash-terminal-ts";
|
|
37
37
|
tag.dataset.pluginCss = "bash-terminal-row";
|
|
38
38
|
tag.textContent = ROW_CSS;
|
|
39
39
|
document.head.appendChild(tag);
|
|
@@ -45,7 +45,8 @@ const zh: Record<string, string> = {
|
|
|
45
45
|
"shell.powershell": "PowerShell",
|
|
46
46
|
"shell.gitbash": "Git Bash",
|
|
47
47
|
"shell.msys2": "MSYS2",
|
|
48
|
-
"shell.wsl": "WSL"
|
|
48
|
+
"shell.wsl": "WSL",
|
|
49
|
+
"shell.unavailable": "设置面不可用:宿主未提供本插件的 configForms 条目(检查 cordis.patch.yml 的 entry id)"
|
|
49
50
|
};
|
|
50
51
|
const en: Record<string, string> = {
|
|
51
52
|
"shell.title": "Default terminal",
|
|
@@ -53,7 +54,8 @@ const en: Record<string, string> = {
|
|
|
53
54
|
"shell.powershell": "PowerShell",
|
|
54
55
|
"shell.gitbash": "Git Bash",
|
|
55
56
|
"shell.msys2": "MSYS2",
|
|
56
|
-
"shell.wsl": "WSL"
|
|
57
|
+
"shell.wsl": "WSL",
|
|
58
|
+
"shell.unavailable": "Settings unavailable: the host exposes no configForms entry for this plugin (check the cordis.patch.yml entry id)"
|
|
57
59
|
};
|
|
58
60
|
|
|
59
61
|
export const inject = ["slots", "locale", "configForms"];
|
|
@@ -63,6 +65,7 @@ interface RowState {
|
|
|
63
65
|
shell: string;
|
|
64
66
|
revision: number;
|
|
65
67
|
writable: boolean;
|
|
68
|
+
status: "loading" | "ready" | "unavailable";
|
|
66
69
|
}
|
|
67
70
|
|
|
68
71
|
interface ShellPreferenceRowProps {
|
|
@@ -74,8 +77,19 @@ interface ShellPreferenceRowProps {
|
|
|
74
77
|
function ShellPreferenceRow({ t, useStore, setShell }: ShellPreferenceRowProps) {
|
|
75
78
|
const shell = useStore((s) => s.shell);
|
|
76
79
|
const writable = useStore((s) => s.writable);
|
|
80
|
+
const status = useStore((s) => s.status);
|
|
77
81
|
const [open, setOpen] = useState(false);
|
|
78
82
|
const items = SHELLS.map((id) => ({ id, label: t("shell." + id) }));
|
|
83
|
+
if (status === "unavailable") {
|
|
84
|
+
return (
|
|
85
|
+
<div className="btRow">
|
|
86
|
+
<div className="btRowText">
|
|
87
|
+
<div className="btTitle">{t("shell.title")}</div>
|
|
88
|
+
<div className="btDesc">{t("shell.unavailable")}</div>
|
|
89
|
+
</div>
|
|
90
|
+
</div>
|
|
91
|
+
);
|
|
92
|
+
}
|
|
79
93
|
return (
|
|
80
94
|
<div className="btRow">
|
|
81
95
|
<div className="btRowText">
|
|
@@ -137,7 +151,7 @@ interface ClientContext {
|
|
|
137
151
|
}
|
|
138
152
|
|
|
139
153
|
interface RowStoreActions {
|
|
140
|
-
sync(shell?: string, revision?: number, writable?: boolean): void;
|
|
154
|
+
sync(shell?: string, revision?: number, writable?: boolean, status?: RowState["status"]): void;
|
|
141
155
|
}
|
|
142
156
|
|
|
143
157
|
interface RowStore {
|
|
@@ -150,20 +164,21 @@ const zhDictTitle = (): string => (zh as Record<string, string>)["shell.title"]
|
|
|
150
164
|
export function apply(ctx: ClientContext): void {
|
|
151
165
|
ctx.effect(() => ctx.locale.register(SETTINGS_NS, { zh, en }), "bash-terminal: settings dictionaries");
|
|
152
166
|
const scope = ctx.configForms.get(ENTRY_ID);
|
|
153
|
-
const store = defineStore<RowState, { sync: (draft: RowState, shell?: string, revision?: number, writable?: boolean) => void }>({
|
|
154
|
-
init: (): RowState => ({ shell: "powershell", revision: -1, writable: false }),
|
|
167
|
+
const store = defineStore<RowState, { sync: (draft: RowState, shell?: string, revision?: number, writable?: boolean, status?: RowState["status"]) => void }>({
|
|
168
|
+
init: (): RowState => ({ shell: "powershell", revision: -1, writable: false, status: "loading" }),
|
|
155
169
|
actions: {
|
|
156
|
-
sync: (d, shell, revision, writable) => {
|
|
170
|
+
sync: (d, shell, revision, writable, status) => {
|
|
157
171
|
if (revision !== undefined && revision <= d.revision) return;
|
|
158
172
|
if (shell !== undefined) d.shell = shell;
|
|
159
173
|
if (revision !== undefined) d.revision = revision;
|
|
160
174
|
if (writable !== undefined) d.writable = writable;
|
|
175
|
+
if (status !== undefined) d.status = status;
|
|
161
176
|
}
|
|
162
177
|
}
|
|
163
178
|
});
|
|
164
179
|
let bound: RowStoreActions | undefined;
|
|
165
180
|
const push = (snap: SettingsSnapshot): void => {
|
|
166
|
-
bound?.sync(snap.value?.defaultShell, snap.revision, snap.writable);
|
|
181
|
+
bound?.sync(snap.value?.defaultShell, snap.revision, snap.writable, snap.status);
|
|
167
182
|
};
|
|
168
183
|
// 插件族共用设置 tab(dsh-thinking-levels 顶级「起子插件设置」节声明该子席位)。
|
|
169
184
|
// thinking-levels 缺席时本 inject 静默等待,不阻塞客户端半。
|
package/src/dsh-types.ts
CHANGED
|
@@ -294,7 +294,7 @@ export interface ApprovalSeam {
|
|
|
294
294
|
// ---- plugin context (server side) ----------------------------------------------
|
|
295
295
|
|
|
296
296
|
/**
|
|
297
|
-
* The structural context face dsh-bash-terminal programs against: the union
|
|
297
|
+
* The structural context face dsh-bash-terminal-ts programs against: the union
|
|
298
298
|
* of every `ctx.*` member touched by src/index.ts and src/terminal.ts.
|
|
299
299
|
*/
|
|
300
300
|
export interface BashTerminalContext {
|
package/src/index.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// dsh-bash-terminal - one shell tool, four Windows terminals.
|
|
1
|
+
// dsh-bash-terminal-ts - one shell tool, four Windows terminals.
|
|
2
2
|
//
|
|
3
3
|
// Registers a model-facing shell tool. The terminal backend (powershell /
|
|
4
4
|
// gitbash / msys2 / wsl) is chosen by the USER in the Web UI settings (default
|
|
@@ -324,7 +324,7 @@ function spawnSpec(resolved: SpawnResolution, argv: string[], env: Record<string
|
|
|
324
324
|
function collectedOutput(handle: { collected: { stdout: unknown; stderr: unknown } }) {
|
|
325
325
|
const { stdout, stderr } = handle.collected;
|
|
326
326
|
if (!isCollectedStream(stdout) || !isCollectedStream(stderr)) {
|
|
327
|
-
throw new Error("dsh-bash-terminal: subprocess implementation dropped a requested collect stream");
|
|
327
|
+
throw new Error("dsh-bash-terminal-ts: subprocess implementation dropped a requested collect stream");
|
|
328
328
|
}
|
|
329
329
|
return { stdout, stderr };
|
|
330
330
|
}
|
|
@@ -395,7 +395,7 @@ async function runForeground(
|
|
|
395
395
|
function requireSubprocess(ctx: BashTerminalContext) {
|
|
396
396
|
const subprocess = ctx.subprocess;
|
|
397
397
|
if (subprocess === null) {
|
|
398
|
-
throw new Error("dsh-bash-terminal: ctx.subprocess seam unavailable (missing inject service)");
|
|
398
|
+
throw new Error("dsh-bash-terminal-ts: ctx.subprocess seam unavailable (missing inject service)");
|
|
399
399
|
}
|
|
400
400
|
return subprocess;
|
|
401
401
|
}
|
|
@@ -669,7 +669,7 @@ const BACKGROUND_OUTPUT_PROPERTIES: Record<string, JsonSchemaNode> = {
|
|
|
669
669
|
|
|
670
670
|
export function apply(ctx: BashTerminalContext, config: Partial<ConfigValues> = {}): void {
|
|
671
671
|
if (process.platform !== "win32") {
|
|
672
|
-
ctx.logger?.info?.("dsh-bash-terminal: only meaningful on win32; skipping tool registration");
|
|
672
|
+
ctx.logger?.info?.("dsh-bash-terminal-ts: only meaningful on win32; skipping tool registration");
|
|
673
673
|
return;
|
|
674
674
|
}
|
|
675
675
|
const backgroundEnabled = true;
|
|
@@ -684,7 +684,7 @@ export function apply(ctx: BashTerminalContext, config: Partial<ConfigValues> =
|
|
|
684
684
|
return typeof got === "string" ? got : DEFAULT_SHELL;
|
|
685
685
|
};
|
|
686
686
|
if (!(SHELLS as readonly string[]).includes(currentShell())) {
|
|
687
|
-
throw new Error(`dsh-bash-terminal: invalid defaultShell ${JSON.stringify(currentShell())}`);
|
|
687
|
+
throw new Error(`dsh-bash-terminal-ts: invalid defaultShell ${JSON.stringify(currentShell())}`);
|
|
688
688
|
}
|
|
689
689
|
/** Official sandbox-escalation surface (mirrors tool-bash): advertise the
|
|
690
690
|
* escalation modes whenever the deployment confines. */
|
|
@@ -835,7 +835,7 @@ export function apply(ctx: BashTerminalContext, config: Partial<ConfigValues> =
|
|
|
835
835
|
const shell = currentShell();
|
|
836
836
|
const argv0 = buildArgv(shell, v.command, paths, v.distro);
|
|
837
837
|
if (argv0[0] === undefined) {
|
|
838
|
-
throw new Error(`dsh-bash-terminal: ${shell} backend unavailable - executable not found. Install it or set the corresponding *Path config.`);
|
|
838
|
+
throw new Error(`dsh-bash-terminal-ts: ${shell} backend unavailable - executable not found. Install it or set the corresponding *Path config.`);
|
|
839
839
|
}
|
|
840
840
|
// Only element 0 (the resolved executable) can be undefined; guarded above.
|
|
841
841
|
const argv = argv0 as string[];
|
package/src/terminal.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// dsh-bash-terminal: interactive terminal tool over the official PTY seam.
|
|
1
|
+
// dsh-bash-terminal-ts: interactive terminal tool over the official PTY seam.
|
|
2
2
|
// ctx.subprocess.spawnTerminal (node-pty under the hood) allocates a real
|
|
3
3
|
// terminal; this module owns model-facing sessions: open / send / read /
|
|
4
4
|
// signal (Ctrl+C etc.) / close. The backend follows the user's default
|