dsh-bash-terminal-ts 0.6.3 → 0.7.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.en.md +12 -10
- package/README.md +24 -21
- package/cordis.patch.yml +2 -2
- package/dist/client.core.js +151 -151
- package/dist/client.js +160 -160
- package/dsh.plugin.json +22 -22
- package/lib/client.js +160 -160
- package/lib/dsh-types.d.ts +259 -259
- package/lib/dsh-types.js +9 -9
- package/lib/dsh.d.ts +35 -35
- package/lib/dsh.js +29 -29
- package/lib/index.d.ts +200 -200
- package/lib/index.js +765 -765
- package/lib/terminal.d.ts +110 -110
- package/lib/terminal.js +438 -438
- package/package.json +125 -119
- package/scripts/build-client.mjs +2 -2
- package/src/client.tsx +201 -207
- package/src/dsh-types.ts +1 -1
- package/src/index.ts +6 -6
- package/src/terminal.ts +2 -3
- package/template/README.md +82 -82
- package/template/terminal-adapter.ts +343 -343
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
|
|
|
@@ -6,14 +6,16 @@ A DeepSeek Harness (DSH) plugin: one `shell` tool that runs commands through **P
|
|
|
6
6
|
|
|
7
7
|

|
|
8
8
|
|
|
9
|
-
> **TypeScript rewrite of `MAXeaglet/dsh-bash-terminal`**, with working MSYS2/MINGW64 support.
|
|
9
|
+
> **TypeScript rewrite of `MAXeaglet/dsh-bash-terminal`**, with working MSYS2/MINGW64 support. Compatibility lines are cut per DSH host segment; all lines share the package name `dsh-bash-terminal-ts` and are distinguished by npm dist-tag:
|
|
10
10
|
>
|
|
11
|
-
> |
|
|
12
|
-
>
|
|
13
|
-
> |
|
|
14
|
-
> |
|
|
11
|
+
> | DSH segment | Branch | Plugin series | npm dist-tag |
|
|
12
|
+
> |-------------|--------|---------------|--------------|
|
|
13
|
+
> | `>=0.2.0-rc.1 <0.2.1-0` | `compat/0.2.0` (this branch) | 0.7.x | `dsh-0.2.0` |
|
|
14
|
+
> | 0.1.7-rc.1 – 0.1.7.x | `compat/0.1.7` | 0.6.x | `dsh-0.1.7` |
|
|
15
|
+
> | 0.1.5-alpha.1 – 0.1.5-rc.x | `ts/0.1.5` (historical, frozen) | ≤ 0.5.2 | `dsh-0.1.5` |
|
|
16
|
+
> | 0.1.2-alpha.1 – 0.1.2-rc.x | `main` (historical, frozen) | ≤ 0.4.2 | `dsh-0.1.2` |
|
|
15
17
|
>
|
|
16
|
-
>
|
|
18
|
+
> Pick the line that covers your DSH build; the version series never overlap, so a `^` install cannot resolve across lines.
|
|
17
19
|
|
|
18
20
|
## Features
|
|
19
21
|
|
|
@@ -37,11 +39,11 @@ The **Default terminal** row in Settings -> General: the user picks PowerShell /
|
|
|
37
39
|
|
|
38
40
|
## Install
|
|
39
41
|
|
|
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.
|
|
42
|
+
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
43
|
|
|
42
44
|
```powershell
|
|
43
|
-
npm install -g dsh-bash-terminal
|
|
44
|
-
dsh plugin --profile web add dsh-bash-terminal # adds to profile bundles + applies the patch
|
|
45
|
+
npm install -g dsh-bash-terminal-ts
|
|
46
|
+
dsh plugin --profile web add dsh-bash-terminal-ts # adds to profile bundles + applies the patch
|
|
45
47
|
powershell -ExecutionPolicy Bypass -File install.ps1 install # patches the DSH settings-UI allowlist (see below)
|
|
46
48
|
# restart dsh web
|
|
47
49
|
```
|
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
|
|
|
@@ -6,14 +6,16 @@
|
|
|
6
6
|
|
|
7
7
|
DSH(DeepSeek Harness)插件:一个 `shell` 工具,在 Windows 上统一执行 **PowerShell / Git Bash / MSYS2 / WSL** 四种终端命令。
|
|
8
8
|
|
|
9
|
-
> **本仓库是 `MAXeaglet/dsh-bash-terminal` 的 TypeScript 重写**,带可用的 MSYS2/MINGW64
|
|
9
|
+
> **本仓库是 `MAXeaglet/dsh-bash-terminal` 的 TypeScript 重写**,带可用的 MSYS2/MINGW64 支持。兼容线按 DSH 宿主段划分,各线共用包名 `dsh-bash-terminal-ts`,以 npm dist-tag 区分:
|
|
10
10
|
>
|
|
11
|
-
> |
|
|
12
|
-
>
|
|
13
|
-
> |
|
|
14
|
-
> |
|
|
11
|
+
> | DSH 段 | 分支 | 插件版本 | npm dist-tag |
|
|
12
|
+
> |--------|------|----------|--------------|
|
|
13
|
+
> | `>=0.2.0-rc.1 <0.2.1-0` | `compat/0.2.0`(本分支) | 0.7.x | `dsh-0.2.0` |
|
|
14
|
+
> | 0.1.7-rc.1 – 0.1.7.x | `compat/0.1.7` | 0.6.x | `dsh-0.1.7` |
|
|
15
|
+
> | 0.1.5-alpha.1 – 0.1.5-rc.x | `ts/0.1.5`(历史,冻结) | ≤ 0.5.2 | `dsh-0.1.5` |
|
|
16
|
+
> | 0.1.2-alpha.1 – 0.1.2-rc.x | `main`(历史,冻结) | ≤ 0.4.2 | `dsh-0.1.2` |
|
|
15
17
|
>
|
|
16
|
-
>
|
|
18
|
+
> 请按你的 DSH 版本选线安装;各线版本系列互不重叠,`^` 安装不会跨线解析。
|
|
17
19
|
|
|
18
20
|
| 后端 | 实际执行 | 语法 / 路径 | 环境变量 |
|
|
19
21
|
|------|----------|-------------|----------|
|
|
@@ -46,8 +48,8 @@ DSH(DeepSeek Harness)插件:一个 `shell` 工具,在 Windows 上统一
|
|
|
46
48
|
|
|
47
49
|
```powershell
|
|
48
50
|
# 1. 安装插件包
|
|
49
|
-
npm install -g dsh-bash-terminal
|
|
50
|
-
dsh plugin --profile web add dsh-bash-terminal # 自动加进 profile 的 bundles 并应用 patch
|
|
51
|
+
npm install -g dsh-bash-terminal-ts
|
|
52
|
+
dsh plugin --profile web add dsh-bash-terminal-ts # 自动加进 profile 的 bundles 并应用 patch
|
|
51
53
|
|
|
52
54
|
# 2. patch DSH 设置白名单(DSH 限制,见下方说明)
|
|
53
55
|
powershell -ExecutionPolicy Bypass -File install.ps1 install
|
|
@@ -55,21 +57,21 @@ powershell -ExecutionPolicy Bypass -File install.ps1 install
|
|
|
55
57
|
# 3. 重启 dsh web
|
|
56
58
|
```
|
|
57
59
|
|
|
58
|
-
> 已用临时 profile 实测:`bundles: [dsh-bash-terminal]` → dump-config 自动出现 `tool-bash-terminal` entry。
|
|
60
|
+
> 已用临时 profile 实测:`bundles: [dsh-bash-terminal-ts]` → dump-config 自动出现 `tool-bash-terminal` entry。
|
|
59
61
|
|
|
60
62
|
### 本地开发安装(junction 直连,改源码即时生效)
|
|
61
63
|
|
|
62
64
|
```powershell
|
|
63
65
|
# 1. 链接插件包到 profile 的 node_modules(junction,改源码即时生效)
|
|
64
66
|
$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
|
|
67
|
+
New-Item -ItemType Junction -Path "$profile\node_modules\dsh-bash-terminal-ts" -Target "D:\workspace\projects\dsh-bash-terminal-ts" | Out-Null
|
|
66
68
|
|
|
67
69
|
# 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
|
|
70
|
+
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
71
|
|
|
70
|
-
# 3. 让 profile 通过官方 bundle 挂载插件(install.ps1 install 会自动做;等价于在 dsh.profile.bundles 加 "dsh-bash-terminal")
|
|
72
|
+
# 3. 让 profile 通过官方 bundle 挂载插件(install.ps1 install 会自动做;等价于在 dsh.profile.bundles 加 "dsh-bash-terminal-ts")
|
|
71
73
|
# 4. (仅修改前端源码后)重新打包 client bundle:
|
|
72
|
-
# cd D:\workspace\projects\dsh-bash-terminal && node scripts/build-client.mjs
|
|
74
|
+
# cd D:\workspace\projects\dsh-bash-terminal-ts && node scripts/build-client.mjs
|
|
73
75
|
# 5. 重启 dsh web
|
|
74
76
|
```
|
|
75
77
|
|
|
@@ -77,19 +79,20 @@ New-Item -ItemType Junction -Path "D:\workspace\projects\dsh-bash-terminal\node_
|
|
|
77
79
|
> `@deepseek-ai/*` 副本 —— 插件和宿主就不再共用模块实例,宿主升级后插件会停在旧 API 上
|
|
78
80
|
> (本项目曾因此停在 0.1.0-rc.6)。只刷新 lock 时用 `npm install --package-lock-only`。
|
|
79
81
|
|
|
80
|
-
> **兼容性**:要求 DSH ≥ **0.1.
|
|
82
|
+
> **兼容性**:要求 DSH ≥ **0.1.7-rc.1**(`compat/0.1.7` 线)或 ≥ **0.2.0-rc.1**(`compat/0.2.0` 线,本分支)。
|
|
83
|
+
> 历史背景:0.1.5 把浏览器模块表里的 `@deepseek-ai/dsh-client-runtime`
|
|
81
84
|
> 改名为 `@deepseek-ai/dsh-client-store` 且只按精确裸名命中;旧 bundle 在新宿主上会报
|
|
82
85
|
> `Failed to load plugins` / `require(...) missed the module table`。
|
|
83
86
|
>
|
|
84
87
|
> 另:0.1.5 的 Web 设置面改为 `settings.describe()` 动态枚举,**不再有 namespace 白名单**
|
|
85
88
|
> (`settings-not-exposed` 已不存在),`install.ps1` 里的白名单 patch 只是历史遗留、可忽略。
|
|
86
89
|
|
|
87
|
-
> 当前已不再需要手动改 profile 的 `cordis.patch.yml`:插件包内自带 `dsh.bundle.patch`(包内 `cordis.patch.yml`),只要 profile 的 `dsh.profile.bundles` 里有 `dsh-bash-terminal`,DSH 就会自动挂载。
|
|
90
|
+
> 当前已不再需要手动改 profile 的 `cordis.patch.yml`:插件包内自带 `dsh.bundle.patch`(包内 `cordis.patch.yml`),只要 profile 的 `dsh.profile.bundles` 里有 `dsh-bash-terminal-ts`,DSH 就会自动挂载。
|
|
88
91
|
|
|
89
92
|
验证组合树(无需重启):
|
|
90
93
|
|
|
91
94
|
```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
|
|
95
|
+
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
96
|
```
|
|
94
97
|
|
|
95
98
|
## 使用
|
|
@@ -132,7 +135,7 @@ node "$env:APPDATA\nvm\<node-version>\node_modules\@deepseek-ai\dsh\lib\bin.js"
|
|
|
132
135
|
npm 账号已启用 2FA 发布验证,需一次性验证码:
|
|
133
136
|
|
|
134
137
|
```powershell
|
|
135
|
-
cd D:\workspace\projects\dsh-bash-terminal
|
|
138
|
+
cd D:\workspace\projects\dsh-bash-terminal-ts
|
|
136
139
|
npm publish --otp <验证码> # 验证码来自你的认证器
|
|
137
140
|
```
|
|
138
141
|
|
|
@@ -146,9 +149,9 @@ npm publish --otp <验证码> # 验证码来自你的认证器
|
|
|
146
149
|
powershell -ExecutionPolicy Bypass -File install.ps1 uninstall
|
|
147
150
|
```
|
|
148
151
|
|
|
149
|
-
它会删除 junction、恢复设置白名单、清理旧版遗留的 `cordis.patch.yml` 挂载块,并从 `dsh.profile.bundles` 移除 `dsh-bash-terminal`。之后重启 dsh web 即可。
|
|
152
|
+
它会删除 junction、恢复设置白名单、清理旧版遗留的 `cordis.patch.yml` 挂载块,并从 `dsh.profile.bundles` 移除 `dsh-bash-terminal-ts`。之后重启 dsh web 即可。
|
|
150
153
|
|
|
151
|
-
手动卸载时,除了删除 `node_modules\dsh-bash-terminal`,还要记得从 profile `package.json` 的 `dsh.profile.bundles` 中移除 `dsh-bash-terminal`。
|
|
154
|
+
手动卸载时,除了删除 `node_modules\dsh-bash-terminal-ts`,还要记得从 profile `package.json` 的 `dsh.profile.bundles` 中移除 `dsh-bash-terminal-ts`。
|
|
152
155
|
|
|
153
156
|
## 交互式终端(terminal 工具)
|
|
154
157
|
|
|
@@ -194,7 +197,7 @@ powershell -ExecutionPolicy Bypass -File install.ps1 uninstall
|
|
|
194
197
|
## 测试
|
|
195
198
|
|
|
196
199
|
```powershell
|
|
197
|
-
cd D:\workspace\projects\dsh-bash-terminal
|
|
200
|
+
cd D:\workspace\projects\dsh-bash-terminal-ts
|
|
198
201
|
npm install # 安装依赖(含 typescript)
|
|
199
202
|
npm run build # tsc 编译 src/*.ts → lib/*.js;client.tsx → lib/client.js + dist/client.js;test/*.ts → test-dist/
|
|
200
203
|
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
|
@@ -1,151 +1,151 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
-
var __export = (target, all) => {
|
|
6
|
-
for (var name in all)
|
|
7
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
-
};
|
|
9
|
-
var __copyProps = (to, from, except, desc) => {
|
|
10
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
-
for (let key of __getOwnPropNames(from))
|
|
12
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
-
}
|
|
15
|
-
return to;
|
|
16
|
-
};
|
|
17
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
-
|
|
19
|
-
// src/client.tsx
|
|
20
|
-
var client_exports = {};
|
|
21
|
-
__export(client_exports, {
|
|
22
|
-
apply: () => apply,
|
|
23
|
-
inject: () => inject
|
|
24
|
-
});
|
|
25
|
-
module.exports = __toCommonJS(client_exports);
|
|
26
|
-
var import_react = require("react");
|
|
27
|
-
var import_dsh_client_store = require("@deepseek-ai/dsh-client-store");
|
|
28
|
-
var import_dsh_client_ui_primitives = require("@deepseek-ai/dsh-client-ui-primitives");
|
|
29
|
-
var import_jsx_runtime = require("react/jsx-runtime");
|
|
30
|
-
var SETTINGS_NS = "settings.bash-terminal";
|
|
31
|
-
var ENTRY_ID = "tool-bash-terminal";
|
|
32
|
-
var SHELLS = ["powershell", "gitbash", "msys2", "wsl"];
|
|
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
|
-
if (typeof document !== "undefined" && document.querySelector('style[data-plugin-css="bash-terminal-row"]') === null) {
|
|
35
|
-
const tag = document.createElement("style");
|
|
36
|
-
tag.dataset.plugin = "dsh-bash-terminal";
|
|
37
|
-
tag.dataset.pluginCss = "bash-terminal-row";
|
|
38
|
-
tag.textContent = ROW_CSS;
|
|
39
|
-
document.head.appendChild(tag);
|
|
40
|
-
}
|
|
41
|
-
var zh = {
|
|
42
|
-
"shell.title": "\u9ED8\u8BA4\u7EC8\u7AEF",
|
|
43
|
-
"shell.description": "shell \u5DE5\u5177\u6267\u884C\u547D\u4EE4\u65F6\u4F7F\u7528\u7684\u7EC8\u7AEF",
|
|
44
|
-
"shell.powershell": "PowerShell",
|
|
45
|
-
"shell.gitbash": "Git Bash",
|
|
46
|
-
"shell.msys2": "MSYS2",
|
|
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"
|
|
49
|
-
};
|
|
50
|
-
var en = {
|
|
51
|
-
"shell.title": "Default terminal",
|
|
52
|
-
"shell.description": "Terminal used by the shell tool",
|
|
53
|
-
"shell.powershell": "PowerShell",
|
|
54
|
-
"shell.gitbash": "Git Bash",
|
|
55
|
-
"shell.msys2": "MSYS2",
|
|
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)"
|
|
58
|
-
};
|
|
59
|
-
var inject = ["slots", "locale", "configForms"];
|
|
60
|
-
function ShellPreferenceRow({ t, useStore, setShell }) {
|
|
61
|
-
const shell = useStore((s) => s.shell);
|
|
62
|
-
const writable = useStore((s) => s.writable);
|
|
63
|
-
const status = useStore((s) => s.status);
|
|
64
|
-
const [open, setOpen] = (0, import_react.useState)(false);
|
|
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
|
-
}
|
|
72
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "btRow", children: [
|
|
73
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "btRowText", children: [
|
|
74
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "btTitle", children: t("shell.title") }),
|
|
75
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "btDesc", children: t("shell.description") })
|
|
76
|
-
] }),
|
|
77
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
78
|
-
import_dsh_client_ui_primitives.Menu,
|
|
79
|
-
{
|
|
80
|
-
open,
|
|
81
|
-
onClose: () => setOpen(false),
|
|
82
|
-
items,
|
|
83
|
-
selectedId: shell,
|
|
84
|
-
onSelect: (id) => {
|
|
85
|
-
setOpen(false);
|
|
86
|
-
setShell(id);
|
|
87
|
-
},
|
|
88
|
-
align: "end",
|
|
89
|
-
portal: true,
|
|
90
|
-
anchor: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
91
|
-
"button",
|
|
92
|
-
{
|
|
93
|
-
type: "button",
|
|
94
|
-
className: "btSelector",
|
|
95
|
-
"aria-haspopup": "menu",
|
|
96
|
-
"aria-expanded": open,
|
|
97
|
-
disabled: !writable,
|
|
98
|
-
onClick: () => setOpen(!open),
|
|
99
|
-
style: !writable ? { opacity: 0.5, cursor: "not-allowed" } : void 0,
|
|
100
|
-
children: [
|
|
101
|
-
t("shell." + shell),
|
|
102
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dsh_client_ui_primitives.IconChevronDownOutlineMedium, { className: "btChevron" })
|
|
103
|
-
]
|
|
104
|
-
}
|
|
105
|
-
)
|
|
106
|
-
}
|
|
107
|
-
)
|
|
108
|
-
] });
|
|
109
|
-
}
|
|
110
|
-
var zhDictTitle = () => zh["shell.title"] ?? "\u7EC8\u7AEF";
|
|
111
|
-
function apply(ctx) {
|
|
112
|
-
ctx.effect(() => ctx.locale.register(SETTINGS_NS, { zh, en }), "bash-terminal: settings dictionaries");
|
|
113
|
-
const scope = ctx.configForms.get(ENTRY_ID);
|
|
114
|
-
const store = (0, import_dsh_client_store.defineStore)({
|
|
115
|
-
init: () => ({ shell: "powershell", revision: -1, writable: false, status: "loading" }),
|
|
116
|
-
actions: {
|
|
117
|
-
sync: (d, shell, revision, writable, status) => {
|
|
118
|
-
if (revision !== void 0 && revision <= d.revision) return;
|
|
119
|
-
if (shell !== void 0) d.shell = shell;
|
|
120
|
-
if (revision !== void 0) d.revision = revision;
|
|
121
|
-
if (writable !== void 0) d.writable = writable;
|
|
122
|
-
if (status !== void 0) d.status = status;
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
});
|
|
126
|
-
let bound;
|
|
127
|
-
const push = (snap) => {
|
|
128
|
-
bound?.sync(snap.value?.defaultShell, snap.revision, snap.writable, snap.status);
|
|
129
|
-
};
|
|
130
|
-
ctx.slots.inject(
|
|
131
|
-
"dsh-family.tab",
|
|
132
|
-
() => ctx.slots.register(
|
|
133
|
-
{
|
|
134
|
-
name: "dsh-family.tab",
|
|
135
|
-
id: "bash-terminal-shell",
|
|
136
|
-
order: 60,
|
|
137
|
-
label: () => zhDictTitle(),
|
|
138
|
-
store,
|
|
139
|
-
locale: SETTINGS_NS,
|
|
140
|
-
inject: (actions) => {
|
|
141
|
-
bound = actions;
|
|
142
|
-
push(scope.getSnapshot());
|
|
143
|
-
return { setShell: (value) => void scope.set("defaultShell", value) };
|
|
144
|
-
}
|
|
145
|
-
},
|
|
146
|
-
ShellPreferenceRow
|
|
147
|
-
),
|
|
148
|
-
"bash-terminal: settings row"
|
|
149
|
-
);
|
|
150
|
-
ctx.effect(() => scope.subscribe(() => push(scope.getSnapshot())), "bash-terminal: settings watch");
|
|
151
|
-
}
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
|
|
19
|
+
// src/client.tsx
|
|
20
|
+
var client_exports = {};
|
|
21
|
+
__export(client_exports, {
|
|
22
|
+
apply: () => apply,
|
|
23
|
+
inject: () => inject
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(client_exports);
|
|
26
|
+
var import_react = require("react");
|
|
27
|
+
var import_dsh_client_store = require("@deepseek-ai/dsh-client-store");
|
|
28
|
+
var import_dsh_client_ui_primitives = require("@deepseek-ai/dsh-client-ui-primitives");
|
|
29
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
30
|
+
var SETTINGS_NS = "settings.bash-terminal";
|
|
31
|
+
var ENTRY_ID = "tool-bash-terminal";
|
|
32
|
+
var SHELLS = ["powershell", "gitbash", "msys2", "wsl"];
|
|
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
|
+
if (typeof document !== "undefined" && document.querySelector('style[data-plugin-css="bash-terminal-row"]') === null) {
|
|
35
|
+
const tag = document.createElement("style");
|
|
36
|
+
tag.dataset.plugin = "dsh-bash-terminal-ts";
|
|
37
|
+
tag.dataset.pluginCss = "bash-terminal-row";
|
|
38
|
+
tag.textContent = ROW_CSS;
|
|
39
|
+
document.head.appendChild(tag);
|
|
40
|
+
}
|
|
41
|
+
var zh = {
|
|
42
|
+
"shell.title": "\u9ED8\u8BA4\u7EC8\u7AEF",
|
|
43
|
+
"shell.description": "shell \u5DE5\u5177\u6267\u884C\u547D\u4EE4\u65F6\u4F7F\u7528\u7684\u7EC8\u7AEF",
|
|
44
|
+
"shell.powershell": "PowerShell",
|
|
45
|
+
"shell.gitbash": "Git Bash",
|
|
46
|
+
"shell.msys2": "MSYS2",
|
|
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"
|
|
49
|
+
};
|
|
50
|
+
var en = {
|
|
51
|
+
"shell.title": "Default terminal",
|
|
52
|
+
"shell.description": "Terminal used by the shell tool",
|
|
53
|
+
"shell.powershell": "PowerShell",
|
|
54
|
+
"shell.gitbash": "Git Bash",
|
|
55
|
+
"shell.msys2": "MSYS2",
|
|
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)"
|
|
58
|
+
};
|
|
59
|
+
var inject = ["slots", "locale", "configForms"];
|
|
60
|
+
function ShellPreferenceRow({ t, useStore, setShell }) {
|
|
61
|
+
const shell = useStore((s) => s.shell);
|
|
62
|
+
const writable = useStore((s) => s.writable);
|
|
63
|
+
const status = useStore((s) => s.status);
|
|
64
|
+
const [open, setOpen] = (0, import_react.useState)(false);
|
|
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
|
+
}
|
|
72
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "btRow", children: [
|
|
73
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "btRowText", children: [
|
|
74
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "btTitle", children: t("shell.title") }),
|
|
75
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "btDesc", children: t("shell.description") })
|
|
76
|
+
] }),
|
|
77
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
78
|
+
import_dsh_client_ui_primitives.Menu,
|
|
79
|
+
{
|
|
80
|
+
open,
|
|
81
|
+
onClose: () => setOpen(false),
|
|
82
|
+
items,
|
|
83
|
+
selectedId: shell,
|
|
84
|
+
onSelect: (id) => {
|
|
85
|
+
setOpen(false);
|
|
86
|
+
setShell(id);
|
|
87
|
+
},
|
|
88
|
+
align: "end",
|
|
89
|
+
portal: true,
|
|
90
|
+
anchor: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
91
|
+
"button",
|
|
92
|
+
{
|
|
93
|
+
type: "button",
|
|
94
|
+
className: "btSelector",
|
|
95
|
+
"aria-haspopup": "menu",
|
|
96
|
+
"aria-expanded": open,
|
|
97
|
+
disabled: !writable,
|
|
98
|
+
onClick: () => setOpen(!open),
|
|
99
|
+
style: !writable ? { opacity: 0.5, cursor: "not-allowed" } : void 0,
|
|
100
|
+
children: [
|
|
101
|
+
t("shell." + shell),
|
|
102
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dsh_client_ui_primitives.IconChevronDownOutlineMedium, { className: "btChevron" })
|
|
103
|
+
]
|
|
104
|
+
}
|
|
105
|
+
)
|
|
106
|
+
}
|
|
107
|
+
)
|
|
108
|
+
] });
|
|
109
|
+
}
|
|
110
|
+
var zhDictTitle = () => zh["shell.title"] ?? "\u7EC8\u7AEF";
|
|
111
|
+
function apply(ctx) {
|
|
112
|
+
ctx.effect(() => ctx.locale.register(SETTINGS_NS, { zh, en }), "bash-terminal: settings dictionaries");
|
|
113
|
+
const scope = ctx.configForms.get(ENTRY_ID);
|
|
114
|
+
const store = (0, import_dsh_client_store.defineStore)({
|
|
115
|
+
init: () => ({ shell: "powershell", revision: -1, writable: false, status: "loading" }),
|
|
116
|
+
actions: {
|
|
117
|
+
sync: (d, shell, revision, writable, status) => {
|
|
118
|
+
if (revision !== void 0 && revision <= d.revision) return;
|
|
119
|
+
if (shell !== void 0) d.shell = shell;
|
|
120
|
+
if (revision !== void 0) d.revision = revision;
|
|
121
|
+
if (writable !== void 0) d.writable = writable;
|
|
122
|
+
if (status !== void 0) d.status = status;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
});
|
|
126
|
+
let bound;
|
|
127
|
+
const push = (snap) => {
|
|
128
|
+
bound?.sync(snap.value?.defaultShell, snap.revision, snap.writable, snap.status);
|
|
129
|
+
};
|
|
130
|
+
ctx.slots.inject(
|
|
131
|
+
"dsh-family.tab",
|
|
132
|
+
() => ctx.slots.register(
|
|
133
|
+
{
|
|
134
|
+
name: "dsh-family.tab",
|
|
135
|
+
id: "bash-terminal-shell",
|
|
136
|
+
order: 60,
|
|
137
|
+
label: () => zhDictTitle(),
|
|
138
|
+
store,
|
|
139
|
+
locale: SETTINGS_NS,
|
|
140
|
+
inject: (actions) => {
|
|
141
|
+
bound = actions;
|
|
142
|
+
push(scope.getSnapshot());
|
|
143
|
+
return { setShell: (value) => void scope.set("defaultShell", value) };
|
|
144
|
+
}
|
|
145
|
+
},
|
|
146
|
+
ShellPreferenceRow
|
|
147
|
+
),
|
|
148
|
+
"bash-terminal: settings row"
|
|
149
|
+
);
|
|
150
|
+
ctx.effect(() => scope.subscribe(() => push(scope.getSnapshot())), "bash-terminal: settings watch");
|
|
151
|
+
}
|