@linxin666/dsh-client-ui-browser-view 0.4.13 → 0.4.15

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/README.i18n.yaml CHANGED
@@ -2,5 +2,5 @@
2
2
  # side as of the last confirmed-consistent state. Both languages carry equal authority;
3
3
  # after editing either side, bring the other along and re-record with:
4
4
  # node scripts/verify-docs.mjs --write <dir>
5
- README.md: 05c643ca20b625e7de60d588b4636fc5e70085de
6
- README.zh.md: f3df98db595489fa60b41ced8a2e37299b74b259
5
+ README.md: 42e7f1f349287028ff2863826334597c5458344a
6
+ README.zh.md: afbd9e2b3b9a089f53564e10372c71bd080efa19
package/README.md CHANGED
@@ -3,7 +3,7 @@
3
3
  English | [中文](README.zh.md)
4
4
 
5
5
  <p align="center">
6
- <img src="https://img.shields.io/badge/DSH-%3E%3D0.2.1--rc.3-4c6ef5?style=flat-square&amp;labelColor=454a54" alt="DSH">
6
+ <img src="https://img.shields.io/badge/DSH-%3E%3D0.2.2--rc.1-4c6ef5?style=flat-square&amp;labelColor=454a54" alt="DSH">
7
7
  &nbsp;
8
8
  <img src="https://img.shields.io/badge/license-BSD--3--Clause-blue?style=flat-square" alt="License">
9
9
  </p>
@@ -32,6 +32,15 @@ agent tool call ──► host half ──► CDP ──► its own Chromium, or
32
32
 
33
33
  In the default isolated mode the host half starts Chrome lazily on the first tool call, pins a viewport, and keeps a ring of console entries and network requests per tab so a verification can be read back without re-running the page. In CDP mode a tab listing or a panel attach opens the same kind of session against the configured endpoint and starts no process of its own. A top-level document replacement clears both rings; a same-document navigation (hash, query, SPA pushState) keeps them.
34
34
 
35
+ ## Screenshot fidelity
36
+
37
+ `browser_screenshot` captures a lossless PNG by default: a screenshot is usually looked at more than once, and annotation, thin borders and small labels stay legible instead of turning into JPEG ringing. `format` switches to `jpeg` when a smaller result matters more than exact pixels.
38
+
39
+ - **Capture a region, not the page**: `clip` takes `{ x, y, width, height }` in CSS pixels, the same coordinate space as a `browser_snapshot` box and the `x`/`y` of `browser_click`. A clipped capture is rendered at 2x unless `scale` says otherwise.
40
+ - **`scale` is 1, 2 or 3**: an explicit value always wins over the clip default.
41
+ - **Why the extra pixels**: on the model side one visual token cell covers roughly 42x42 px of the image, so a whole-viewport capture is already coarse. To read detail, take the box from `browser_snapshot` and capture only that region; at 2x the same element occupies several times the tokens it did in the full frame.
42
+ - **Out of bounds fails loudly**: a `clip` that leaves the pinned viewport (isolated mode, 1280x800) or the tab's real layout viewport (real-browser mode), or an encoded image over the host's attachment budget, is an error naming the reason. No image comes back for a region that was never rendered.
43
+
35
44
  ## Interface seats
36
45
 
37
46
  | Seat | Kind | What lands there |
@@ -91,6 +100,7 @@ Sign in to the sites the agent should see inside that profile once; the plugin d
91
100
  - The token top-up only covers the site root, because DSH answers the challenge with a 303 to `./` for `GET /` alone.
92
101
  - One browser per host; tabs are isolated CDP targets, not separate profiles.
93
102
  - Chrome must be installed at a standard location (or named by `CHROME_PATH`) for the isolated mode, which is the only mode that launches a browser.
103
+ - In the default isolated mode the viewport is pinned at 1280x800, so a `clip` must fall inside it: a region outside it is refused rather than scrolled into place. In real-browser mode the bound is the tab's own layout viewport.
94
104
 
95
105
  ## Install
96
106
 
package/README.zh.md CHANGED
@@ -3,7 +3,7 @@
3
3
  [English](README.md) | 中文
4
4
 
5
5
  <p align="center">
6
- <img src="https://img.shields.io/badge/DSH-%3E%3D0.2.1--rc.3-4c6ef5?style=flat-square&amp;labelColor=454a54" alt="DSH">
6
+ <img src="https://img.shields.io/badge/DSH-%3E%3D0.2.2--rc.1-4c6ef5?style=flat-square&amp;labelColor=454a54" alt="DSH">
7
7
  &nbsp;
8
8
  <img src="https://img.shields.io/badge/license-BSD--3--Clause-blue?style=flat-square" alt="License">
9
9
  </p>
@@ -32,6 +32,15 @@ agent 工具调用 ──► 宿主半区 ──► CDP ──► 它自己的 C
32
32
 
33
33
  默认的隔离模式下,宿主半区在第一次工具调用时才懒启动 Chrome,钉住视口尺寸,并按标签页保留控制台与网络请求的环形记录,因此一次验证不必重跑页面就能回读。接管模式下,列出标签页或挂载面板会对着配置的端点开同样形态的会话,自己不启动任何进程。顶层文档被替换时两份记录都会清空;同文档导航(hash、query、SPA pushState)则保留。
34
34
 
35
+ ## 截图保真
36
+
37
+ `browser_screenshot` 默认截无损 PNG:截图往往要被再看一遍,标注、细边框与小字号标签保持清晰,不会糊成 JPEG 的振铃。体积比像素更重要时用 `format` 切到 `jpeg`。
38
+
39
+ - **截一块,而不是整页**:`clip` 收 `{ x, y, width, height }`(CSS 像素),与 `browser_snapshot` 的 box、`browser_click` 的 `x`/`y` 是同一坐标系。带 clip 时默认按 2 倍渲染,`scale` 可以改。
40
+ - **`scale` 只取 1、2、3**:显式给出的值总是优先于 clip 的默认值。
41
+ - **为什么要这些额外像素**:模型侧一个视觉 token 格大致覆盖 42x42 像素,整屏截图本来就偏粗。要看细节,先从 `browser_snapshot` 取 box,再只截那一块;2 倍下同一个元素占用的 token 是整屏里的数倍。
42
+ - **越界会明确报错**:`clip` 落到被钉住的视口(隔离模式,1280x800)或标签页真实视口(接管模式)之外,或编码后超出宿主的附件体积预算,都会作为错误报出原因。没有渲染出来的区域不会返回图片。
43
+
35
44
  ## 界面席位
36
45
 
37
46
  | 席位 | 类型 | 放什么 |
@@ -91,6 +100,7 @@ agent 工具调用 ──► 宿主半区 ──► CDP ──► 它自己的 C
91
100
  - 补票只覆盖站点根地址,因为 DSH 只在 `GET /` 时以 303 回应鉴权提示。
92
101
  - 一个宿主一个浏览器;标签页是相互隔离的 CDP target,不是独立 profile。
93
102
  - 隔离模式需要 Chrome 装在标准位置(或用 `CHROME_PATH` 指定);它也是唯一会拉起浏览器的模式。
103
+ - 默认的隔离模式下视口被钉在 1280x800,因此 `clip` 必须落在视口内;视口外的区域直接报错,而不是滚过去再截。接管模式下边界是该标签页自己的布局视口。
94
104
 
95
105
  ## 安装
96
106
 
package/lib/client.js CHANGED
@@ -2578,9 +2578,9 @@ window.__ModuleLoader__.load({
2578
2578
  }
2579
2579
  };
2580
2580
  if (typeof ctx.on === "function") try {
2581
- ctx.on("slots/changed", () => {
2581
+ ctx.on("slots/changed", (() => {
2582
2582
  reconcile();
2583
- });
2583
+ }));
2584
2584
  } catch {}
2585
2585
  reconcile();
2586
2586
  }