dsh-bash-terminal-ts 0.6.4 → 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 +8 -6
- package/README.md +10 -7
- package/dist/client.core.js +151 -151
- package/dist/client.js +160 -160
- package/dsh.plugin.json +2 -2
- 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 +36 -30
- package/src/client.tsx +201 -207
- package/src/terminal.ts +1 -2
- package/template/README.md +82 -82
- package/template/terminal-adapter.ts +343 -343
package/README.en.md
CHANGED
|
@@ -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
|
|
package/README.md
CHANGED
|
@@ -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
|
|------|----------|-------------|----------|
|
|
@@ -77,7 +79,8 @@ New-Item -ItemType Junction -Path "D:\workspace\projects\dsh-bash-terminal-ts\no
|
|
|
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
|
>
|
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-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
|
-
}
|
|
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
|
+
}
|