@norman-else/dsh-claude 0.1.8 → 0.1.10

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/lib/bin.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { i as parseClaudeVersion, n as ensureManagedPreset, r as removeManagedPreset } from "./preset-installer-DUmmDvBm.mjs";
2
+ import { i as parseClaudeVersion, n as ensureManagedPreset, r as removeManagedPreset } from "./preset-installer-B0NrA4Hi.mjs";
3
3
  import { access } from "node:fs/promises";
4
4
  import { delimiter, isAbsolute, join } from "node:path";
5
5
  import { homedir } from "node:os";
package/lib/client.d.ts CHANGED
@@ -35,6 +35,12 @@ window.__ModuleLoader__.load({
35
35
  readonly error: "Doctor failed";
36
36
  readonly security: "Permission boundary";
37
37
  readonly securityBody: "Claude tool permissions are decided through the DSH approval UI. This version does not claim kernel-level write isolation for ~/.claude or paths outside the workspace.";
38
+ readonly globalSettings: "Claude Code global settings";
39
+ readonly globalSettingsBody: "Modify supported ~/.claude/settings.json values while preserving every other field.";
40
+ readonly globalSettingsLoading: "Loading global settings…";
41
+ readonly globalSettingsNewSession: "Output Style changes apply only to new Claude sessions.";
42
+ readonly globalSettingsError: "Global settings save failed";
43
+ readonly outputStyle: "Output Style";
38
44
  readonly pluginUpdate: "Plugin updates";
39
45
  readonly pluginUpdateBody: "Check npm for new releases. Only a uniquely identified npm installation can update in place; local development links are never replaced.";
40
46
  readonly updateNotChecked: "Updates have not been checked yet.";
package/lib/client.js CHANGED
@@ -13,6 +13,7 @@ window.__ModuleLoader__.load({
13
13
  const CLAUDE_UPDATE_CHECK_PATH = "/plugins/dsh-claude/update/check";
14
14
  const CLAUDE_UPDATE_PATH = "/plugins/dsh-claude/update";
15
15
  const CLAUDE_PROJECTION_PATH = "/plugins/dsh-claude/projection";
16
+ const CLAUDE_GLOBAL_SETTINGS_PATH = "/plugins/dsh-claude/settings/global";
16
17
  //#endregion
17
18
  //#region src/client/conversation-sidecar.ts
18
19
  function isTaskActivity(value) {
@@ -1016,6 +1017,19 @@ window.__ModuleLoader__.load({
1016
1017
  "error"
1017
1018
  ].includes(String(status.state)) && typeof status.canUpdate === "boolean" && typeof status.restartRequired === "boolean" && (status.message === void 0 || typeof status.message === "string");
1018
1019
  }
1020
+ function isGlobalSettingsView(value) {
1021
+ if (typeof value !== "object" || value === null || Array.isArray(value)) return false;
1022
+ const settings = value.settings;
1023
+ return Array.isArray(settings) && settings.every((setting) => {
1024
+ if (typeof setting !== "object" || setting === null || Array.isArray(setting)) return false;
1025
+ const item = setting;
1026
+ return typeof item.key === "string" && item.kind === "select" && typeof item.value === "string" && ["new-session", "restart"].includes(String(item.effect)) && Array.isArray(item.options) && item.options.every((option) => typeof option === "object" && option !== null && typeof option.value === "string" && typeof option.label === "string" && [
1027
+ "built-in",
1028
+ "user",
1029
+ "configured"
1030
+ ].includes(String(option.source)));
1031
+ });
1032
+ }
1019
1033
  function value(status, detail) {
1020
1034
  return detail === void 0 ? status : `${status} · ${detail}`;
1021
1035
  }
@@ -1026,6 +1040,9 @@ window.__ModuleLoader__.load({
1026
1040
  const [updateStatus, setUpdateStatus] = useState();
1027
1041
  const [updateError, setUpdateError] = useState();
1028
1042
  const [updateBusy, setUpdateBusy] = useState();
1043
+ const [globalSettings, setGlobalSettings] = useState();
1044
+ const [globalSettingsError, setGlobalSettingsError] = useState();
1045
+ const [globalSettingsBusy, setGlobalSettingsBusy] = useState(false);
1029
1046
  const refresh = useCallback(async () => {
1030
1047
  setBusy(true);
1031
1048
  setError(void 0);
@@ -1047,6 +1064,35 @@ window.__ModuleLoader__.load({
1047
1064
  useEffect(() => {
1048
1065
  refresh();
1049
1066
  }, [refresh]);
1067
+ const requestGlobalSettings = useCallback(async (changes) => {
1068
+ setGlobalSettingsBusy(true);
1069
+ setGlobalSettingsError(void 0);
1070
+ try {
1071
+ const response = await fetch(CLAUDE_GLOBAL_SETTINGS_PATH, {
1072
+ method: changes === void 0 ? "GET" : "PATCH",
1073
+ credentials: "same-origin",
1074
+ headers: {
1075
+ accept: "application/json",
1076
+ ...changes === void 0 ? {} : { "content-type": "application/json" }
1077
+ },
1078
+ ...changes === void 0 ? {} : { body: JSON.stringify({ changes }) }
1079
+ });
1080
+ const payload = await response.json();
1081
+ if (!response.ok) {
1082
+ const message = typeof payload === "object" && payload !== null && "error" in payload && typeof payload.error === "string" ? payload.error : `HTTP ${response.status}`;
1083
+ throw new Error(message);
1084
+ }
1085
+ if (!isGlobalSettingsView(payload)) throw new Error("Invalid global settings response");
1086
+ setGlobalSettings(payload);
1087
+ } catch (cause) {
1088
+ setGlobalSettingsError(cause instanceof Error ? cause.message : String(cause));
1089
+ } finally {
1090
+ setGlobalSettingsBusy(false);
1091
+ }
1092
+ }, []);
1093
+ useEffect(() => {
1094
+ requestGlobalSettings();
1095
+ }, [requestGlobalSettings]);
1050
1096
  const requestUpdate = useCallback(async (action) => {
1051
1097
  setUpdateBusy(action);
1052
1098
  setUpdateError(void 0);
@@ -1148,6 +1194,55 @@ window.__ModuleLoader__.load({
1148
1194
  })
1149
1195
  ]
1150
1196
  }),
1197
+ /* @__PURE__ */ jsxs("section", {
1198
+ style: settingsCard,
1199
+ children: [
1200
+ /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("h3", {
1201
+ style: settingsSectionHeading,
1202
+ children: t("globalSettings")
1203
+ }), /* @__PURE__ */ jsx("p", {
1204
+ style: settingsBody,
1205
+ children: t("globalSettingsBody")
1206
+ })] }),
1207
+ globalSettings === void 0 ? /* @__PURE__ */ jsx("p", {
1208
+ style: notice,
1209
+ children: t("globalSettingsLoading")
1210
+ }) : globalSettings.settings.map((setting) => /* @__PURE__ */ jsxs("label", {
1211
+ style: diagnosticGrid,
1212
+ children: [/* @__PURE__ */ jsx("span", {
1213
+ style: diagnosticLabel,
1214
+ children: setting.key === "outputStyle" ? t("outputStyle") : setting.key
1215
+ }), /* @__PURE__ */ jsx("select", {
1216
+ value: setting.value,
1217
+ disabled: globalSettingsBusy,
1218
+ onChange: (event) => {
1219
+ requestGlobalSettings({ [setting.key]: event.target.value });
1220
+ },
1221
+ style: diagnosticValue,
1222
+ children: setting.options.map((option) => /* @__PURE__ */ jsx("option", {
1223
+ value: option.value,
1224
+ children: option.label
1225
+ }, `${option.source}:${option.value}`))
1226
+ })]
1227
+ }, setting.key)),
1228
+ globalSettings?.settings.some((setting) => setting.effect === "new-session") === true ? /* @__PURE__ */ jsx("p", {
1229
+ style: notice,
1230
+ children: t("globalSettingsNewSession")
1231
+ }) : null,
1232
+ globalSettingsError === void 0 ? null : /* @__PURE__ */ jsxs("p", {
1233
+ role: "alert",
1234
+ style: {
1235
+ ...notice,
1236
+ color: "var(--dsw-alias-state-error-primary)"
1237
+ },
1238
+ children: [
1239
+ t("globalSettingsError"),
1240
+ ": ",
1241
+ globalSettingsError
1242
+ ]
1243
+ })
1244
+ ]
1245
+ }),
1151
1246
  /* @__PURE__ */ jsxs("section", {
1152
1247
  style: settingsCard,
1153
1248
  children: [
@@ -1392,6 +1487,12 @@ window.__ModuleLoader__.load({
1392
1487
  error: "诊断失败",
1393
1488
  security: "权限边界",
1394
1489
  securityBody: "Claude 工具权限通过 DSH 审批界面决定;当前版本不宣称对 ~/.claude 与工作区之外路径提供内核级写入隔离。",
1490
+ globalSettings: "Claude Code 全局设置",
1491
+ globalSettingsBody: "修改受支持的 ~/.claude/settings.json 设置;其他字段会被保留。",
1492
+ globalSettingsLoading: "正在加载全局设置…",
1493
+ globalSettingsNewSession: "Output Style 修改仅对新建 Claude 会话生效。",
1494
+ globalSettingsError: "全局设置保存失败",
1495
+ outputStyle: "Output Style",
1395
1496
  pluginUpdate: "插件更新",
1396
1497
  pluginUpdateBody: "检查 npm 上的新版本。只有可唯一识别的 npm 安装才能直接更新;本地开发链接不会被替换。",
1397
1498
  updateNotChecked: "尚未检查更新。",
@@ -1470,6 +1571,12 @@ window.__ModuleLoader__.load({
1470
1571
  error: "Doctor failed",
1471
1572
  security: "Permission boundary",
1472
1573
  securityBody: "Claude tool permissions are decided through the DSH approval UI. This version does not claim kernel-level write isolation for ~/.claude or paths outside the workspace.",
1574
+ globalSettings: "Claude Code global settings",
1575
+ globalSettingsBody: "Modify supported ~/.claude/settings.json values while preserving every other field.",
1576
+ globalSettingsLoading: "Loading global settings…",
1577
+ globalSettingsNewSession: "Output Style changes apply only to new Claude sessions.",
1578
+ globalSettingsError: "Global settings save failed",
1579
+ outputStyle: "Output Style",
1473
1580
  pluginUpdate: "Plugin updates",
1474
1581
  pluginUpdateBody: "Check npm for new releases. Only a uniquely identified npm installation can update in place; local development links are never replaced.",
1475
1582
  updateNotChecked: "Updates have not been checked yet.",