dsh-browser-cdp 1.9.8 → 1.9.9

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,3 +1,15 @@
1
+ ## 1.9.9 (2026-11-10)
2
+
3
+ **Tabbit 路线补上全模式:后台 tab 也出图(轮转捕获)。**
4
+
5
+ - **之前的状态**:`tabTracking: all` 只在 ego-cli 帧轮询里生效;Tabbit 虽已进同一个 tab bucket(列表 + @ 报告),但画面仍只拍激活那一个。
6
+ - **现在的做法**:Tabbit 帧轮询按模式定计划:
7
+ - `仅激活`:1 次 CLI 运行(active tab);
8
+ - `全模式`:active tab **每 tick 都拍**,另加 **1 个后台 tab 轮转**(`tabbitFrameRR`)——N 个 tab 每 tick 仍是 2 次运行,每个后台 tab 约 `N×3s` 刷新一次;没有拿 N 次运行去挤爆同一 executor、把面板拖过自己的节奏。
9
+ - **临时文件按 tab 分路径**(`…-<pid>-<tabId>.jpg`),免得同一 tick 内后一张盖掉前一张。
10
+ - **广播**:改用 `broadcastCliFrames(images, rows)`,一轮一个 `spaces` + 每个 tab 一个 `frame`(按 targetId 绑图);面板早就按 `targetId` 分缓存,无需改客户端。
11
+ - **测试**:1021 passed / 13 skipped。
12
+
1
13
  ## 1.9.8 (2026-11-10)
2
14
 
3
15
  **登录/验证横幅:说明文字按比例收缩,不截断、不隐藏。**
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.9.8",
5
+ "version": "1.9.9",
6
6
  "manifestVersion": "0.15",
7
7
  "facets": {
8
8
  "host": {
package/lib/index.js CHANGED
@@ -1971,15 +1971,6 @@ function markEgoToolCall(sessionId) {
1971
1971
  sseClients.delete(res);
1972
1972
  }
1973
1973
  }
1974
- function broadcastCliFrame(frame, spaces) {
1975
- broadcastCliFrames([{
1976
- targetId: frame.targetId ?? "",
1977
- png: frame.png,
1978
- fmt: frame.fmt,
1979
- url: frame.url,
1980
- title: frame.title
1981
- }], spaces, frame.updatedAt);
1982
- }
1983
1974
  /**
1984
1975
  * Push one capture CYCLE into the live stream: 全模式 sends one image per tab,
1985
1976
  * 仅激活 sends exactly one. Every image is its own `frame` event keyed by
@@ -10693,7 +10684,9 @@ function apply(ctx, config = {}) {
10693
10684
  let tabbitFrameSeq = 0;
10694
10685
  let tabbitFrameInFlight = false;
10695
10686
  let tabbitFrameSkipLogged = "";
10696
- const tabbitFramePath = join(tmpdir(), `dsh-browser-cdp-frame-${process.pid}.jpg`);
10687
+ const tabbitFramePathFor = (tabId) => join(tmpdir(), `dsh-browser-cdp-frame-${process.pid}-${String(tabId)}.jpg`);
10688
+ /** Round-robin cursor: 3s ticks → active tab every tick, one background tab extra. */
10689
+ let tabbitFrameRR = 0;
10697
10690
  const tabbitFrameTimer = setInterval(async () => {
10698
10691
  const eff = resolveEffectiveLink(cfg.links, cfg.activeTargetId);
10699
10692
  if (eff?.link.kind !== TABBIT_CLI_KIND) return;
@@ -10704,40 +10697,56 @@ function apply(ctx, config = {}) {
10704
10697
  if (tabbitFrameInFlight) return;
10705
10698
  tabbitFrameInFlight = true;
10706
10699
  try {
10707
- const reqId = `frame-${Date.now()}`;
10708
- const js$2 = buildFrameCaptureSnippet(tabbitFramePath);
10709
- const target = _tabbitLastActiveTabId ?? _tabbitTabCache.tabs.find((t) => t.active === true)?.tabId;
10710
- const { receipt } = await runTabbitSnippet(ctx.subprocess, js$2, {
10711
- cliPath: cli.cliPath,
10712
- taskName: _tabbitLastTaskName,
10713
- requestId: reqId,
10714
- ...typeof target === "number" ? { tabId: target } : {}
10715
- });
10716
- const data = receipt.data;
10717
- if (receipt.ok && data?.skipped !== void 0) {
10718
- const key = `${data.skipped}:${data.error ?? ""}`;
10719
- if (tabbitFrameSkipLogged !== key) {
10720
- tabbitFrameSkipLogged = key;
10721
- ctx.logger?.info?.(`dsh-browser-cdp: tabbit frame skipped (${key}) url=${data.url ?? "?"}`);
10700
+ const activeTab = _tabbitLastActiveTabId ?? _tabbitTabCache.tabs.find((t) => t.active === true)?.tabId;
10701
+ const rows = tabbitSpaceRows().tabs;
10702
+ const allMode = getCliTrackAll(cfg.tabTracking === "all");
10703
+ const plan = [typeof activeTab === "number" ? activeTab : void 0];
10704
+ if (allMode) {
10705
+ const others = rows.map((r) => Number(r.targetId)).filter((id) => Number.isFinite(id) && id > 0 && id !== activeTab);
10706
+ if (others.length > 0) {
10707
+ plan.push(others[tabbitFrameRR % others.length]);
10708
+ tabbitFrameRR += 1;
10722
10709
  }
10723
- return;
10724
10710
  }
10725
- tabbitFrameSkipLogged = "";
10726
- if (receipt.ok && typeof data?.path === "string") {
10727
- const png = readFileSync(data.path);
10728
- tabbitFrameSeq++;
10729
- broadcastCliFrame({
10730
- png,
10731
- url: data.url ?? "",
10732
- title: data.title ?? "",
10733
- seq: tabbitFrameSeq,
10734
- updatedAt: Date.now(),
10735
- fmt: "jpeg"
10736
- }, tabbitSpaceRows().tabs);
10711
+ const images = [];
10712
+ let sawSkip = "";
10713
+ let sawNoPath = null;
10714
+ for (const tabId of plan) {
10715
+ const js$2 = buildFrameCaptureSnippet(tabbitFramePathFor(tabId ?? "active"));
10716
+ const { receipt } = await runTabbitSnippet(ctx.subprocess, js$2, {
10717
+ cliPath: cli.cliPath,
10718
+ taskName: _tabbitLastTaskName,
10719
+ requestId: `frame-${Date.now()}-${tabId ?? "active"}`,
10720
+ ...typeof tabId === "number" ? { tabId } : {}
10721
+ });
10722
+ const data = receipt.data;
10723
+ if (receipt.ok && data?.skipped !== void 0) {
10724
+ sawSkip = `${data.skipped}:${data.error ?? ""}`;
10725
+ continue;
10726
+ }
10727
+ if (receipt.ok && typeof data?.path === "string") {
10728
+ images.push({
10729
+ targetId: tabId === void 0 ? "" : String(tabId),
10730
+ png: readFileSync(data.path),
10731
+ fmt: "jpeg",
10732
+ url: data.url ?? "",
10733
+ title: data.title ?? ""
10734
+ });
10735
+ continue;
10736
+ }
10737
+ if (receipt.ok) sawNoPath = data ?? null;
10738
+ else if (receipt.status !== "queued" && receipt.status !== "running") ctx.logger?.warn?.(`dsh-browser-cdp: tabbit frame capture failed: ${receipt.error?.message ?? receipt.status}`);
10739
+ }
10740
+ if (images.length === 0) {
10741
+ if (sawSkip !== "" && tabbitFrameSkipLogged !== sawSkip) {
10742
+ tabbitFrameSkipLogged = sawSkip;
10743
+ ctx.logger?.info?.(`dsh-browser-cdp: tabbit frame skipped (${sawSkip})`);
10744
+ } else if (sawNoPath !== null) ctx.logger?.warn?.(`dsh-browser-cdp: tabbit frame receipt carried no path (data=${JSON.stringify(sawNoPath).slice(0, 120)})`);
10737
10745
  return;
10738
10746
  }
10739
- if (receipt.ok) ctx.logger?.warn?.(`dsh-browser-cdp: tabbit frame receipt carried no path (status=${receipt.status}, data=${JSON.stringify(data ?? null).slice(0, 120)})`);
10740
- else if (receipt.status !== "queued" && receipt.status !== "running") ctx.logger?.warn?.(`dsh-browser-cdp: tabbit frame capture failed: ${receipt.error?.message ?? receipt.status}`);
10747
+ tabbitFrameSkipLogged = "";
10748
+ tabbitFrameSeq++;
10749
+ broadcastCliFrames(images, rows, Date.now());
10741
10750
  } catch (err) {
10742
10751
  ctx.logger?.warn?.(`dsh-browser-cdp: tabbit frame poller error: ${String(err?.message ?? err)}`);
10743
10752
  } finally {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-browser-cdp",
3
- "version": "1.9.8",
3
+ "version": "1.9.9",
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.7-rc.1 ~ 0.2.2-rc.1 (exact rc enumeration): declarative settings via Config .volatile() fields; for DSH 0.1.2-rc.1 ~ 0.1.5-rc.3 use the 0.17.x line]",
5
5
  "type": "module",
6
6
  "main": "./lib/index.js",