dsh-browser-cdp 1.15.0 → 1.15.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.
- package/CHANGELOG.md +21 -0
- package/dsh-plugin.json +1 -1
- package/lib/client.js +230 -1
- package/lib/index.js +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,26 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 1.15.2 (2026-11-26)
|
|
4
|
+
|
|
5
|
+
**设置卡底栏 Star 快车道:★ 直接打开仓库页(不再只静默收起),隐藏独立成 ×。**
|
|
6
|
+
|
|
7
|
+
- 新增 `src/client/star-row-copy.ts`(由 `_tools/star-row/sync.mjs` 从 kit 真源生成,禁手改):GitHub 图标 + owner/repo 链接 | 求星话术 | ★ CTA | × 隐藏。
|
|
8
|
+
- **修 S 档旧缺陷**:点 ★ 此前写成 `starDismiss()`,与「别打扰我」合流,仓库页一次都没打开过。现在 ★ 走锚点 click 打开 `REPO_URL`(不写 dismissed),× 才写 `dsh.star.<ns>.dismissed=1` 并收话术与两钮;链接段永留。
|
|
9
|
+
- 真源 `STAR:EXTENDED` 段单源维护,A/L 档副本由 sync 整段剥除,已发布 A/L 仓零 diff。
|
|
10
|
+
- 文案 10 语按 `documentElement.lang` 前缀自选,不依赖宿主 locale 服务;样式只走 `--dsw-alias-*` 令牌与 `currentColor`,零硬色。
|
|
11
|
+
- 契约测试改写:旧断言「点 ★ 只收话术」本身把缺陷锁成了契约,改为「★ 打开仓库页且不写 dismissed / × 才隐藏」。
|
|
12
|
+
|
|
13
|
+
## 1.15.1 (2026-11-26)
|
|
14
|
+
|
|
15
|
+
**设置分节底栏新增常驻 Star 快车道(panel-star-row S 档)。**
|
|
16
|
+
|
|
17
|
+
- `src/client/index.ts` 的 `FamilySettingsCard`(顶层 `settings.section` 分节 body)末尾挂一行常驻条:GitHub 单色 SVG + `drscrewdriver/dsh-browser-cdp` 链接(新标签页、`rel=noreferrer`)+ 一句工程化求星话术 + `★ 留颗 Star` 钮。
|
|
18
|
+
- 行本体是生成副本 `src/client/star-row-copy.ts`(真源 `mine-dsh-plugins/_tools/star-row/starRow.ts`,`sync.mjs --check` 把漂移);副本内嵌 10 语按 `<html lang>` 前缀自选,认不出回落 en。
|
|
19
|
+
- 关闭语义:点钮只收起话术与钮(`localStorage` 键 `dsh.star.browser-cdp.dismissed`),**仓库链接永留**;不弹窗。
|
|
20
|
+
- `star-row-copy.ts` 登记进本仓 locale 守卫白名单(`tests/_locale-baseline.json`)——C-ui 148 / A-pair 82 棘轮原地不动,全量 1431 passed 不变。
|
|
21
|
+
- 行为契约 `tests/star-row.test.ts`(4 例:渲染/链接属性/十语切换/关闭后只剩链接)。
|
|
22
|
+
- 顺带对齐 `CLIENT_BUILD`:此前停在 `1.14.11`(比 package.json 落后两个版本),面板标题自报的构建号是错的;现由 `scripts/bump.mjs` 同步为 `1.15.1`。
|
|
23
|
+
|
|
3
24
|
## 1.15.0 (2026-11-26)
|
|
4
25
|
|
|
5
26
|
**新增本插件首个跨插件服务面 `browser-fetch`(主题线 1.15.0-rc.1 / rc.2,预发布线已验证)。**
|
package/dsh-plugin.json
CHANGED
package/lib/client.js
CHANGED
|
@@ -700,6 +700,230 @@ const BROWSER_CDP_GUIDE_STEPS = {
|
|
|
700
700
|
]
|
|
701
701
|
};
|
|
702
702
|
|
|
703
|
+
//#endregion
|
|
704
|
+
//#region src/client/star-row-copy.ts
|
|
705
|
+
/**
|
|
706
|
+
* star-row 真源(面板 star 快车道行,v1)——纯 DOM 实现,零依赖。
|
|
707
|
+
*
|
|
708
|
+
* 副本约束:生成文件名 star-row-copy.ts,头部须保留 /** 块注释,单行 ≤140
|
|
709
|
+
* 字宽(sidebar-fold 仓 lint 门禁:max-line + file-header)。
|
|
710
|
+
*
|
|
711
|
+
* 契约(对齐 panel-star-row spec):
|
|
712
|
+
* - 渲染一行 <a>:GitHub 单色 SVG + `owner/name`;variant A 追加一句工程话术;
|
|
713
|
+
* - 整行即链接(A/L 档),新标签页打开;不做弹窗、不做按钮交互;
|
|
714
|
+
* - 文案内嵌 10 语,按 `document.documentElement.lang` 前缀自选
|
|
715
|
+
* (同 sidebar-fold `pickDictionary` 口径),不依赖宿主 locale 服务,
|
|
716
|
+
* 避免逐仓动字典文件;
|
|
717
|
+
* - 样式一次性注入 <style data-dsh-star-row>,色随 currentColor,深浅主题自适应;
|
|
718
|
+
* - 副本由 _tools/star-row/sync.mjs 生成到各仓 `src/client/star-row-copy.ts`
|
|
719
|
+
* (文件名含 copy,locale 守卫豁免规则命中),改副本无效,改真源后重跑 sync。
|
|
720
|
+
*
|
|
721
|
+
* 每仓生成时在文件头部烘焙 REPO_URL / STAR_NS / STAR_VARIANT 三个常量。
|
|
722
|
+
*/
|
|
723
|
+
/** 生成段:REPO_URL / STAR_NS / STAR_VARIANT 由 sync 注入。 */
|
|
724
|
+
const REPO_URL = "https://github.com/drscrewdriver/dsh-browser-cdp";
|
|
725
|
+
const STAR_NS = "browser-cdp";
|
|
726
|
+
const STAR_VARIANT = "S";
|
|
727
|
+
/** zh 为键集真理源;10 语与 sidebar-fold/manage-session 同集合。 */
|
|
728
|
+
const STAR_COPY = {
|
|
729
|
+
zh: { ask: "觉得省事了?一颗 Star 让工具被更多人看见" },
|
|
730
|
+
en: { ask: "Finding it handy? A star helps more people discover this tool" },
|
|
731
|
+
ja: { ask: "便利でしたら⭐で、このツールがもっと届きます" },
|
|
732
|
+
ko: { ask: "유용했다면 ⭐ 하나로 더 많은 사용자에게 닿습니다" },
|
|
733
|
+
fr: { ask: "Utile ? Une étoile aide cet outil à être découvert" },
|
|
734
|
+
de: { ask: "Nützlich? Ein Stern hilft dem Tool, gesehen zu werden" },
|
|
735
|
+
it: { ask: "Ti è utile? Una stella aiuta questo tool a farsi scoprire" },
|
|
736
|
+
ru: { ask: "Пригодилось? Звезда поможет большему числу людей узнать о tool" },
|
|
737
|
+
es: { ask: "¿Te resulta útil? Una estrella ayuda a que más gente lo descubra" },
|
|
738
|
+
pt: { ask: "Achou útil? Uma estrela ajuda mais pessoas a descobrir a ferramenta" }
|
|
739
|
+
};
|
|
740
|
+
const STAR_LANGS = [
|
|
741
|
+
"zh",
|
|
742
|
+
"en",
|
|
743
|
+
"ja",
|
|
744
|
+
"ko",
|
|
745
|
+
"fr",
|
|
746
|
+
"de",
|
|
747
|
+
"it",
|
|
748
|
+
"ru",
|
|
749
|
+
"es",
|
|
750
|
+
"pt"
|
|
751
|
+
];
|
|
752
|
+
/** GitHub mark(Simple Icons / octicon 轮廓,24 视口),fill 随 currentColor。 */
|
|
753
|
+
const GITHUB_MARK_PATH = "M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332 -5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12";
|
|
754
|
+
const STYLE_ID = "dsh-star-row-style";
|
|
755
|
+
const STYLE_CSS = [
|
|
756
|
+
".dsh-star-row{display:flex;align-items:center;gap:7px;font-size:12px;",
|
|
757
|
+
"line-height:1.5;color:inherit;text-decoration:none;opacity:.72;padding:3px 0;",
|
|
758
|
+
"margin-top:6px;min-width:0;flex-wrap:wrap}",
|
|
759
|
+
".dsh-star-row:hover{opacity:1;text-decoration:underline}",
|
|
760
|
+
".dsh-star-row svg{width:14px;height:14px;flex:none;display:block}",
|
|
761
|
+
".dsh-star-row .dsh-star-ask{opacity:.85;font-weight:400}"
|
|
762
|
+
].join("");
|
|
763
|
+
function pickLang() {
|
|
764
|
+
const low = (typeof document !== "undefined" && document.documentElement.lang || "").toLowerCase();
|
|
765
|
+
for (const cand of STAR_LANGS) if (low.startsWith(cand)) return STAR_COPY[cand];
|
|
766
|
+
return STAR_COPY.en;
|
|
767
|
+
}
|
|
768
|
+
const STAR_CTA = {
|
|
769
|
+
zh: "留颗 Star",
|
|
770
|
+
en: "Star",
|
|
771
|
+
ja: "スター",
|
|
772
|
+
ko: "스타",
|
|
773
|
+
fr: "Star",
|
|
774
|
+
de: "Stern",
|
|
775
|
+
it: "Stella",
|
|
776
|
+
ru: "Звезда",
|
|
777
|
+
es: "Estrella",
|
|
778
|
+
pt: "Estrela"
|
|
779
|
+
};
|
|
780
|
+
/** 隐藏钮的可读名(★ 之外的独立动作,10 语同集)。 */
|
|
781
|
+
const STAR_HIDE = {
|
|
782
|
+
zh: "不再提示",
|
|
783
|
+
en: "Dismiss",
|
|
784
|
+
ja: "今後表示しない",
|
|
785
|
+
ko: "다시 보지 않기",
|
|
786
|
+
fr: "Masquer",
|
|
787
|
+
de: "Ausblenden",
|
|
788
|
+
it: "Nascondi",
|
|
789
|
+
ru: "Скрыть",
|
|
790
|
+
es: "Ocultar",
|
|
791
|
+
pt: "Ocultar"
|
|
792
|
+
};
|
|
793
|
+
const STAR_S_STYLE_ID = "dsh-star-row-s-style";
|
|
794
|
+
const STAR_S_STYLE = [
|
|
795
|
+
".dsh-star-row-s{display:flex;align-items:center;gap:8px;flex-wrap:wrap;",
|
|
796
|
+
"font-size:12px;line-height:1.5;color:inherit;opacity:.75;margin-top:10px;",
|
|
797
|
+
"padding-top:8px;border-top:1px solid var(--dsw-alias-border-l2,currentColor)}",
|
|
798
|
+
".dsh-star-row-s:hover{opacity:1}",
|
|
799
|
+
".dsh-star-link{display:inline-flex;align-items:center;gap:6px;",
|
|
800
|
+
"color:inherit;text-decoration:none}",
|
|
801
|
+
".dsh-star-link:hover{text-decoration:underline}",
|
|
802
|
+
".dsh-star-link svg{width:14px;height:14px;flex:none;display:block}",
|
|
803
|
+
".dsh-star-row-s .dsh-star-ask{opacity:.85;font-weight:400}",
|
|
804
|
+
".dsh-star-cta,.dsh-star-hide{font:inherit;font-size:11px;line-height:1;",
|
|
805
|
+
"padding:4px 9px;border-radius:999px;border:1px solid currentColor;",
|
|
806
|
+
"background:transparent;color:inherit;cursor:pointer;flex:none;opacity:.7}",
|
|
807
|
+
".dsh-star-hide{padding:4px 7px}",
|
|
808
|
+
".dsh-star-cta:hover,.dsh-star-hide:hover{opacity:1}"
|
|
809
|
+
].join("");
|
|
810
|
+
/** 宿主语言标签归一:取 `documentElement.lang` 的前缀,命中 STAR_LANGS 即用。 */
|
|
811
|
+
function starLang() {
|
|
812
|
+
const low = (typeof document !== "undefined" && document.documentElement.lang || "").toLowerCase();
|
|
813
|
+
for (const cand of STAR_LANGS) if (low.startsWith(cand)) return cand;
|
|
814
|
+
return "en";
|
|
815
|
+
}
|
|
816
|
+
/** 是否已被用户点掉话术(隐私模式下读失败按未关闭处理,只影响本次会话)。 */
|
|
817
|
+
function starDismissed() {
|
|
818
|
+
try {
|
|
819
|
+
return localStorage.getItem("dsh.star." + STAR_NS + ".dismissed") === "1";
|
|
820
|
+
} catch {
|
|
821
|
+
return false;
|
|
822
|
+
}
|
|
823
|
+
}
|
|
824
|
+
/** 记住关闭态(隐私模式写失败不报错,话术本次隐藏、刷新复活)。 */
|
|
825
|
+
function starDismiss() {
|
|
826
|
+
try {
|
|
827
|
+
localStorage.setItem("dsh.star." + STAR_NS + ".dismissed", "1");
|
|
828
|
+
} catch {}
|
|
829
|
+
}
|
|
830
|
+
/** 一次性注入 S 档样式。 */
|
|
831
|
+
function injectStarSStyle(d) {
|
|
832
|
+
if (d.getElementById(STAR_S_STYLE_ID)) return;
|
|
833
|
+
const style = d.createElement("style");
|
|
834
|
+
style.id = STAR_S_STYLE_ID;
|
|
835
|
+
style.textContent = STAR_S_STYLE;
|
|
836
|
+
d.head.appendChild(style);
|
|
837
|
+
}
|
|
838
|
+
/** 打开仓库页:桌面壳里 window.open 可能被拦,锚点 click 才是两条路径都通的写法。 */
|
|
839
|
+
function openRepo(d) {
|
|
840
|
+
const a = d.createElement("a");
|
|
841
|
+
a.href = REPO_URL;
|
|
842
|
+
a.target = "_blank";
|
|
843
|
+
a.rel = "noopener noreferrer";
|
|
844
|
+
a.click();
|
|
845
|
+
}
|
|
846
|
+
/** S 档扩充:把裸链接行升级成「链接 | 话术 | ★ CTA | × 隐藏」,非 S 档返回 null 走原路径。 */
|
|
847
|
+
function extendedStarRow(link, d) {
|
|
848
|
+
if (STAR_VARIANT !== "S") return null;
|
|
849
|
+
if (starDismissed()) return link;
|
|
850
|
+
injectStarSStyle(d);
|
|
851
|
+
link.className = "dsh-star-link";
|
|
852
|
+
const lang = starLang();
|
|
853
|
+
const row = d.createElement("div");
|
|
854
|
+
row.className = "dsh-star-row-s";
|
|
855
|
+
row.appendChild(link);
|
|
856
|
+
const ask = d.createElement("span");
|
|
857
|
+
ask.className = "dsh-star-ask";
|
|
858
|
+
ask.textContent = STAR_COPY[lang].ask;
|
|
859
|
+
row.appendChild(ask);
|
|
860
|
+
const cta = d.createElement("button");
|
|
861
|
+
cta.type = "button";
|
|
862
|
+
cta.className = "dsh-star-cta";
|
|
863
|
+
cta.textContent = "★ " + STAR_CTA[lang];
|
|
864
|
+
cta.addEventListener("click", (event) => {
|
|
865
|
+
event.preventDefault();
|
|
866
|
+
event.stopPropagation();
|
|
867
|
+
openRepo(d);
|
|
868
|
+
});
|
|
869
|
+
row.appendChild(cta);
|
|
870
|
+
const hide = d.createElement("button");
|
|
871
|
+
hide.type = "button";
|
|
872
|
+
hide.className = "dsh-star-hide";
|
|
873
|
+
hide.textContent = "×";
|
|
874
|
+
hide.title = STAR_HIDE[lang];
|
|
875
|
+
hide.setAttribute("aria-label", STAR_HIDE[lang]);
|
|
876
|
+
hide.addEventListener("click", (event) => {
|
|
877
|
+
event.preventDefault();
|
|
878
|
+
event.stopPropagation();
|
|
879
|
+
starDismiss();
|
|
880
|
+
if (row.parentNode) {
|
|
881
|
+
row.parentNode.replaceChild(link, row);
|
|
882
|
+
link.className = "dsh-star-row";
|
|
883
|
+
}
|
|
884
|
+
});
|
|
885
|
+
row.appendChild(hide);
|
|
886
|
+
return row;
|
|
887
|
+
}
|
|
888
|
+
/** 在目标文档上建出快车道行(一次性注入样式)。纯 DOM,React 仓经 ref 回调挂载。 */
|
|
889
|
+
function mountStarRow(doc) {
|
|
890
|
+
const d = doc ?? document;
|
|
891
|
+
if (!d.getElementById(STYLE_ID)) {
|
|
892
|
+
const tag = d.createElement("style");
|
|
893
|
+
tag.id = STYLE_ID;
|
|
894
|
+
tag.textContent = STYLE_CSS;
|
|
895
|
+
d.head.appendChild(tag);
|
|
896
|
+
}
|
|
897
|
+
const match = REPO_URL.match(/github\.com\/([^/]+\/[^/#?]+)/);
|
|
898
|
+
const repo = match ? match[1] : "drscrewdriver";
|
|
899
|
+
const a = d.createElement("a");
|
|
900
|
+
a.className = "dsh-star-row";
|
|
901
|
+
a.href = REPO_URL;
|
|
902
|
+
a.target = "_blank";
|
|
903
|
+
a.rel = "noreferrer";
|
|
904
|
+
a.dataset.starNs = STAR_NS;
|
|
905
|
+
const svg = d.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
906
|
+
svg.setAttribute("viewBox", "0 0 24 24");
|
|
907
|
+
svg.setAttribute("aria-hidden", "true");
|
|
908
|
+
const path = d.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
909
|
+
path.setAttribute("fill", "currentColor");
|
|
910
|
+
path.setAttribute("d", GITHUB_MARK_PATH);
|
|
911
|
+
svg.appendChild(path);
|
|
912
|
+
a.appendChild(svg);
|
|
913
|
+
const label = d.createElement("span");
|
|
914
|
+
label.textContent = repo;
|
|
915
|
+
a.appendChild(label);
|
|
916
|
+
const row = extendedStarRow(a, d);
|
|
917
|
+
if (row) return row;
|
|
918
|
+
if (STAR_VARIANT === "A") {
|
|
919
|
+
const ask = d.createElement("span");
|
|
920
|
+
ask.className = "dsh-star-ask";
|
|
921
|
+
ask.textContent = pickLang().ask;
|
|
922
|
+
a.appendChild(ask);
|
|
923
|
+
}
|
|
924
|
+
return a;
|
|
925
|
+
}
|
|
926
|
+
|
|
703
927
|
//#endregion
|
|
704
928
|
//#region src/client/build.ts
|
|
705
929
|
/**
|
|
@@ -712,7 +936,7 @@ const BROWSER_CDP_GUIDE_STEPS = {
|
|
|
712
936
|
*
|
|
713
937
|
* Keep in sync with package.json — `node scripts/bump.mjs <version>` writes both.
|
|
714
938
|
*/
|
|
715
|
-
const CLIENT_BUILD = "1.
|
|
939
|
+
const CLIENT_BUILD = "1.15.1";
|
|
716
940
|
|
|
717
941
|
//#endregion
|
|
718
942
|
//#region src/client/locales.ts
|
|
@@ -2654,6 +2878,11 @@ function FamilySettingsCard(props) {
|
|
|
2654
2878
|
writable,
|
|
2655
2879
|
scope
|
|
2656
2880
|
});
|
|
2881
|
+
}), h("span", {
|
|
2882
|
+
key: "star-row",
|
|
2883
|
+
ref: function(node) {
|
|
2884
|
+
if (node && !node.firstChild) node.appendChild(mountStarRow());
|
|
2885
|
+
}
|
|
2657
2886
|
}));
|
|
2658
2887
|
}
|
|
2659
2888
|
function FamGroup(props) {
|
package/lib/index.js
CHANGED
|
@@ -2264,7 +2264,7 @@ function focusIdFrom(value) {
|
|
|
2264
2264
|
*
|
|
2265
2265
|
* Keep in sync with package.json — `node scripts/bump.mjs <version>` writes both.
|
|
2266
2266
|
*/
|
|
2267
|
-
const CLIENT_BUILD = "1.
|
|
2267
|
+
const CLIENT_BUILD = "1.15.1";
|
|
2268
2268
|
|
|
2269
2269
|
//#endregion
|
|
2270
2270
|
//#region src/cast-server.ts
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-browser-cdp",
|
|
3
|
-
"version": "1.15.
|
|
3
|
+
"version": "1.15.2",
|
|
4
4
|
"description": "dsh-browser-cdp: visible agent browser for DSH — drives the vendored ego-compatible Chromium over CDP, and can also attach to a running Chrome/Edge/Brave or route through egolite, Tabbit and Lightpanda backends. 35 structured bcdp_* tools; only bcdp_status stays resident by default (lazy injection, −91.9% schema per turn for non-browser sessions). Realtime watch panel with direct click/scroll/IME input, element picks quoted into the composer, human-verification notices; non-CDP channels sync frames by 3s polling. Web shell: floating watch ball without dsh-better-sidebar, sidebar tab with it. Headless/TUI hosts: tools-only. [DSH 0.1.0-rc.2 ~ 0.2.2-rc.1: declarative settings via Config .volatile() fields on 0.1.7+; imperative installSection / module-level registration + describe/mutate bridge on 0.1.0 ~ 0.1.5 (experimental, pending farm). Client peers stay optional so gen-1 hosts without dsh-client-store still load; for a production install on the current line use the 0.17.x line]",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./lib/index.js",
|