dsh-browser-cdp 1.15.2 → 1.15.4
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/dsh-plugin.json +1 -1
- package/lib/client.js +119 -89
- package/package.json +1 -1
package/dsh-plugin.json
CHANGED
package/lib/client.js
CHANGED
|
@@ -765,47 +765,68 @@ function pickLang() {
|
|
|
765
765
|
for (const cand of STAR_LANGS) if (low.startsWith(cand)) return STAR_COPY[cand];
|
|
766
766
|
return STAR_COPY.en;
|
|
767
767
|
}
|
|
768
|
-
const
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
}
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
ko:
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
768
|
+
const STAR_VERSION = "1.15.4";
|
|
769
|
+
const STAR_FOOT_COPY = {
|
|
770
|
+
zh: {
|
|
771
|
+
ask: "觉得好用?",
|
|
772
|
+
star: "去 GitHub 点个 Star",
|
|
773
|
+
issue: "反馈建议 / 提 issue"
|
|
774
|
+
},
|
|
775
|
+
en: {
|
|
776
|
+
ask: "Finding it useful?",
|
|
777
|
+
star: "Star on GitHub",
|
|
778
|
+
issue: "Feedback / open an issue"
|
|
779
|
+
},
|
|
780
|
+
ja: {
|
|
781
|
+
ask: "お役に立っていますか?",
|
|
782
|
+
star: "GitHub でスター",
|
|
783
|
+
issue: "ご意見・不具合報告"
|
|
784
|
+
},
|
|
785
|
+
ko: {
|
|
786
|
+
ask: "유용한가요?",
|
|
787
|
+
star: "GitHub 에서 스타",
|
|
788
|
+
issue: "피드백 / 이슈 열기"
|
|
789
|
+
},
|
|
790
|
+
fr: {
|
|
791
|
+
ask: "Utile ?",
|
|
792
|
+
star: "Une étoile sur GitHub",
|
|
793
|
+
issue: "Retour / ouvrir un ticket"
|
|
794
|
+
},
|
|
795
|
+
de: {
|
|
796
|
+
ask: "Hilfreich?",
|
|
797
|
+
star: "Stern auf GitHub",
|
|
798
|
+
issue: "Feedback / Issue öffnen"
|
|
799
|
+
},
|
|
800
|
+
it: {
|
|
801
|
+
ask: "Ti è utile?",
|
|
802
|
+
star: "Stella su GitHub",
|
|
803
|
+
issue: "Feedback / apri una issue"
|
|
804
|
+
},
|
|
805
|
+
ru: {
|
|
806
|
+
ask: "Полезно?",
|
|
807
|
+
star: "Звезда на GitHub",
|
|
808
|
+
issue: "Отзыв / открыть issue"
|
|
809
|
+
},
|
|
810
|
+
es: {
|
|
811
|
+
ask: "¿Te resulta útil?",
|
|
812
|
+
star: "Danos una estrella",
|
|
813
|
+
issue: "Sugerencias / abrir issue"
|
|
814
|
+
},
|
|
815
|
+
pt: {
|
|
816
|
+
ask: "Achou útil?",
|
|
817
|
+
star: "Dê uma estrela no GitHub",
|
|
818
|
+
issue: "Feedback / abrir uma issue"
|
|
819
|
+
}
|
|
792
820
|
};
|
|
793
|
-
const
|
|
794
|
-
const
|
|
795
|
-
".dsh-star-
|
|
796
|
-
"font-size:12px;line-height:1.
|
|
797
|
-
"
|
|
798
|
-
".dsh-star-
|
|
799
|
-
".dsh-star-
|
|
800
|
-
"color:inherit;text-decoration:none}",
|
|
801
|
-
".dsh-star-
|
|
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}"
|
|
821
|
+
const STAR_FOOT_STYLE_ID = "dsh-star-foot-style";
|
|
822
|
+
const STAR_FOOT_STYLE = [
|
|
823
|
+
".dsh-star-foot{display:flex;align-items:center;gap:6px;flex-wrap:wrap;",
|
|
824
|
+
"font-size:12px;line-height:1.6;color:inherit;opacity:.72;margin-top:10px}",
|
|
825
|
+
".dsh-star-foot:hover{opacity:1}",
|
|
826
|
+
".dsh-star-foot .dsh-star-ver{opacity:.6;font-variant-numeric:tabular-nums}",
|
|
827
|
+
".dsh-star-foot .dsh-star-dot{opacity:.4}",
|
|
828
|
+
".dsh-star-foot a{color:inherit;text-decoration:none}",
|
|
829
|
+
".dsh-star-foot a:hover{text-decoration:underline}"
|
|
809
830
|
].join("");
|
|
810
831
|
/** 宿主语言标签归一:取 `documentElement.lang` 的前缀,命中 STAR_LANGS 即用。 */
|
|
811
832
|
function starLang() {
|
|
@@ -813,10 +834,15 @@ function starLang() {
|
|
|
813
834
|
for (const cand of STAR_LANGS) if (low.startsWith(cand)) return cand;
|
|
814
835
|
return "en";
|
|
815
836
|
}
|
|
837
|
+
/** 关闭态新键(v2)。**必须换键**:≤2.0.25 把「点 ★」误写成了关闭,旧键里的 1 是误判产物。 */
|
|
838
|
+
const STAR_DISMISS_KEY = "dsh.star." + STAR_NS + ".v2.dismissed";
|
|
839
|
+
/** 旧键(脏数据源):读到即清掉,**不迁值**——迁过来等于把旧 bug 固化。 */
|
|
840
|
+
const STAR_DISMISS_KEY_V1 = "dsh.star." + STAR_NS + ".dismissed";
|
|
816
841
|
/** 是否已被用户点掉话术(隐私模式下读失败按未关闭处理,只影响本次会话)。 */
|
|
817
842
|
function starDismissed() {
|
|
818
843
|
try {
|
|
819
|
-
|
|
844
|
+
if (localStorage.getItem(STAR_DISMISS_KEY_V1) !== null) localStorage.removeItem(STAR_DISMISS_KEY_V1);
|
|
845
|
+
return localStorage.getItem(STAR_DISMISS_KEY) === "1";
|
|
820
846
|
} catch {
|
|
821
847
|
return false;
|
|
822
848
|
}
|
|
@@ -824,65 +850,69 @@ function starDismissed() {
|
|
|
824
850
|
/** 记住关闭态(隐私模式写失败不报错,话术本次隐藏、刷新复活)。 */
|
|
825
851
|
function starDismiss() {
|
|
826
852
|
try {
|
|
827
|
-
localStorage.setItem(
|
|
853
|
+
localStorage.setItem(STAR_DISMISS_KEY, "1");
|
|
828
854
|
} catch {}
|
|
829
855
|
}
|
|
830
|
-
/**
|
|
831
|
-
function
|
|
832
|
-
if (d.getElementById(
|
|
856
|
+
/** 一次性注入页脚样式。 */
|
|
857
|
+
function injectFootStyle(d) {
|
|
858
|
+
if (d.getElementById(STAR_FOOT_STYLE_ID)) return;
|
|
833
859
|
const style = d.createElement("style");
|
|
834
|
-
style.id =
|
|
835
|
-
style.textContent =
|
|
860
|
+
style.id = STAR_FOOT_STYLE_ID;
|
|
861
|
+
style.textContent = STAR_FOOT_STYLE;
|
|
836
862
|
d.head.appendChild(style);
|
|
837
863
|
}
|
|
838
|
-
/**
|
|
839
|
-
function
|
|
840
|
-
const
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
864
|
+
/** 页脚里的一段:可点即 <a>,纯文字即 <span>。 */
|
|
865
|
+
function footItem(d, tag, text, href) {
|
|
866
|
+
const el = d.createElement(tag);
|
|
867
|
+
el.className = "dsh-star-ask";
|
|
868
|
+
if (tag === "a" && href) {
|
|
869
|
+
const a = el;
|
|
870
|
+
a.href = href;
|
|
871
|
+
a.target = "_blank";
|
|
872
|
+
a.rel = "noopener noreferrer";
|
|
873
|
+
}
|
|
874
|
+
el.textContent = text;
|
|
875
|
+
return el;
|
|
876
|
+
}
|
|
877
|
+
/** 分隔点。 */
|
|
878
|
+
function footDot(d) {
|
|
879
|
+
const dot = d.createElement("span");
|
|
880
|
+
dot.className = "dsh-star-dot";
|
|
881
|
+
dot.textContent = "·";
|
|
882
|
+
return dot;
|
|
845
883
|
}
|
|
846
|
-
/**
|
|
847
|
-
|
|
884
|
+
/**
|
|
885
|
+
* S 档:一行页脚;非 S 档或已关掉过话术时返回 null(走裸链接原路径)。
|
|
886
|
+
* 点过任一链接 → 记关闭 + 换回中性一行,链接本身照常跳转(不 preventDefault)。
|
|
887
|
+
*/
|
|
888
|
+
function extendedStarRow(neutral, d) {
|
|
848
889
|
if (STAR_VARIANT !== "S") return null;
|
|
849
|
-
if (starDismissed()) return
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
const
|
|
890
|
+
if (starDismissed()) return null;
|
|
891
|
+
injectFootStyle(d);
|
|
892
|
+
const copy = STAR_FOOT_COPY[starLang()] ?? STAR_FOOT_COPY.en;
|
|
893
|
+
const issuesUrl = REPO_URL.replace(/\/+$/, "") + "/issues/new";
|
|
853
894
|
const row = d.createElement("div");
|
|
854
|
-
row.className = "dsh-star-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
row.appendChild(
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
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();
|
|
895
|
+
row.className = "dsh-star-foot";
|
|
896
|
+
const ver = d.createElement("span");
|
|
897
|
+
ver.className = "dsh-star-ver";
|
|
898
|
+
ver.textContent = "v" + STAR_VERSION;
|
|
899
|
+
row.appendChild(ver);
|
|
900
|
+
row.appendChild(footDot(d));
|
|
901
|
+
row.appendChild(footItem(d, "span", copy.ask));
|
|
902
|
+
const star = footItem(d, "a", "⭐ " + copy.star, REPO_URL);
|
|
903
|
+
const issue = footItem(d, "a", "💬 " + copy.issue, issuesUrl);
|
|
904
|
+
row.appendChild(star);
|
|
905
|
+
row.appendChild(footDot(d));
|
|
906
|
+
row.appendChild(issue);
|
|
907
|
+
const collapse = () => {
|
|
879
908
|
starDismiss();
|
|
880
909
|
if (row.parentNode) {
|
|
881
|
-
|
|
882
|
-
|
|
910
|
+
neutral.className = "dsh-star-row";
|
|
911
|
+
row.parentNode.replaceChild(neutral, row);
|
|
883
912
|
}
|
|
884
|
-
}
|
|
885
|
-
|
|
913
|
+
};
|
|
914
|
+
star.addEventListener("click", collapse);
|
|
915
|
+
issue.addEventListener("click", collapse);
|
|
886
916
|
return row;
|
|
887
917
|
}
|
|
888
918
|
/** 在目标文档上建出快车道行(一次性注入样式)。纯 DOM,React 仓经 ref 回调挂载。 */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-browser-cdp",
|
|
3
|
-
"version": "1.15.
|
|
3
|
+
"version": "1.15.4",
|
|
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",
|