dsh-browser-cdp 1.14.7 → 1.14.8
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 +12 -0
- package/dsh-plugin.json +1 -1
- package/lib/client.js +43 -27
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
## 1.14.8 (2026-11-22)
|
|
2
|
+
|
|
3
|
+
**面板路由 base 化(上游 #100 同构,修法沿用):反向代理子路径部署下 `/api/bcdp/*` 不再打到代理根。**
|
|
4
|
+
|
|
5
|
+
反向审计确认的第四个平行面。client 内 27 处根绝对路径 `/api/bcdp/...`(18 个路由常量 + 6 处散装 fetch + 3 处 EventSource)在 DSH 被挂在反向代理前缀(如 `/app/dsh/`)下时全部指向代理根——上游 #100 已实证并修复。
|
|
6
|
+
|
|
7
|
+
- **修复**:client 顶部加 `bcdpRouteBase`/`bcdpRoute`/`fetchBcdp`(沿用上游已验证形态):读部署页 `<base href>`,经 `new URL(href, document.baseURI)` 取 pathname 作前缀;**无 `<base>` 时回退 `''`**——桌面根路径部署行为逐字节不变,子路径部署自动生效。全部路由常量值包 `bcdpRoute(...)`,散装 fetch 改 `fetchBcdp(...)`,`EventSource('/api/bcdp/stream')` 改 `EventSource(bcdpRoute(...))`。
|
|
8
|
+
- **契约测试**:client-render-contract 套件新增 route base 用例——bcdpRouteBase 存在(base href + document.baseURI 回退)、**无裸 `fetch('/api/bcdp` / 裸 `= '/api/bcdp` 残留**、SSE 走 bcdpRoute。
|
|
9
|
+
- **实施注记**:批量替换在多行 fetch(URL 后跟 `, {init}`)处产生孤立括号——tsc 语法错 25 处当场暴露,两类定向修复(孤立 init、多余右括号)后归零;typecheck 是这类批量改形的真实门禁。
|
|
10
|
+
|
|
11
|
+
门禁:`npm run typecheck` 干净(修复后);`npm test` **1344 passed / 13 skipped**(+1 route base 契约用例);`npm run build` 后 lib/client.js 含 bcdpRouteBase ×2。
|
|
12
|
+
|
|
1
13
|
## 1.14.7 (2026-11-22)
|
|
2
14
|
|
|
3
15
|
**观察窗帧解码预换(上游 #82/#81 同构,预防性):`img.src` 直换的解码空白窗口收口。**
|
package/dsh-plugin.json
CHANGED
package/lib/client.js
CHANGED
|
@@ -330,6 +330,22 @@ const CLIENT_BUILD = "1.12.2";
|
|
|
330
330
|
|
|
331
331
|
//#endregion
|
|
332
332
|
//#region src/client/index.ts
|
|
333
|
+
const bcdpRouteBase = (function() {
|
|
334
|
+
try {
|
|
335
|
+
const base = document.querySelector("base[href]");
|
|
336
|
+
if (!base) return "";
|
|
337
|
+
const path = new URL(base.getAttribute("href") || "./", document.baseURI).pathname.replace(/\/+$/, "");
|
|
338
|
+
return path === "/" ? "" : path;
|
|
339
|
+
} catch (e) {
|
|
340
|
+
return "";
|
|
341
|
+
}
|
|
342
|
+
})();
|
|
343
|
+
const bcdpRoute = function(path) {
|
|
344
|
+
return bcdpRouteBase + path;
|
|
345
|
+
};
|
|
346
|
+
const fetchBcdp = function(path, init) {
|
|
347
|
+
return fetch(bcdpRoute(path), init);
|
|
348
|
+
};
|
|
333
349
|
var React = require("react");
|
|
334
350
|
var runtimeClient = null;
|
|
335
351
|
var createSnapshotStore = null;
|
|
@@ -687,16 +703,16 @@ function linkFlushable(link) {
|
|
|
687
703
|
var kind = link && link.kind || "";
|
|
688
704
|
return kind !== "ego-cli" && kind !== "tabbit-cli" && kind !== "lightpanda";
|
|
689
705
|
}
|
|
690
|
-
const SPACES_ROUTE = "/api/bcdp/spaces";
|
|
691
|
-
const TRACKING_ROUTE = "/api/bcdp/tracking";
|
|
692
|
-
const SWITCH_TAB_ROUTE = "/api/bcdp/switch-tab";
|
|
693
|
-
const EGO_CLOSE_ROUTE = "/api/bcdp/close";
|
|
694
|
-
const WATCH_START_ROUTE = "/api/bcdp/watch/start";
|
|
695
|
-
const WATCH_SWITCH_ROUTE = "/api/bcdp/watch/switch";
|
|
696
|
-
const WATCH_STOP_ROUTE = "/api/bcdp/watch/stop";
|
|
697
|
-
const WATCH_STATUS_ROUTE = "/api/bcdp/watch/status";
|
|
698
|
-
const VIDEO_ROUTE = "/api/bcdp/video";
|
|
699
|
-
const CLI_FRAME_ROUTE = "/api/bcdp/cli-frame";
|
|
706
|
+
const SPACES_ROUTE = bcdpRoute("/api/bcdp/spaces");
|
|
707
|
+
const TRACKING_ROUTE = bcdpRoute("/api/bcdp/tracking");
|
|
708
|
+
const SWITCH_TAB_ROUTE = bcdpRoute("/api/bcdp/switch-tab");
|
|
709
|
+
const EGO_CLOSE_ROUTE = bcdpRoute("/api/bcdp/close");
|
|
710
|
+
const WATCH_START_ROUTE = bcdpRoute("/api/bcdp/watch/start");
|
|
711
|
+
const WATCH_SWITCH_ROUTE = bcdpRoute("/api/bcdp/watch/switch");
|
|
712
|
+
const WATCH_STOP_ROUTE = bcdpRoute("/api/bcdp/watch/stop");
|
|
713
|
+
const WATCH_STATUS_ROUTE = bcdpRoute("/api/bcdp/watch/status");
|
|
714
|
+
const VIDEO_ROUTE = bcdpRoute("/api/bcdp/video");
|
|
715
|
+
const CLI_FRAME_ROUTE = bcdpRoute("/api/bcdp/cli-frame");
|
|
700
716
|
const CLI_FRAME_TARGET_ID = "__cli_frame__";
|
|
701
717
|
function postJson(path, body) {
|
|
702
718
|
return fetch(path, {
|
|
@@ -2931,16 +2947,16 @@ function mountFloatingWatch(ctx) {
|
|
|
2931
2947
|
const captchaEl = panel.querySelector("#dsh-ego-captcha");
|
|
2932
2948
|
const captchaKindEl = panel.querySelector("#dsh-ego-captcha-kind");
|
|
2933
2949
|
const captchaHintEl = panel.querySelector("#dsh-ego-captcha-hint");
|
|
2934
|
-
const FLUSH_ROUTE$1 = "/api/bcdp/flush";
|
|
2935
|
-
const SYNC_ROUTE = "/api/bcdp/sync";
|
|
2936
|
-
const CAPTURE_ROUTE = "/api/bcdp/capture";
|
|
2950
|
+
const FLUSH_ROUTE$1 = bcdpRoute("/api/bcdp/flush");
|
|
2951
|
+
const SYNC_ROUTE = bcdpRoute("/api/bcdp/sync");
|
|
2952
|
+
const CAPTURE_ROUTE = bcdpRoute("/api/bcdp/capture");
|
|
2937
2953
|
const captureTab = (targetId) => fetch(CAPTURE_ROUTE, {
|
|
2938
2954
|
method: "POST",
|
|
2939
2955
|
headers: { "content-type": "application/json" },
|
|
2940
2956
|
cache: "no-store",
|
|
2941
2957
|
body: JSON.stringify({ targetId })
|
|
2942
2958
|
}).catch(() => null);
|
|
2943
|
-
|
|
2959
|
+
fetchBcdp("/api/bcdp/hello", {
|
|
2944
2960
|
method: "POST",
|
|
2945
2961
|
headers: { "content-type": "application/json" },
|
|
2946
2962
|
cache: "no-store",
|
|
@@ -3163,7 +3179,7 @@ function mountFloatingWatch(ctx) {
|
|
|
3163
3179
|
watchStopTimer = window.setTimeout(stop, 1500);
|
|
3164
3180
|
}
|
|
3165
3181
|
};
|
|
3166
|
-
const INPUT_ROUTE$1 = "/api/bcdp/input";
|
|
3182
|
+
const INPUT_ROUTE$1 = bcdpRoute("/api/bcdp/input");
|
|
3167
3183
|
let inputBusy = false;
|
|
3168
3184
|
/**
|
|
3169
3185
|
* Send a pointer/wheel intention to the agent browser. Coordinates
|
|
@@ -3661,7 +3677,7 @@ function mountFloatingWatch(ctx) {
|
|
|
3661
3677
|
raiseBtn.title = wt("raiseWindowHint");
|
|
3662
3678
|
raiseBtn.textContent = wt("raiseWindow");
|
|
3663
3679
|
raiseBtn.addEventListener("click", () => {
|
|
3664
|
-
|
|
3680
|
+
fetchBcdp("/api/bcdp/raise", {
|
|
3665
3681
|
method: "POST",
|
|
3666
3682
|
headers: { "content-type": "application/json" },
|
|
3667
3683
|
body: "{}"
|
|
@@ -3878,7 +3894,7 @@ function mountFloatingWatch(ctx) {
|
|
|
3878
3894
|
if (sse) sse.close();
|
|
3879
3895
|
} catch {}
|
|
3880
3896
|
doConnected = false;
|
|
3881
|
-
sse = new EventSource("/api/bcdp/stream");
|
|
3897
|
+
sse = new EventSource(bcdpRoute("/api/bcdp/stream"));
|
|
3882
3898
|
sse.onopen = () => {
|
|
3883
3899
|
doConnected = true;
|
|
3884
3900
|
};
|
|
@@ -4186,10 +4202,10 @@ function mountFloatingWatch(ctx) {
|
|
|
4186
4202
|
style.remove();
|
|
4187
4203
|
};
|
|
4188
4204
|
}
|
|
4189
|
-
var INPUT_ROUTE = "/api/bcdp/input";
|
|
4190
|
-
var FLUSH_ROUTE = "/api/bcdp/flush";
|
|
4191
|
-
var WINDOW_SIZE_ROUTE = "/api/bcdp/window-size";
|
|
4192
|
-
var PANEL_NAVIGATE_ROUTE = "/api/bcdp/navigate";
|
|
4205
|
+
var INPUT_ROUTE = bcdpRoute("/api/bcdp/input");
|
|
4206
|
+
var FLUSH_ROUTE = bcdpRoute("/api/bcdp/flush");
|
|
4207
|
+
var WINDOW_SIZE_ROUTE = bcdpRoute("/api/bcdp/window-size");
|
|
4208
|
+
var PANEL_NAVIGATE_ROUTE = bcdpRoute("/api/bcdp/navigate");
|
|
4193
4209
|
var FRAME_FOLLOW_MIN_MS = 350;
|
|
4194
4210
|
var SIZE_SYNC_KEY = "dsh-browser-cdp:size-sync";
|
|
4195
4211
|
function sizeSyncStored() {
|
|
@@ -5190,7 +5206,7 @@ function createPickControl(onState, deliver) {
|
|
|
5190
5206
|
function post(enabledNow, targetId) {
|
|
5191
5207
|
var body = { enabled: enabledNow };
|
|
5192
5208
|
if (targetId) body.targetId = targetId;
|
|
5193
|
-
return
|
|
5209
|
+
return fetchBcdp("/api/bcdp/pick", {
|
|
5194
5210
|
method: "POST",
|
|
5195
5211
|
headers: { "content-type": "application/json" },
|
|
5196
5212
|
body: JSON.stringify(body)
|
|
@@ -5225,7 +5241,7 @@ function createPickControl(onState, deliver) {
|
|
|
5225
5241
|
}
|
|
5226
5242
|
function pollOnce() {
|
|
5227
5243
|
if (request) return;
|
|
5228
|
-
request =
|
|
5244
|
+
request = fetchBcdp("/api/bcdp/pick").then(function(r) {
|
|
5229
5245
|
return r.json().catch(function() {
|
|
5230
5246
|
return null;
|
|
5231
5247
|
});
|
|
@@ -5271,7 +5287,7 @@ function createPickControl(onState, deliver) {
|
|
|
5271
5287
|
}
|
|
5272
5288
|
function clickAt(x, y, targetId) {
|
|
5273
5289
|
if (!enabled || !targetId) return;
|
|
5274
|
-
|
|
5290
|
+
fetchBcdp("/api/bcdp/pick/click", {
|
|
5275
5291
|
method: "POST",
|
|
5276
5292
|
headers: { "content-type": "application/json" },
|
|
5277
5293
|
body: JSON.stringify({
|
|
@@ -5773,7 +5789,7 @@ LivePreviewController.prototype.openStream = function() {
|
|
|
5773
5789
|
self._applyCaptureStatus(status);
|
|
5774
5790
|
}).catch(function() {});
|
|
5775
5791
|
try {
|
|
5776
|
-
this.sse = new EventSource("/api/bcdp/stream");
|
|
5792
|
+
this.sse = new EventSource(bcdpRoute("/api/bcdp/stream"));
|
|
5777
5793
|
} catch (e) {
|
|
5778
5794
|
return;
|
|
5779
5795
|
}
|
|
@@ -6566,7 +6582,7 @@ function EgoBrowserTab(props) {
|
|
|
6566
6582
|
type: "button",
|
|
6567
6583
|
title: wt("raiseWindowHint"),
|
|
6568
6584
|
onClick: function() {
|
|
6569
|
-
|
|
6585
|
+
fetchBcdp("/api/bcdp/raise", {
|
|
6570
6586
|
method: "POST",
|
|
6571
6587
|
headers: { "content-type": "application/json" },
|
|
6572
6588
|
body: "{}"
|
|
@@ -6727,7 +6743,7 @@ function mountSidebarTab(ctx, betterSidebar) {
|
|
|
6727
6743
|
})();
|
|
6728
6744
|
var probeSse = null;
|
|
6729
6745
|
try {
|
|
6730
|
-
probeSse = new EventSource("/api/bcdp/stream");
|
|
6746
|
+
probeSse = new EventSource(bcdpRoute("/api/bcdp/stream"));
|
|
6731
6747
|
} catch (e) {}
|
|
6732
6748
|
if (probeSse) probeSse.addEventListener("tool-call", function(ev) {
|
|
6733
6749
|
if (probeDisposed) return;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-browser-cdp",
|
|
3
|
-
"version": "1.14.
|
|
3
|
+
"version": "1.14.8",
|
|
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",
|