dsh-browser-cdp 1.15.1 → 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/CHANGELOG.md CHANGED
@@ -1,5 +1,15 @@
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
+
3
13
  ## 1.15.1 (2026-11-26)
4
14
 
5
15
  **设置分节底栏新增常驻 Star 快车道(panel-star-row S 档)。**
File without changes
File without changes
package/dsh-plugin.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "$schema": "https://dsh.community/schemas/dsh-plugin-0.15.json",
3
3
  "id": "dsh-browser-cdp",
4
4
  "name": "dsh-browser-cdp",
5
- "version": "1.15.1",
5
+ "version": "1.15.4",
6
6
  "manifestVersion": "0.15",
7
7
  "facets": {
8
8
  "host": {
package/lib/client.js CHANGED
@@ -765,33 +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 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"
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
+ }
779
820
  };
780
- const STAR_S_STYLE_ID = "dsh-star-row-s-style";
781
- const STAR_S_STYLE = [
782
- ".dsh-star-row-s{display:flex;align-items:center;gap:8px;flex-wrap:wrap;",
783
- "font-size:12px;line-height:1.5;color:inherit;opacity:.75;margin-top:10px;",
784
- "padding-top:8px;border-top:1px solid rgba(127,127,127,.25)}",
785
- ".dsh-star-row-s:hover{opacity:1}",
786
- ".dsh-star-link{display:inline-flex;align-items:center;gap:6px;",
787
- "color:inherit;text-decoration:none}",
788
- ".dsh-star-link:hover{text-decoration:underline}",
789
- ".dsh-star-link svg{width:14px;height:14px;flex:none;display:block}",
790
- ".dsh-star-row-s .dsh-star-ask{opacity:.85;font-weight:400}",
791
- ".dsh-star-cta{font:inherit;font-size:11px;line-height:1;padding:4px 9px;",
792
- "border-radius:999px;border:1px solid currentColor;background:transparent;",
793
- "color:inherit;cursor:pointer;flex:none;opacity:.7}",
794
- ".dsh-star-cta: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}"
795
830
  ].join("");
796
831
  /** 宿主语言标签归一:取 `documentElement.lang` 的前缀,命中 STAR_LANGS 即用。 */
797
832
  function starLang() {
@@ -799,10 +834,15 @@ function starLang() {
799
834
  for (const cand of STAR_LANGS) if (low.startsWith(cand)) return cand;
800
835
  return "en";
801
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";
802
841
  /** 是否已被用户点掉话术(隐私模式下读失败按未关闭处理,只影响本次会话)。 */
803
842
  function starDismissed() {
804
843
  try {
805
- return localStorage.getItem("dsh.star." + STAR_NS + ".dismissed") === "1";
844
+ if (localStorage.getItem(STAR_DISMISS_KEY_V1) !== null) localStorage.removeItem(STAR_DISMISS_KEY_V1);
845
+ return localStorage.getItem(STAR_DISMISS_KEY) === "1";
806
846
  } catch {
807
847
  return false;
808
848
  }
@@ -810,43 +850,69 @@ function starDismissed() {
810
850
  /** 记住关闭态(隐私模式写失败不报错,话术本次隐藏、刷新复活)。 */
811
851
  function starDismiss() {
812
852
  try {
813
- localStorage.setItem("dsh.star." + STAR_NS + ".dismissed", "1");
853
+ localStorage.setItem(STAR_DISMISS_KEY, "1");
814
854
  } catch {}
815
855
  }
816
- /** 一次性注入 S 档样式。 */
817
- function injectStarSStyle(d) {
818
- if (d.getElementById(STAR_S_STYLE_ID)) return;
856
+ /** 一次性注入页脚样式。 */
857
+ function injectFootStyle(d) {
858
+ if (d.getElementById(STAR_FOOT_STYLE_ID)) return;
819
859
  const style = d.createElement("style");
820
- style.id = STAR_S_STYLE_ID;
821
- style.textContent = STAR_S_STYLE;
860
+ style.id = STAR_FOOT_STYLE_ID;
861
+ style.textContent = STAR_FOOT_STYLE;
822
862
  d.head.appendChild(style);
823
863
  }
824
- /** S 档扩充:把裸链接行升级成「链接 | 话术 | ★ CTA」,非 S 档返回 null 走原路径。 */
825
- function extendedStarRow(link, d) {
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;
883
+ }
884
+ /**
885
+ * S 档:一行页脚;非 S 档或已关掉过话术时返回 null(走裸链接原路径)。
886
+ * 点过任一链接 → 记关闭 + 换回中性一行,链接本身照常跳转(不 preventDefault)。
887
+ */
888
+ function extendedStarRow(neutral, d) {
826
889
  if (STAR_VARIANT !== "S") return null;
827
- if (starDismissed()) return link;
828
- injectStarSStyle(d);
829
- link.className = "dsh-star-link";
830
- const lang = starLang();
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";
831
894
  const row = d.createElement("div");
832
- row.className = "dsh-star-row-s";
833
- row.appendChild(link);
834
- const ask = d.createElement("span");
835
- ask.className = "dsh-star-ask";
836
- ask.textContent = STAR_COPY[lang].ask;
837
- row.appendChild(ask);
838
- const cta = d.createElement("button");
839
- cta.type = "button";
840
- cta.className = "dsh-star-cta";
841
- cta.textContent = "★ " + STAR_CTA[lang];
842
- cta.addEventListener("click", () => {
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 = () => {
843
908
  starDismiss();
844
909
  if (row.parentNode) {
845
- row.parentNode.replaceChild(link, row);
846
- link.className = "dsh-star-row";
910
+ neutral.className = "dsh-star-row";
911
+ row.parentNode.replaceChild(neutral, row);
847
912
  }
848
- });
849
- row.appendChild(cta);
913
+ };
914
+ star.addEventListener("click", collapse);
915
+ issue.addEventListener("click", collapse);
850
916
  return row;
851
917
  }
852
918
  /** 在目标文档上建出快车道行(一次性注入样式)。纯 DOM,React 仓经 ref 回调挂载。 */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-browser-cdp",
3
- "version": "1.15.1",
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",
File without changes
File without changes
File without changes
@@ -1,23 +1,23 @@
1
- # JEV 判定链(实验性)
2
-
3
- **默认不要用。** 这条链是实验性质,只在明确要求"按视觉判定网页状态"时才启用。
4
-
5
- ## 前提
6
-
7
- - 必须配了 JEV 或 Laya 的 Key,否则这 5 个工具不注入;即使注入,调用也只会回"未配置";
8
- - 五个工具是一套流水:`bcdp_jev_status` → `bcdp_jev_ask` / `bcdp_jev_frame` → `bcdp_jev_run` → `bcdp_jev_attempt`。
9
-
10
- ## 什么时候值得用
11
-
12
- - 需要用"看图判断"来确认状态(不是读 DOM 文本能得出的结论);
13
- - 需要一次判定产出可复用的证据(帧 + 结论 + 尝试记录)。
14
-
15
- ## 什么时候不要用
16
-
17
- - 只是想确认"页面变了没" → 用 `bcdp_snapshot` / `bcdp_page_info`;
18
- - 只是想截个图给人看 → 用 `bcdp_screenshot`;
19
- - 没配 Key → 直接跳过,不要反复试探。
20
-
21
- ## 失败处理
22
-
23
- 判定链失败时**不要自动重试整条链**:先 `bcdp_jev_status` 看链路可用性,确认是"未配置"还是"判定无结论"。判定无结论时把事实(帧、目标、失败原因)回给用户,不要替用户下结论。
1
+ # JEV 判定链(实验性)
2
+
3
+ **默认不要用。** 这条链是实验性质,只在明确要求"按视觉判定网页状态"时才启用。
4
+
5
+ ## 前提
6
+
7
+ - 必须配了 JEV 或 Laya 的 Key,否则这 5 个工具不注入;即使注入,调用也只会回"未配置";
8
+ - 五个工具是一套流水:`bcdp_jev_status` → `bcdp_jev_ask` / `bcdp_jev_frame` → `bcdp_jev_run` → `bcdp_jev_attempt`。
9
+
10
+ ## 什么时候值得用
11
+
12
+ - 需要用"看图判断"来确认状态(不是读 DOM 文本能得出的结论);
13
+ - 需要一次判定产出可复用的证据(帧 + 结论 + 尝试记录)。
14
+
15
+ ## 什么时候不要用
16
+
17
+ - 只是想确认"页面变了没" → 用 `bcdp_snapshot` / `bcdp_page_info`;
18
+ - 只是想截个图给人看 → 用 `bcdp_screenshot`;
19
+ - 没配 Key → 直接跳过,不要反复试探。
20
+
21
+ ## 失败处理
22
+
23
+ 判定链失败时**不要自动重试整条链**:先 `bcdp_jev_status` 看链路可用性,确认是"未配置"还是"判定无结论"。判定无结论时把事实(帧、目标、失败原因)回给用户,不要替用户下结论。
@@ -1,59 +1,59 @@
1
- # 配方
2
-
3
- 按需读。每个配方都是"一次调用只做一件事"的排布,不要合并。
4
-
5
- ## 填一份表单
6
-
7
- ```
8
- 1. bcdp_navigate {url, wait:true}
9
- 2. bcdp_snapshot → 找候选字段的 loc=
10
- 3. bcdp_fill {selector:'loc=...', text:'...'} (逐个字段,一次一个)
11
- 4. bcdp_check {selector:'loc=...', checked:true} / bcdp_select {selector, value}
12
- 5. bcdp_click {selector:'loc=...'} → 点提交(单独一次)
13
- 6. bcdp_wait {op:'url', pattern:'success'} 或 {op:'response', pattern:'/api/submit'}
14
- 7. bcdp_snapshot 或 bcdp_page_info → 确认真的成功了
15
- ```
16
-
17
- 要点:提交前确认每个字段都写进去了(回读一次成对字段),提交后**必须有一步验证**,不要凭 click 返回成功就报告完成。
18
-
19
- ## 多标签页
20
-
21
- ```
22
- bcdp_tab {op:'list'} → 看现有标签
23
- bcdp_tab {op:'new', url:'...'} → 打开(会复用同 URL 的标签)
24
- bcdp_tab {op:'current'} → 确认 agent 当前在哪个页
25
- bcdp_tab {op:'switch', target:'...'} → target 可传 targetId 或 URL 子串
26
- bcdp_tab {op:'close', target:'...'} → 不会关闭最后一个标签
27
- ```
28
-
29
- 注意:`tabbit-cli` 后端**没有标签枚举和窗口关闭**,`op=list/close` 会失败。这种活要换 CDP 端点或 ego 线。
30
-
31
- ## 上传 / 下载
32
-
33
- - 上传:`bcdp_upload` 指定本地文件路径,不要用 `bcdp_js` 伪造 file input(伪造的往往被前端校验拦掉)。
34
- - 下载:`bcdp_download`。`tabbit-cli` 后端**收不到下载事件**,需要真下载就换后端。
35
- - 先确认触发动作(点击)与上传/下载的顺序,别把两者塞进同一次调用。
36
-
37
- ## iframe 内部
38
-
39
- `bcdp_snapshot` 不保证覆盖跨域 iframe。优先:
40
-
41
- 1. 先 `bcdp_page_info` 看页面结构;
42
- 2. 覆盖不到就用 `bcdp_script`,在脚本里用 `page.frames()` 定位(**仅 ego 线可用**;tabbit 线没有 `taskSpaces` / `cdp()` / `fetch.*`,`page.frames()` 之外的 SDK 面也不全)。
43
-
44
- ## 分页取数
45
-
46
- ```
47
- 1. bcdp_js {expression:'...'} → 抓当前页条目(只返回结构化数组 + 计数)
48
- 2. bcdp_click / bcdp_wait → 翻页,一次一步
49
- 3. 重复,直到 计数不再增长 或 出现结束标记
50
- ```
51
-
52
- 要点:
53
- - 每次只返回**本轮新增**的条目,不要每轮把累计结果整体回传(上下文会被自己撑爆)。
54
- - 报"共 N 条"之前,必须有一次"最后一页为空/总数对得上"的验证。没验证就说"已翻到第 k 页,累计 N 条,未确认是否到底"。
55
-
56
- ## 视觉确认
57
-
58
- - `bcdp_screenshot {selector:'loc=...'}` 只截局部,默认别截整页;
59
- - 需要判断"长得对不对"时,截完直接看图,不要用 `bcdp_js` 读计算样式去猜。
1
+ # 配方
2
+
3
+ 按需读。每个配方都是"一次调用只做一件事"的排布,不要合并。
4
+
5
+ ## 填一份表单
6
+
7
+ ```
8
+ 1. bcdp_navigate {url, wait:true}
9
+ 2. bcdp_snapshot → 找候选字段的 loc=
10
+ 3. bcdp_fill {selector:'loc=...', text:'...'} (逐个字段,一次一个)
11
+ 4. bcdp_check {selector:'loc=...', checked:true} / bcdp_select {selector, value}
12
+ 5. bcdp_click {selector:'loc=...'} → 点提交(单独一次)
13
+ 6. bcdp_wait {op:'url', pattern:'success'} 或 {op:'response', pattern:'/api/submit'}
14
+ 7. bcdp_snapshot 或 bcdp_page_info → 确认真的成功了
15
+ ```
16
+
17
+ 要点:提交前确认每个字段都写进去了(回读一次成对字段),提交后**必须有一步验证**,不要凭 click 返回成功就报告完成。
18
+
19
+ ## 多标签页
20
+
21
+ ```
22
+ bcdp_tab {op:'list'} → 看现有标签
23
+ bcdp_tab {op:'new', url:'...'} → 打开(会复用同 URL 的标签)
24
+ bcdp_tab {op:'current'} → 确认 agent 当前在哪个页
25
+ bcdp_tab {op:'switch', target:'...'} → target 可传 targetId 或 URL 子串
26
+ bcdp_tab {op:'close', target:'...'} → 不会关闭最后一个标签
27
+ ```
28
+
29
+ 注意:`tabbit-cli` 后端**没有标签枚举和窗口关闭**,`op=list/close` 会失败。这种活要换 CDP 端点或 ego 线。
30
+
31
+ ## 上传 / 下载
32
+
33
+ - 上传:`bcdp_upload` 指定本地文件路径,不要用 `bcdp_js` 伪造 file input(伪造的往往被前端校验拦掉)。
34
+ - 下载:`bcdp_download`。`tabbit-cli` 后端**收不到下载事件**,需要真下载就换后端。
35
+ - 先确认触发动作(点击)与上传/下载的顺序,别把两者塞进同一次调用。
36
+
37
+ ## iframe 内部
38
+
39
+ `bcdp_snapshot` 不保证覆盖跨域 iframe。优先:
40
+
41
+ 1. 先 `bcdp_page_info` 看页面结构;
42
+ 2. 覆盖不到就用 `bcdp_script`,在脚本里用 `page.frames()` 定位(**仅 ego 线可用**;tabbit 线没有 `taskSpaces` / `cdp()` / `fetch.*`,`page.frames()` 之外的 SDK 面也不全)。
43
+
44
+ ## 分页取数
45
+
46
+ ```
47
+ 1. bcdp_js {expression:'...'} → 抓当前页条目(只返回结构化数组 + 计数)
48
+ 2. bcdp_click / bcdp_wait → 翻页,一次一步
49
+ 3. 重复,直到 计数不再增长 或 出现结束标记
50
+ ```
51
+
52
+ 要点:
53
+ - 每次只返回**本轮新增**的条目,不要每轮把累计结果整体回传(上下文会被自己撑爆)。
54
+ - 报"共 N 条"之前,必须有一次"最后一页为空/总数对得上"的验证。没验证就说"已翻到第 k 页,累计 N 条,未确认是否到底"。
55
+
56
+ ## 视觉确认
57
+
58
+ - `bcdp_screenshot {selector:'loc=...'}` 只截局部,默认别截整页;
59
+ - 需要判断"长得对不对"时,截完直接看图,不要用 `bcdp_js` 读计算样式去猜。
@@ -1,63 +1,63 @@
1
- # 恢复
2
-
3
- ## 工具突然全没了
4
-
5
- 正常。`lazy` 模式下闲置回收会把注入面收回成只剩 `bcdp_help`。再调一次 `bcdp_help` 就重新铺开——这不是插件坏了,也不要改设置。
6
-
7
- ## 连不上浏览器
8
-
9
- ```
10
- bcdp_status {refresh:true} → 重新探测并刷新状态
11
- bcdp_doctor → 看连接列表、激活项、解析到的路径
12
- ```
13
-
14
- `bcdp_doctor` 首行会写当前注入面(`mode=lazy browse=open ... live N / sealed M`)。看不到工具时先读这一行,别猜。
15
-
16
- ## 后端不对
17
-
18
- 设置面板里的连接列表是**有序**的,**被激活的那一项驱动每一次 `bcdp_*` 调用**。顺序即优先级。
19
-
20
- - 切了后端之后,先 `bcdp_status` 确认 `backend:` 再干活;
21
- - 激活 `tabbit-cli` 时插件会硬拒内置运行时启动(防止"以为在 Tabbit 里做、实际驱动了另一个浏览器");
22
- - 同机不要同时用另一个 Tabbit 驱动(会抢同一个任务槽)。
23
-
24
- ## 人机验证 / 登录墙
25
-
26
- ```
27
- bcdp_captcha → 检测并提示用户去窗口里手动完成
28
- bcdp_wait_for_human {reason:'...'} → 显式让权,等用户做完再继续
29
- ```
30
-
31
- 铁律:不猜密码、不绕验证、不重复提交。用户那边完成后,`bcdp_space {op:'takeover'}` 拿回控制权。
32
-
33
- ## Windows 上前台反复被抢
34
-
35
- 在 Windows 上频繁 `bcdp_tab {op:'switch'}` / `op:'new'` 可能把浏览器窗口反复提到最前,打断用户。
36
-
37
- 对策:把同一轮操作聚在一次调用里完成,减少切 tab 次数;需要长时间后台跑时先跟用户说一声。
38
-
39
- ## 选择器失效
40
-
41
- - `@N` / `ref=N` 每次快照重新编号,**跨调用不可靠**;
42
- - 重新 `bcdp_snapshot` 拿新的,或者从一开始就用 `loc=...`;
43
- - 页面用 shadow DOM 时,`loc=` 也可能取不到,改用 `bcdp_script` 里 `page.locator()` 的深度穿透写法。
44
-
45
- ## 超时之后
46
-
47
- 1. **先核实状态**(`bcdp_snapshot` 看页面当前长什么样);
48
- 2. 只有当确认"没生效"才重试;有副作用的操作(提交、支付、删除)尤其不能盲跑;
49
- 3. 需要更长预算时,`bcdp_script` 有 `timeoutMs`;`tabbit-cli` 的 CLI 级 `--timeout-ms` 被夹在 60000–180000,写小了会被抬上去。
50
-
51
- ## tabbit 通道专属
52
-
53
- - `request-id` 是幂等的:同一个 id 重放返回原回执,不会重跑;
54
- - 任务被 finish 后重建,会重置该任务的配额与 `globalThis` 状态;
55
- - 没有 `Browser.*` / `Target.*` 域:标签枚举、窗口关闭、Overlay 点选、下载事件都不可用;
56
- - 不支持 `verbatim`:`bcdp_script` 在 tabbit 线会拒绝该参数。
57
-
58
- ## 空间与并发
59
-
60
- - 每个会话默认用**自己的**空间(`dsh-agent-<会话 id 前 8 位>`),并发会话互不干扰;
61
- - **不要手动建 `#4`/`#5` 这类编号空间**;
62
- - 确实要跨会话共享一个槽时才显式传 `space:'default'`;
63
- - 登录态在磁盘 Profile 里跨重启保留(除非开了 `isolateSpaces` 内存沙盒)。
1
+ # 恢复
2
+
3
+ ## 工具突然全没了
4
+
5
+ 正常。`lazy` 模式下闲置回收会把注入面收回成只剩 `bcdp_help`。再调一次 `bcdp_help` 就重新铺开——这不是插件坏了,也不要改设置。
6
+
7
+ ## 连不上浏览器
8
+
9
+ ```
10
+ bcdp_status {refresh:true} → 重新探测并刷新状态
11
+ bcdp_doctor → 看连接列表、激活项、解析到的路径
12
+ ```
13
+
14
+ `bcdp_doctor` 首行会写当前注入面(`mode=lazy browse=open ... live N / sealed M`)。看不到工具时先读这一行,别猜。
15
+
16
+ ## 后端不对
17
+
18
+ 设置面板里的连接列表是**有序**的,**被激活的那一项驱动每一次 `bcdp_*` 调用**。顺序即优先级。
19
+
20
+ - 切了后端之后,先 `bcdp_status` 确认 `backend:` 再干活;
21
+ - 激活 `tabbit-cli` 时插件会硬拒内置运行时启动(防止"以为在 Tabbit 里做、实际驱动了另一个浏览器");
22
+ - 同机不要同时用另一个 Tabbit 驱动(会抢同一个任务槽)。
23
+
24
+ ## 人机验证 / 登录墙
25
+
26
+ ```
27
+ bcdp_captcha → 检测并提示用户去窗口里手动完成
28
+ bcdp_wait_for_human {reason:'...'} → 显式让权,等用户做完再继续
29
+ ```
30
+
31
+ 铁律:不猜密码、不绕验证、不重复提交。用户那边完成后,`bcdp_space {op:'takeover'}` 拿回控制权。
32
+
33
+ ## Windows 上前台反复被抢
34
+
35
+ 在 Windows 上频繁 `bcdp_tab {op:'switch'}` / `op:'new'` 可能把浏览器窗口反复提到最前,打断用户。
36
+
37
+ 对策:把同一轮操作聚在一次调用里完成,减少切 tab 次数;需要长时间后台跑时先跟用户说一声。
38
+
39
+ ## 选择器失效
40
+
41
+ - `@N` / `ref=N` 每次快照重新编号,**跨调用不可靠**;
42
+ - 重新 `bcdp_snapshot` 拿新的,或者从一开始就用 `loc=...`;
43
+ - 页面用 shadow DOM 时,`loc=` 也可能取不到,改用 `bcdp_script` 里 `page.locator()` 的深度穿透写法。
44
+
45
+ ## 超时之后
46
+
47
+ 1. **先核实状态**(`bcdp_snapshot` 看页面当前长什么样);
48
+ 2. 只有当确认"没生效"才重试;有副作用的操作(提交、支付、删除)尤其不能盲跑;
49
+ 3. 需要更长预算时,`bcdp_script` 有 `timeoutMs`;`tabbit-cli` 的 CLI 级 `--timeout-ms` 被夹在 60000–180000,写小了会被抬上去。
50
+
51
+ ## tabbit 通道专属
52
+
53
+ - `request-id` 是幂等的:同一个 id 重放返回原回执,不会重跑;
54
+ - 任务被 finish 后重建,会重置该任务的配额与 `globalThis` 状态;
55
+ - 没有 `Browser.*` / `Target.*` 域:标签枚举、窗口关闭、Overlay 点选、下载事件都不可用;
56
+ - 不支持 `verbatim`:`bcdp_script` 在 tabbit 线会拒绝该参数。
57
+
58
+ ## 空间与并发
59
+
60
+ - 每个会话默认用**自己的**空间(`dsh-agent-<会话 id 前 8 位>`),并发会话互不干扰;
61
+ - **不要手动建 `#4`/`#5` 这类编号空间**;
62
+ - 确实要跨会话共享一个槽时才显式传 `space:'default'`;
63
+ - 登录态在磁盘 Profile 里跨重启保留(除非开了 `isolateSpaces` 内存沙盒)。