dsh-bash-terminal-ts 0.4.0 → 0.6.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.
@@ -23,13 +23,24 @@ __export(client_exports, {
23
23
  inject: () => inject
24
24
  });
25
25
  module.exports = __toCommonJS(client_exports);
26
+ var import_react = require("react");
26
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");
27
29
  var import_jsx_runtime = require("react/jsx-runtime");
28
30
  var SETTINGS_NS = "settings.bash-terminal";
29
- var SETTINGS_NAMESPACE = "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
+ }
30
41
  var zh = {
31
42
  "shell.title": "\u9ED8\u8BA4\u7EC8\u7AEF",
32
- "shell.description": "shell \u5DE5\u5177\u6267\u884C\u547D\u4EE4\u65F6\u4F7F\u7528\u7684\u7EC8\u7AEF\uFF08\u7531\u4F60\u51B3\u5B9A\uFF0CAI \u65E0\u6CD5\u66F4\u6539\uFF09",
43
+ "shell.description": "shell \u5DE5\u5177\u6267\u884C\u547D\u4EE4\u65F6\u4F7F\u7528\u7684\u7EC8\u7AEF",
33
44
  "shell.powershell": "PowerShell",
34
45
  "shell.gitbash": "Git Bash",
35
46
  "shell.msys2": "MSYS2",
@@ -37,63 +48,59 @@ var zh = {
37
48
  };
38
49
  var en = {
39
50
  "shell.title": "Default terminal",
40
- "shell.description": "Terminal used by the shell tool (you control this; the AI cannot change it)",
51
+ "shell.description": "Terminal used by the shell tool",
41
52
  "shell.powershell": "PowerShell",
42
53
  "shell.gitbash": "Git Bash",
43
54
  "shell.msys2": "MSYS2",
44
55
  "shell.wsl": "WSL"
45
56
  };
46
- var inject = ["slots", "locale", "settingsScope"];
57
+ var inject = ["slots", "locale", "configForms"];
47
58
  function ShellPreferenceRow({ t, useStore, setShell }) {
48
59
  const shell = useStore((s) => s.shell);
49
60
  const writable = useStore((s) => s.writable);
50
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
51
- "div",
52
- {
53
- style: {
54
- display: "flex",
55
- alignItems: "center",
56
- justifyContent: "space-between",
57
- gap: 16,
58
- padding: "12px 0"
59
- },
60
- children: [
61
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { style: { minWidth: 0 }, children: [
62
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { style: { fontSize: 14, fontWeight: 500, lineHeight: "22px", color: "var(--dsw-alias-label-primary, inherit)" }, children: t("shell.title") }),
63
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { style: { fontSize: 12, lineHeight: "18px", opacity: 0.65 }, children: t("shell.description") })
64
- ] }),
65
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
66
- "select",
61
+ const [open, setOpen] = (0, import_react.useState)(false);
62
+ const items = SHELLS.map((id) => ({ id, label: t("shell." + id) }));
63
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "btRow", children: [
64
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "btRowText", children: [
65
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "btTitle", children: t("shell.title") }),
66
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "btDesc", children: t("shell.description") })
67
+ ] }),
68
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
69
+ import_dsh_client_ui_primitives.Menu,
70
+ {
71
+ open,
72
+ onClose: () => setOpen(false),
73
+ items,
74
+ selectedId: shell,
75
+ onSelect: (id) => {
76
+ setOpen(false);
77
+ setShell(id);
78
+ },
79
+ align: "end",
80
+ portal: true,
81
+ anchor: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
82
+ "button",
67
83
  {
68
- value: shell,
84
+ type: "button",
85
+ className: "btSelector",
86
+ "aria-haspopup": "menu",
87
+ "aria-expanded": open,
69
88
  disabled: !writable,
70
- onChange: (e) => setShell(e.target.value),
71
- style: {
72
- fontSize: 14,
73
- padding: "6px 10px",
74
- borderRadius: 8,
75
- border: "1px solid var(--dsw-alias-line-strong, #ccc)",
76
- background: "var(--dsw-alias-bg-layer-2, #fff)",
77
- color: "var(--dsw-alias-label-primary, inherit)",
78
- outline: "none",
79
- cursor: writable ? "pointer" : "not-allowed",
80
- maxWidth: 180
81
- },
89
+ onClick: () => setOpen(!open),
90
+ style: !writable ? { opacity: 0.5, cursor: "not-allowed" } : void 0,
82
91
  children: [
83
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("option", { value: "powershell", children: t("shell.powershell") }),
84
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("option", { value: "gitbash", children: t("shell.gitbash") }),
85
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("option", { value: "msys2", children: t("shell.msys2") }),
86
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("option", { value: "wsl", children: t("shell.wsl") })
92
+ t("shell." + shell),
93
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dsh_client_ui_primitives.IconChevronDownOutline14, { className: "btChevron" })
87
94
  ]
88
95
  }
89
96
  )
90
- ]
91
- }
92
- );
97
+ }
98
+ )
99
+ ] });
93
100
  }
94
101
  function apply(ctx) {
95
102
  ctx.effect(() => ctx.locale.register(SETTINGS_NS, { zh, en }), "bash-terminal: settings dictionaries");
96
- const scope = ctx.settingsScope.bind({ namespace: SETTINGS_NAMESPACE });
103
+ const scope = ctx.configForms.get(ENTRY_ID);
97
104
  const store = (0, import_dsh_client_store.defineStore)({
98
105
  init: () => ({ shell: "powershell", revision: -1, writable: false }),
99
106
  actions: {
package/dist/client.js CHANGED
@@ -1,5 +1,5 @@
1
1
  window.__ModuleLoader__.load({
2
- id: "dsh-bash-terminal-ts",
2
+ id: "dsh-bash-terminal",
3
3
  factory: (require) => {
4
4
  var module = { exports: {} };
5
5
  var exports = module.exports;
@@ -28,13 +28,24 @@ __export(client_exports, {
28
28
  inject: () => inject
29
29
  });
30
30
  module.exports = __toCommonJS(client_exports);
31
+ var import_react = require("react");
31
32
  var import_dsh_client_store = require("@deepseek-ai/dsh-client-store");
33
+ var import_dsh_client_ui_primitives = require("@deepseek-ai/dsh-client-ui-primitives");
32
34
  var import_jsx_runtime = require("react/jsx-runtime");
33
35
  var SETTINGS_NS = "settings.bash-terminal";
34
- var SETTINGS_NAMESPACE = "bash-terminal";
36
+ var ENTRY_ID = "tool-bash-terminal";
37
+ var SHELLS = ["powershell", "gitbash", "msys2", "wsl"];
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
+ if (typeof document !== "undefined" && document.querySelector('style[data-plugin-css="bash-terminal-row"]') === null) {
40
+ const tag = document.createElement("style");
41
+ tag.dataset.plugin = "dsh-bash-terminal";
42
+ tag.dataset.pluginCss = "bash-terminal-row";
43
+ tag.textContent = ROW_CSS;
44
+ document.head.appendChild(tag);
45
+ }
35
46
  var zh = {
36
47
  "shell.title": "\u9ED8\u8BA4\u7EC8\u7AEF",
37
- "shell.description": "shell \u5DE5\u5177\u6267\u884C\u547D\u4EE4\u65F6\u4F7F\u7528\u7684\u7EC8\u7AEF\uFF08\u7531\u4F60\u51B3\u5B9A\uFF0CAI \u65E0\u6CD5\u66F4\u6539\uFF09",
48
+ "shell.description": "shell \u5DE5\u5177\u6267\u884C\u547D\u4EE4\u65F6\u4F7F\u7528\u7684\u7EC8\u7AEF",
38
49
  "shell.powershell": "PowerShell",
39
50
  "shell.gitbash": "Git Bash",
40
51
  "shell.msys2": "MSYS2",
@@ -42,63 +53,59 @@ var zh = {
42
53
  };
43
54
  var en = {
44
55
  "shell.title": "Default terminal",
45
- "shell.description": "Terminal used by the shell tool (you control this; the AI cannot change it)",
56
+ "shell.description": "Terminal used by the shell tool",
46
57
  "shell.powershell": "PowerShell",
47
58
  "shell.gitbash": "Git Bash",
48
59
  "shell.msys2": "MSYS2",
49
60
  "shell.wsl": "WSL"
50
61
  };
51
- var inject = ["slots", "locale", "settingsScope"];
62
+ var inject = ["slots", "locale", "configForms"];
52
63
  function ShellPreferenceRow({ t, useStore, setShell }) {
53
64
  const shell = useStore((s) => s.shell);
54
65
  const writable = useStore((s) => s.writable);
55
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
56
- "div",
57
- {
58
- style: {
59
- display: "flex",
60
- alignItems: "center",
61
- justifyContent: "space-between",
62
- gap: 16,
63
- padding: "12px 0"
64
- },
65
- children: [
66
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { style: { minWidth: 0 }, children: [
67
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { style: { fontSize: 14, fontWeight: 500, lineHeight: "22px", color: "var(--dsw-alias-label-primary, inherit)" }, children: t("shell.title") }),
68
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { style: { fontSize: 12, lineHeight: "18px", opacity: 0.65 }, children: t("shell.description") })
69
- ] }),
70
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
71
- "select",
66
+ const [open, setOpen] = (0, import_react.useState)(false);
67
+ const items = SHELLS.map((id) => ({ id, label: t("shell." + id) }));
68
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "btRow", children: [
69
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "btRowText", children: [
70
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "btTitle", children: t("shell.title") }),
71
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "btDesc", children: t("shell.description") })
72
+ ] }),
73
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
74
+ import_dsh_client_ui_primitives.Menu,
75
+ {
76
+ open,
77
+ onClose: () => setOpen(false),
78
+ items,
79
+ selectedId: shell,
80
+ onSelect: (id) => {
81
+ setOpen(false);
82
+ setShell(id);
83
+ },
84
+ align: "end",
85
+ portal: true,
86
+ anchor: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
87
+ "button",
72
88
  {
73
- value: shell,
89
+ type: "button",
90
+ className: "btSelector",
91
+ "aria-haspopup": "menu",
92
+ "aria-expanded": open,
74
93
  disabled: !writable,
75
- onChange: (e) => setShell(e.target.value),
76
- style: {
77
- fontSize: 14,
78
- padding: "6px 10px",
79
- borderRadius: 8,
80
- border: "1px solid var(--dsw-alias-line-strong, #ccc)",
81
- background: "var(--dsw-alias-bg-layer-2, #fff)",
82
- color: "var(--dsw-alias-label-primary, inherit)",
83
- outline: "none",
84
- cursor: writable ? "pointer" : "not-allowed",
85
- maxWidth: 180
86
- },
94
+ onClick: () => setOpen(!open),
95
+ style: !writable ? { opacity: 0.5, cursor: "not-allowed" } : void 0,
87
96
  children: [
88
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("option", { value: "powershell", children: t("shell.powershell") }),
89
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("option", { value: "gitbash", children: t("shell.gitbash") }),
90
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("option", { value: "msys2", children: t("shell.msys2") }),
91
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("option", { value: "wsl", children: t("shell.wsl") })
97
+ t("shell." + shell),
98
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dsh_client_ui_primitives.IconChevronDownOutline14, { className: "btChevron" })
92
99
  ]
93
100
  }
94
101
  )
95
- ]
96
- }
97
- );
102
+ }
103
+ )
104
+ ] });
98
105
  }
99
106
  function apply(ctx) {
100
107
  ctx.effect(() => ctx.locale.register(SETTINGS_NS, { zh, en }), "bash-terminal: settings dictionaries");
101
- const scope = ctx.settingsScope.bind({ namespace: SETTINGS_NAMESPACE });
108
+ const scope = ctx.configForms.get(ENTRY_ID);
102
109
  const store = (0, import_dsh_client_store.defineStore)({
103
110
  init: () => ({ shell: "powershell", revision: -1, writable: false }),
104
111
  actions: {
package/dsh.plugin.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
- "id": "dsh-bash-terminal-ts",
3
- "name": "dsh-bash-terminal-ts",
4
- "version": "0.2.5",
2
+ "id": "dsh-bash-terminal",
3
+ "name": "dsh-bash-terminal",
4
+ "version": "0.3.18",
5
5
  "description": {
6
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
7
  "zh": "一个 shell 工具,可在 Windows 上通过 PowerShell / Git Bash / MSYS2 / WSL 执行命令,默认终端在 Web UI 设置中选择。"
@@ -13,7 +13,7 @@
13
13
  },
14
14
  "license": "MIT",
15
15
  "engines": {
16
- "dsh": ">=0.1.2-rc.1 <0.2.0-0"
16
+ "dsh": ">=0.1.5-alpha.1 <0.2.0-0"
17
17
  },
18
18
  "components": {
19
19
  "host": "lib/index.js",
package/lib/client.js ADDED
@@ -0,0 +1,148 @@
1
+ window.__ModuleLoader__.load({
2
+ id: "dsh-bash-terminal",
3
+ factory: (require) => {
4
+ var module = { exports: {} };
5
+ var exports = module.exports;
6
+ var __defProp = Object.defineProperty;
7
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
8
+ var __getOwnPropNames = Object.getOwnPropertyNames;
9
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
10
+ var __export = (target, all) => {
11
+ for (var name in all)
12
+ __defProp(target, name, { get: all[name], enumerable: true });
13
+ };
14
+ var __copyProps = (to, from, except, desc) => {
15
+ if (from && typeof from === "object" || typeof from === "function") {
16
+ for (let key of __getOwnPropNames(from))
17
+ if (!__hasOwnProp.call(to, key) && key !== except)
18
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
19
+ }
20
+ return to;
21
+ };
22
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
23
+
24
+ // src/client.tsx
25
+ var client_exports = {};
26
+ __export(client_exports, {
27
+ apply: () => apply,
28
+ inject: () => inject
29
+ });
30
+ module.exports = __toCommonJS(client_exports);
31
+ var import_react = require("react");
32
+ var import_dsh_client_store = require("@deepseek-ai/dsh-client-store");
33
+ var import_dsh_client_ui_primitives = require("@deepseek-ai/dsh-client-ui-primitives");
34
+ var import_jsx_runtime = require("react/jsx-runtime");
35
+ var SETTINGS_NS = "settings.bash-terminal";
36
+ var ENTRY_ID = "tool-bash-terminal";
37
+ var SHELLS = ["powershell", "gitbash", "msys2", "wsl"];
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
+ if (typeof document !== "undefined" && document.querySelector('style[data-plugin-css="bash-terminal-row"]') === null) {
40
+ const tag = document.createElement("style");
41
+ tag.dataset.plugin = "dsh-bash-terminal";
42
+ tag.dataset.pluginCss = "bash-terminal-row";
43
+ tag.textContent = ROW_CSS;
44
+ document.head.appendChild(tag);
45
+ }
46
+ var zh = {
47
+ "shell.title": "\u9ED8\u8BA4\u7EC8\u7AEF",
48
+ "shell.description": "shell \u5DE5\u5177\u6267\u884C\u547D\u4EE4\u65F6\u4F7F\u7528\u7684\u7EC8\u7AEF",
49
+ "shell.powershell": "PowerShell",
50
+ "shell.gitbash": "Git Bash",
51
+ "shell.msys2": "MSYS2",
52
+ "shell.wsl": "WSL"
53
+ };
54
+ var en = {
55
+ "shell.title": "Default terminal",
56
+ "shell.description": "Terminal used by the shell tool",
57
+ "shell.powershell": "PowerShell",
58
+ "shell.gitbash": "Git Bash",
59
+ "shell.msys2": "MSYS2",
60
+ "shell.wsl": "WSL"
61
+ };
62
+ var inject = ["slots", "locale", "configForms"];
63
+ function ShellPreferenceRow({ t, useStore, setShell }) {
64
+ const shell = useStore((s) => s.shell);
65
+ const writable = useStore((s) => s.writable);
66
+ const [open, setOpen] = (0, import_react.useState)(false);
67
+ const items = SHELLS.map((id) => ({ id, label: t("shell." + id) }));
68
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "btRow", children: [
69
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "btRowText", children: [
70
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "btTitle", children: t("shell.title") }),
71
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "btDesc", children: t("shell.description") })
72
+ ] }),
73
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
74
+ import_dsh_client_ui_primitives.Menu,
75
+ {
76
+ open,
77
+ onClose: () => setOpen(false),
78
+ items,
79
+ selectedId: shell,
80
+ onSelect: (id) => {
81
+ setOpen(false);
82
+ setShell(id);
83
+ },
84
+ align: "end",
85
+ portal: true,
86
+ anchor: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
87
+ "button",
88
+ {
89
+ type: "button",
90
+ className: "btSelector",
91
+ "aria-haspopup": "menu",
92
+ "aria-expanded": open,
93
+ disabled: !writable,
94
+ onClick: () => setOpen(!open),
95
+ style: !writable ? { opacity: 0.5, cursor: "not-allowed" } : void 0,
96
+ children: [
97
+ t("shell." + shell),
98
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dsh_client_ui_primitives.IconChevronDownOutline14, { className: "btChevron" })
99
+ ]
100
+ }
101
+ )
102
+ }
103
+ )
104
+ ] });
105
+ }
106
+ function apply(ctx) {
107
+ ctx.effect(() => ctx.locale.register(SETTINGS_NS, { zh, en }), "bash-terminal: settings dictionaries");
108
+ const scope = ctx.configForms.get(ENTRY_ID);
109
+ const store = (0, import_dsh_client_store.defineStore)({
110
+ init: () => ({ shell: "powershell", revision: -1, writable: false }),
111
+ actions: {
112
+ sync: (d, shell, revision, writable) => {
113
+ if (revision !== void 0 && revision <= d.revision) return;
114
+ if (shell !== void 0) d.shell = shell;
115
+ if (revision !== void 0) d.revision = revision;
116
+ if (writable !== void 0) d.writable = writable;
117
+ }
118
+ }
119
+ });
120
+ let bound;
121
+ const push = (snap) => {
122
+ bound?.sync(snap.value?.defaultShell, snap.revision, snap.writable);
123
+ };
124
+ ctx.slots.inject(
125
+ "settings.general.item",
126
+ () => ctx.slots.register(
127
+ {
128
+ name: "settings.general.item",
129
+ id: "bash-terminal-shell",
130
+ order: 20,
131
+ store,
132
+ locale: SETTINGS_NS,
133
+ inject: (actions) => {
134
+ bound = actions;
135
+ push(scope.getSnapshot());
136
+ return { setShell: (value) => void scope.set("defaultShell", value) };
137
+ }
138
+ },
139
+ ShellPreferenceRow
140
+ ),
141
+ "bash-terminal: settings row"
142
+ );
143
+ ctx.effect(() => scope.subscribe(() => push(scope.getSnapshot())), "bash-terminal: settings watch");
144
+ }
145
+
146
+ return module.exports;
147
+ }
148
+ });
@@ -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-ts programs against: the union
244
+ * The structural context face dsh-bash-terminal 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 {
@@ -250,7 +250,6 @@ export interface BashTerminalContext {
250
250
  tools: ToolsSeam;
251
251
  on(event: "system-prompt/assemble", handler: AssembleHandler): void;
252
252
  shellEnv: ShellEnvSeam;
253
- settings: SettingsSeam;
254
253
  sandboxPolicy: SandboxPolicySeam;
255
254
  sandbox: SandboxSeam;
256
255
  get(key: string): unknown;
package/lib/dsh.d.ts CHANGED
@@ -20,6 +20,8 @@ export declare const escalationHintMarker: (subject: string) => string;
20
20
  /** Runtime config schema factory (schemastery fork). */
21
21
  export interface SchemasterySchema {
22
22
  default(value: unknown): SchemasterySchema;
23
+ /** 0.1.7+: expose the field on the auto-generated settings form. */
24
+ volatile(): SchemasterySchema;
23
25
  }
24
26
  export interface Schemastery {
25
27
  object(fields: Record<string, SchemasterySchema>): SchemasterySchema;
package/lib/index.d.ts CHANGED
@@ -7,8 +7,6 @@ export declare const inject: string[];
7
7
  export declare const SHELLS: readonly ["powershell", "gitbash", "msys2", "wsl"];
8
8
  /** The backend used when the caller does not name one. */
9
9
  export declare const DEFAULT_SHELL: ShellId;
10
- /** Settings namespace backing the user-chosen default terminal. */
11
- export declare const SETTINGS_NAMESPACE = "bash-terminal";
12
10
  /** Static shape of the runtime configuration schema. */
13
11
  export interface ConfigValues {
14
12
  defaultShell: string;
@@ -31,17 +29,18 @@ export declare function candidatePwshPaths(env?: NodeJS.ProcessEnv): string[];
31
29
  */
32
30
  export declare function candidateGitBashPaths(env?: NodeJS.ProcessEnv): string[];
33
31
  /**
34
- * MSYS2 locations, in preference order: the real `bash.exe` under usr\bin first,
35
- * then bin\bash.exe, and `msys2.exe` dead last.
32
+ * MSYS2 locations, in preference order: the real `bash.exe` under usr\bin
33
+ * first, then bin\bash.exe, and `msys2.exe` dead last.
36
34
  *
37
35
  * msys2.exe is NOT a usable backend for piped execution: it is the console-
38
36
  * allocating Cygwin launcher, so a spawn with piped stdio returns exit 0 with
39
- * zero bytes on both stdout and stderr (measured on MSYS2 with bash 5.3.15).
40
- * Keeping it in the list only as a last-resort fallback preserves the path the
41
- * config docs reference, but a working bash.exe always wins.
37
+ * zero bytes on both stdout and stderr (measured on this machine against
38
+ * MSYS2 with bash 5.3.15). Keeping it in the list only as a last-resort
39
+ * fallback preserves the path the config docs reference, but a working
40
+ * bash.exe always wins.
42
41
  *
43
- * MSYS2 uses the same Cygwin/MSYS2 runtime as Git Bash, so it cannot run under
44
- * the DSH Windows ACL restricted-token sandbox.
42
+ * MSYS2 uses the same Cygwin/MSYS2 runtime as Git Bash, so it cannot run
43
+ * under the DSH Windows ACL restricted-token sandbox.
45
44
  */
46
45
  export declare function candidateMsys2Paths(env?: NodeJS.ProcessEnv): string[];
47
46
  export declare function defaultWslPath(env?: NodeJS.ProcessEnv): string;
@@ -52,16 +51,16 @@ export declare function resolveAllPaths(config?: PathConfig, env?: NodeJS.Proces
52
51
  export declare function buildArgv(shell: string, command: string, paths: ResolvedPaths, distro?: string): Array<string | undefined>;
53
52
  /**
54
53
  * Merge the DSH_* environment over the process environment. For WSL, only
55
- * variables explicitly listed in WSLENV cross the boundary, so every DSH_* key is
56
- * appended to it (WSLENV is a `:` separated VAR[/flag] list).
54
+ * variables explicitly listed in WSLENV cross the boundary, so every DSH_*
55
+ * key is appended there — and the list is *layered onto* whatever WSLENV the
56
+ * host already had (Windows Terminal exports e.g. `WT_SESSION:WT_PROFILE_ID:`),
57
+ * never rebuilt from scratch: WSLENV is an allow-list, so dropping the
58
+ * inherited entries would silently stop them crossing into WSL.
57
59
  *
58
- * WSLENV usually already exists for reasons unrelated to us -- Windows Terminal
59
- * exports e.g. `WT_SESSION:WT_PROFILE_ID:` -- so the list is layered rather than
60
- * rebuilt, or those entries would be silently dropped from every WSL call.
61
- * Callers that spawn through a seam which replaces the parent environment
62
- * wholesale (the PTY path) must pass the inherited value explicitly.
63
- *
64
- * @param inheritedWslenv - the WSLENV the child would otherwise inherit.
60
+ * @param inheritedWslenv - the ambient WSLENV to layer onto. Callers that
61
+ * replace the child environment wholesale (the PTY path) must pass
62
+ * `process.env.WSLENV` explicitly, because the ambient value is not visible
63
+ * through `dshEnv`.
65
64
  */
66
65
  export declare function buildEnv(shell: string, dshEnv?: Record<string, string>, inheritedWslenv?: string | undefined): Record<string, string | undefined>;
67
66
  export interface SpawnResolution {