dsh-skill-browser 1.6.1 → 1.6.2

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.
Files changed (3) hide show
  1. package/README.md +13 -0
  2. package/lib/client.js +46 -11
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -27,6 +27,19 @@
27
27
  (**不要**加进 `dependencies`——本插件零 npm 依赖,加进去反而可能在其他插件安装/更新时造成解析问题)
28
28
  3. 重启 DSH,右下角出现 🧩 悬浮球;打开 ⚙ 设置选择你的技能库文件夹即可
29
29
 
30
+
31
+ ## ⚠️ 安装须知 Install Notice
32
+
33
+ **发布 24 小时内安装报错?** 这不是插件问题。
34
+
35
+ DSH 桌面端内置**供应链安全策略**(minimumReleaseAge):刚发布不到 24 小时的 npm 包会被 pnpm 拒绝安装,防止刚发布的投毒包。报错通常含 `ERR_PNPM_MINIMUM_RELEASE_AGE_VIOLATION` 字样。
36
+
37
+ - ✅ **解决:等一天再装**,市场安装自然通过
38
+ - ✅ 插件本体没有任何问题,也无需任何配置
39
+ - ✅ 此策略对所有 DSH 插件一视同仁,是全局安全机制
40
+
41
+ **推荐清单说明**:两个插件的设置页「悬浮球导航」分区会列出推荐插件(字体插件 / 技能浏览器 / 照片显示器),并实时探测显示「已安装 / 未安装」徽标;未安装的插件可点击 Star 前往仓库安装。
42
+
30
43
  ## 台账自动登记原理
31
44
 
32
45
  - 数据源 1(自动,确定性):`ctx.on('tools/result', (exec, result) => ...)`,过滤 `exec.name === 'skill'`;`result.isError` 为真记失败,同时记录 `exec.arguments.name`(技能名)与错误文本
package/lib/client.js CHANGED
@@ -40,6 +40,7 @@ window.__ModuleLoader__.load({
40
40
  var BALL_POS_KEY = "dsh-skill-browser-ball-pos";
41
41
  var BALL_VIS_KEY = "dsh-skill-browser-ball-visible";
42
42
  var FONT_BALL_VIS_KEY = "dsh-font-ball-visible";
43
+ var TODO_BALL_VIS_KEY = "dsh-tfb-ball-visible";
43
44
 
44
45
  // ---- helpers ----
45
46
  function esc(s) {
@@ -260,6 +261,11 @@ window.__ModuleLoader__.load({
260
261
  // 内联样式兜底(font-enhancer 的 display:block !important 若因时机问题未覆盖)
261
262
  var t = document.getElementById("dsh-fe-toggle");
262
263
  if (t) t.style.setProperty("display", readStore(FONT_BALL_VIS_KEY, true) ? "" : "none", "important");
264
+ // Todo 悬浮球(dsh-todo-float-ball)显隐:同字体球模式——共享其
265
+ // localStorage 键(dsh-tfb-ball-visible),属性+内联双兜底,
266
+ // 不动 todo 插件一行代码(CSS 幂等,重建后仍生效)。
267
+ var tfb = document.getElementById("dsh-tfb-root");
268
+ if (tfb) tfb.style.setProperty("display", readStore(TODO_BALL_VIS_KEY, true) ? "" : "none", "important");
263
269
  }
264
270
  function applyBallVisibility() {
265
271
  var el = document.documentElement || document.body;
@@ -739,12 +745,17 @@ window.__ModuleLoader__.load({
739
745
  function isFontEnhancerInstalled() {
740
746
  try { return !!document.getElementById("dsh-fe-toggle"); } catch (e) { return false; }
741
747
  }
748
+ // Todo 球安装探测(兼容):dsh-todo-float-ball 未装时隐藏其开关,避免无效控件
749
+ function isTodoBallInstalled() {
750
+ try { return !!document.getElementById("dsh-tfb-root"); } catch (e) { return false; }
751
+ }
742
752
 
743
753
  // v1.5.3 一键恢复默认位置:清位置记忆与收起/隐藏状态,球立即回右下角默认位。
744
754
  // 供 DSH 设置页「悬浮球导航」分区按钮调用(球可能被拖出屏幕外卡住,无法点回)。
745
755
  // v1.5.7 推荐位安装徽标:探测三个插件的 client 运行状态,注入「已安装/未安装」徽标。
746
756
  function recBadgeInstalled(id) {
747
757
  if (id === "font") return !!document.getElementById("dsh-fe-toggle");
758
+ if (id === "todoball") return isTodoBallInstalled();
748
759
  if (id === "skillbrowser") return !!document.getElementById(BALL_ID);
749
760
  return false; // lightbox 用异步 fetch 判定,不走这里
750
761
  }
@@ -803,7 +814,18 @@ window.__ModuleLoader__.load({
803
814
  feBall.style.right = "18px"; feBall.style.bottom = "18px";
804
815
  }
805
816
  } catch (e) {}
806
- try { console.log("[dsh-skill-browser] reset: skill ball + font ball -> default positions (paired bottom-right)"); } catch (e) {}
817
+ // v0.7.2 三球联动:🎯 复位时顺带把 Todo 球归位(右下角 right:18px bottom:18px)。
818
+ // 同字体球模式:只清位置记忆 + DOM 归位,不动 todo 插件内部实现。
819
+ try { localStorage.removeItem("dsh-todo-float-ball-pos"); } catch (e) {}
820
+ try {
821
+ var tfbHost = document.getElementById("dsh-tfb-root");
822
+ var tfb = tfbHost && tfbHost.shadowRoot ? tfbHost.shadowRoot.querySelector(".tfb-ball") : null;
823
+ if (tfb) {
824
+ tfb.style.left = "auto"; tfb.style.top = "auto";
825
+ tfb.style.right = "18px"; tfb.style.bottom = "18px";
826
+ }
827
+ } catch (e) {}
828
+ try { console.log("[dsh-skill-browser] reset: skill ball + font ball + todo ball -> default positions (paired bottom-right)"); } catch (e) {}
807
829
  }
808
830
 
809
831
  function buildBall() {
@@ -897,31 +919,39 @@ window.__ModuleLoader__.load({
897
919
  if (!React) return null;
898
920
 
899
921
  var rows = [];
900
- function mkToggle(id, label, onChange) {
901
- return React.createElement("label", { key: id, style: { display: "flex", alignItems: "center", gap: "8px", fontSize: "13px", cursor: "pointer" } },
902
- React.createElement("input", { type: "checkbox", id: id, onChange: onChange }),
903
- React.createElement("span", null, label));
922
+ // 未安装的球:开关仍显示但置灰+标注,保证"单独装任何一个,分区界面一致"(生态规格)
923
+ function mkToggle(id, label, onChange, installed) {
924
+ var on = installed !== false;
925
+ return React.createElement("label", { key: id, style: { display: "flex", alignItems: "center", gap: "8px", fontSize: "13px", cursor: on ? "pointer" : "not-allowed", opacity: on ? 1 : .5 } },
926
+ React.createElement("input", { type: "checkbox", id: id, disabled: !on, onChange: onChange }),
927
+ React.createElement("span", null, label + (on ? "" : "(未安装)")));
904
928
  }
905
929
  rows.push(React.createElement("div", { key: "head", style: { fontWeight: "600", marginBottom: "4px" } }, "悬浮球导航"));
906
930
  rows.push(mkToggle("dsb-set-ball", "技能浏览器悬浮球(🧩)", function (e) {
907
931
  writeStore(BALL_VIS_KEY, e.target.checked);
908
932
  applyBallVisibility();
909
933
  if (!e.target.checked && S.open) closePanel();
910
- }));
934
+ }, true));
911
935
  rows.push(mkToggle("dsb-set-font", "字体插件悬浮球(🔤)", function (e) {
912
936
  writeStore(FONT_BALL_VIS_KEY, e.target.checked);
913
937
  applyFontBallVisibility();
914
- }));
938
+ }, isFontEnhancerInstalled()));
939
+ rows.push(mkToggle("dsb-set-todo", "Todo 悬浮球(📋)", function (e) {
940
+ writeStore(TODO_BALL_VIS_KEY, e.target.checked);
941
+ if (typeof applyTodoBallVisibility === "function") applyTodoBallVisibility();
942
+ var el = document.getElementById("dsh-tfb-root");
943
+ if (el) el.style.setProperty("display", e.target.checked ? "" : "none", "important");
944
+ }, isTodoBallInstalled()));
915
945
  rows.push(React.createElement("div", { key: "hint", style: { fontSize: "12px", color: "#8b93a8" } },
916
946
  "悬浮球可拖动;清单面板始终居中;本分区就在 DSH 设置中,随时可改悬浮球显隐"));
917
947
  // ── 安装与更新须知(v1.5.7:24h 供应链政策 + 推荐清单说明)──
918
948
  rows.push(React.createElement("div", { key: "notice-block", style: { marginTop: "12px", padding: "10px 12px", background: "rgba(255,255,255,.03)", border: "1px solid rgba(255,255,255,.06)", borderRadius: "10px", fontSize: "12px", color: "#9aa1b5", lineHeight: "1.7" } },
919
949
  React.createElement("div", { style: { fontWeight: "600", color: "#cfd4dc", marginBottom: "4px" } }, "📌 安装与更新须知"),
920
- React.createElement("div", null, "1. 本分区由「技能浏览器」提供;若同时安装了字体插件,两个悬浮球的显隐都在这里控制。"),
950
+ React.createElement("div", null, "1. 本分区由「技能浏览器」提供;技能球 / 字体球 / Todo 球三个悬浮球的显隐都在这里控制(新装默认全部显示)。"),
921
951
  React.createElement("div", null, "2. 推荐插件列表实时显示「已安装 / 未安装」状态:绿色「已安装」= 可直接使用;红色「未安装」= 点击 ⭐ Star 前往仓库,或到插件市场搜索安装。"),
922
952
  React.createElement("div", { style: { color: "#e0b0b0" } }, "3. 【重要】安装或更新插件时,若报错含 minimumReleaseAge 或 ERR_PNPM_MINIMUM_RELEASE_AGE_VIOLATION:这不是插件坏了,是 DSH 对刚发布 npm 包的 24 小时安全观察期(防止刚发布的投毒包)。"),
923
953
  React.createElement("div", { style: { color: "#e0b0b0" } }, "4. 遇到 24h 报错的处理:等一天再安装/更新即可自动通过,插件本体没有任何问题。插件作者连发多版时窗口期会顺延一天。"),
924
- React.createElement("div", null, "5. 悬浮球可拖动换位置;拖到屏幕外找不到时,点上方 🎯 按钮一键复位(检测到字体插件时双球一起归位)。")
954
+ React.createElement("div", null, "5. 悬浮球可拖动换位置;拖到屏幕外找不到时,点 🎯 按钮所有悬浮球一起回到右下角。Todo 球的皮肤在展开其面板后点 🎨 切换(星云/石墨/蓝宝石)。")
925
955
  ));
926
956
  // ── 一键恢复默认位置(v1.5.3 用户要求):悬浮球被拖出屏幕外卡住时,
927
957
  // 点此按钮立即回到默认右下角 (right:26px bottom:118px) 46px 常规大小,
@@ -931,7 +961,7 @@ window.__ModuleLoader__.load({
931
961
  style: { alignSelf: "flex-start", fontSize: "13px", cursor: "pointer",
932
962
  background: "rgba(255,210,122,.12)", border: "1px solid rgba(255,210,122,.35)",
933
963
  borderRadius: "6px", padding: "6px 12px", color: "#ffd27a" }
934
- }, isFontEnhancerInstalled() ? "🎯 一键恢复悬浮球默认位置(右下角,双球)" : "🎯 一键恢复悬浮球默认位置(右下角)"));
964
+ }, "🎯 所有悬浮球回到右下角"));
935
965
  // ── 推荐插件(v1.5.7 统一三条清单:字体/技能/照片,探测式安装徽标)──
936
966
  rows.push(React.createElement("div", { key: "rec-head", style: { fontWeight: "600", marginTop: "12px", marginBottom: "4px", borderTop: "1px solid rgba(255,255,255,.08)", paddingTop: "10px" } }, "推荐插件"));
937
967
  function recRow(key, recId, icon, text, repo) {
@@ -939,9 +969,14 @@ window.__ModuleLoader__.load({
939
969
  React.createElement("span", null, icon + " " + text),
940
970
  React.createElement("a", { href: "https://github.com/" + repo, target: "_blank", rel: "noopener", style: { textDecoration: "none", fontSize: "12px", background: "rgba(255,255,255,.06)", border: "1px solid rgba(255,255,255,.12)", borderRadius: "6px", padding: "2px 8px", color: "#ffd27a", cursor: "pointer", whiteSpace: "nowrap" } }, "⭐ Star"));
941
971
  }
972
+ // ── 推荐插件(v1.5.7 统一清单:字体/技能/照片/Todo,探测式安装徽标)──
973
+ // Todo 悬浮球皮肤切换(三皮肤):事件委托到本分区容器——React 合成
974
+ // 事件与 ref 均不可靠(slot 重渲染会重建 DOM),委托到容器上永不失效。
975
+ // 点击写 localStorage + 直调 todo 插件的 __dshtfbApplyTheme 钩子。
942
976
  rows.push(recRow("rec-font", "font", "🔤", "字体插件 — 区域自定义字体/颜色/字号", "loyalchiiina/dsh-font-enhancer"));
943
977
  rows.push(recRow("rec-skillbrowser", "skillbrowser", "🧩", "技能浏览器 — 悬浮球面板浏览共享技能库 + 失效台账", "loyalchiiina/dsh-skill-browser"));
944
- rows.push(recRow("rec-lightbox", "lightbox", "🖼️", "照片显示器 — 聊天图片灯箱(放大/下载/浏览)", "loyalchiiina/dsh-chat-image-lightbox"));return React.createElement("div", { "data-dsb-slot": "1", style: { display: "flex", flexDirection: "column", gap: "8px", padding: "8px 0" } }, rows);
978
+ rows.push(recRow("rec-lightbox", "lightbox", "🖼️", "照片显示器 — 聊天图片灯箱(放大/下载/浏览)", "loyalchiiina/dsh-chat-image-lightbox"));
979
+ rows.push(recRow("rec-todoball", "todoball", "📋", "Todo 悬浮球 — todo_write 进度常驻监控 + 多会话固定 + 三皮肤(面板内 🎨 切换)", "loyalchiiina/dsh-todo-float-ball"));return React.createElement("div", { "data-dsb-slot": "1", style: { display: "flex", flexDirection: "column", gap: "8px", padding: "8px 0" } }, rows);
945
980
  }
946
981
 
947
982
  function registerSettings(ctx) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-skill-browser",
3
- "version": "1.6.1",
3
+ "version": "1.6.2",
4
4
  "description": "DSH 技能浏览器:悬浮球面板浏览共享技能库(分类/中文简介/搜索/失效台账/全文查看),含 DSH 设置页悬浮球显隐开关与一键恢复默认位置按钮、技能库位置可配置(原生目录选择框)与技能失效台账自动登记(自动/人工分开显示);推荐插件位仅保留面板设置展开区一处。Skill library browser panel with categories, Chinese descriptions, configurable skill root with native directory chooser, one-click ball position reset and automatic skill-failure ledger.",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",