@mengruo/dsh-vision-toolkit 0.0.1
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/LICENSE +21 -0
- package/README.i18n.yaml +6 -0
- package/README.md +356 -0
- package/README.zh.md +354 -0
- package/assets/community-group-qr.png +0 -0
- package/assets/dsh-conversation-artifact.png +0 -0
- package/assets/dsh-conversation-image-qa-top.png +0 -0
- package/assets/dsh-conversation-image-qa.png +0 -0
- package/assets/dsh-conversation-pixel-diff.png +0 -0
- package/assets/dsh-conversation-screenshot-debugging-top.png +0 -0
- package/assets/dsh-conversation-screenshot-debugging.png +0 -0
- package/assets/dsh-conversation-tool-call.png +0 -0
- package/assets/dsh-conversation-vision-trace.png +0 -0
- package/assets/dsh-view-example.png +0 -0
- package/assets/hero-v2.png +0 -0
- package/assets/logo_aihubmix.png +0 -0
- package/assets/python-bootstrap.json +48 -0
- package/assets/skill/SKILL.md +329 -0
- package/assets/skill/UPSTREAM.json +71 -0
- package/assets/skill/references/gui.md +88 -0
- package/assets/skill/references/long-screenshot-ocr.md +77 -0
- package/assets/skill/references/restore-graphic.md +84 -0
- package/assets/skill/references/restore-structure.md +45 -0
- package/assets/skill/references/restore-ui.md +202 -0
- package/assets/social-preview.png +0 -0
- package/assets/upstream/README.md +18 -0
- package/assets/upstream/focus-hint-comparison-1.webp +0 -0
- package/assets/upstream/focus-hint-comparison-2.webp +0 -0
- package/assets/upstream/infographic-reference.webp +0 -0
- package/assets/upstream/infographic-result.webp +0 -0
- package/assets/upstream/ui-fast-restore-reference.webp +0 -0
- package/assets/upstream/ui-fast-restore-result.webp +0 -0
- package/assets/upstream/ui-result.webp +0 -0
- package/assets/upstream/ui-sketch.webp +0 -0
- package/assets/vision-model-test.png +0 -0
- package/assets/vision-settings.png +0 -0
- package/assets/wechat-reward.png +0 -0
- package/cordis.patch.yml +6 -0
- package/docs/aihubmix-gemini-vision.i18n.yaml +6 -0
- package/docs/aihubmix-gemini-vision.md +138 -0
- package/docs/aihubmix-gemini-vision.zh.md +138 -0
- package/docs/assets/aihubmix-api-keys.png +0 -0
- package/docs/assets/aihubmix-create-key.png +0 -0
- package/docs/assets/aihubmix-free-vision-model.png +0 -0
- package/docs/assets/aihubmix-home.png +0 -0
- package/docs/assets/aihubmix-sign-up.png +0 -0
- package/docs/assets/groq-console-home.png +0 -0
- package/docs/assets/groq-console-keys-login.png +0 -0
- package/docs/assets/groq-docs-quickstart.png +0 -0
- package/docs/assets/groq-docs-qwen3.6.png +0 -0
- package/docs/assets/groq-docs-vision.png +0 -0
- package/docs/assets/vision-settings.png +0 -0
- package/docs/dsh-desktop-install.md +67 -0
- package/docs/dsh-desktop-install.zh.md +67 -0
- package/docs/groq-qwen3.6-vision.i18n.yaml +6 -0
- package/docs/groq-qwen3.6-vision.md +236 -0
- package/docs/groq-qwen3.6-vision.zh.md +236 -0
- package/docs/python-runtime.i18n.yaml +6 -0
- package/docs/python-runtime.md +89 -0
- package/docs/python-runtime.zh.md +89 -0
- package/docs/requirements-traceability/README.i18n.yaml +6 -0
- package/docs/requirements-traceability/README.md +75 -0
- package/docs/requirements-traceability/README.zh.md +75 -0
- package/examples/ui-restoration/README.i18n.yaml +6 -0
- package/examples/ui-restoration/README.md +70 -0
- package/examples/ui-restoration/README.zh.md +70 -0
- package/examples/ui-restoration/assets/final-heatmap.png +0 -0
- package/examples/ui-restoration/assets/final-report.json +83 -0
- package/examples/ui-restoration/assets/implementation.png +0 -0
- package/examples/ui-restoration/assets/initial-heatmap.png +0 -0
- package/examples/ui-restoration/assets/initial-report.json +83 -0
- package/examples/ui-restoration/assets/initial.png +0 -0
- package/examples/ui-restoration/assets/metrics.json +12 -0
- package/examples/ui-restoration/assets/reference.png +0 -0
- package/examples/ui-restoration/implementation.html +94 -0
- package/examples/ui-restoration/initial.html +57 -0
- package/lib/artifact-access.js +369 -0
- package/lib/artifact-access.js.map +1 -0
- package/lib/artifacts.js +56 -0
- package/lib/artifacts.js.map +1 -0
- package/lib/client.js +2099 -0
- package/lib/client.js.map +1 -0
- package/lib/config.js +172 -0
- package/lib/config.js.map +1 -0
- package/lib/defaults.js +6 -0
- package/lib/defaults.js.map +1 -0
- package/lib/errors.js +56 -0
- package/lib/errors.js.map +1 -0
- package/lib/evidence-cache.js +350 -0
- package/lib/evidence-cache.js.map +1 -0
- package/lib/exposure.js +247 -0
- package/lib/exposure.js.map +1 -0
- package/lib/image-input-variants.js +882 -0
- package/lib/image-input-variants.js.map +1 -0
- package/lib/index.js +105 -0
- package/lib/index.js.map +1 -0
- package/lib/paste-images.js +217 -0
- package/lib/paste-images.js.map +1 -0
- package/lib/paths.js +354 -0
- package/lib/paths.js.map +1 -0
- package/lib/plugin-update.js +1003 -0
- package/lib/plugin-update.js.map +1 -0
- package/lib/runtime-install.js +964 -0
- package/lib/runtime-install.js.map +1 -0
- package/lib/runtime-manager.js +133 -0
- package/lib/runtime-manager.js.map +1 -0
- package/lib/runtime.js +1678 -0
- package/lib/runtime.js.map +1 -0
- package/lib/skill.js +25 -0
- package/lib/skill.js.map +1 -0
- package/lib/tools.js +549 -0
- package/lib/tools.js.map +1 -0
- package/lib/types/artifact-access.d.ts +61 -0
- package/lib/types/artifact-access.d.ts.map +1 -0
- package/lib/types/artifacts.d.ts +42 -0
- package/lib/types/artifacts.d.ts.map +1 -0
- package/lib/types/client/display-config.d.ts +24 -0
- package/lib/types/client/display-config.d.ts.map +1 -0
- package/lib/types/client/index.d.ts +350 -0
- package/lib/types/client/index.d.ts.map +1 -0
- package/lib/types/client/model-variants-hider.d.ts +40 -0
- package/lib/types/client/model-variants-hider.d.ts.map +1 -0
- package/lib/types/client/paste-images.d.ts +126 -0
- package/lib/types/client/paste-images.d.ts.map +1 -0
- package/lib/types/config.d.ts +123 -0
- package/lib/types/config.d.ts.map +1 -0
- package/lib/types/defaults.d.ts +6 -0
- package/lib/types/defaults.d.ts.map +1 -0
- package/lib/types/errors.d.ts +35 -0
- package/lib/types/errors.d.ts.map +1 -0
- package/lib/types/evidence-cache.d.ts +91 -0
- package/lib/types/evidence-cache.d.ts.map +1 -0
- package/lib/types/exposure.d.ts +50 -0
- package/lib/types/exposure.d.ts.map +1 -0
- package/lib/types/image-input-variants.d.ts +144 -0
- package/lib/types/image-input-variants.d.ts.map +1 -0
- package/lib/types/index.d.ts +19 -0
- package/lib/types/index.d.ts.map +1 -0
- package/lib/types/paste-images.d.ts +73 -0
- package/lib/types/paste-images.d.ts.map +1 -0
- package/lib/types/paths.d.ts +117 -0
- package/lib/types/paths.d.ts.map +1 -0
- package/lib/types/plugin-update.d.ts +119 -0
- package/lib/types/plugin-update.d.ts.map +1 -0
- package/lib/types/runtime-install.d.ts +92 -0
- package/lib/types/runtime-install.d.ts.map +1 -0
- package/lib/types/runtime-manager.d.ts +60 -0
- package/lib/types/runtime-manager.d.ts.map +1 -0
- package/lib/types/runtime.d.ts +412 -0
- package/lib/types/runtime.d.ts.map +1 -0
- package/lib/types/skill.d.ts +14 -0
- package/lib/types/skill.d.ts.map +1 -0
- package/lib/types/tools.d.ts +35 -0
- package/lib/types/tools.d.ts.map +1 -0
- package/lib/types/upstream.d.ts +233 -0
- package/lib/types/upstream.d.ts.map +1 -0
- package/lib/types/version.d.ts +15 -0
- package/lib/types/version.d.ts.map +1 -0
- package/lib/types/web-request.d.ts +11 -0
- package/lib/types/web-request.d.ts.map +1 -0
- package/lib/types/web.d.ts +118 -0
- package/lib/types/web.d.ts.map +1 -0
- package/lib/upstream.js +860 -0
- package/lib/upstream.js.map +1 -0
- package/lib/version.js +18 -0
- package/lib/version.js.map +1 -0
- package/lib/web-request.js +29 -0
- package/lib/web-request.js.map +1 -0
- package/lib/web.js +462 -0
- package/lib/web.js.map +1 -0
- package/package.json +149 -0
- package/patches/vision-tools-dsh.patch +970 -0
- package/runtime/requirements.lock +3 -0
- package/src/artifact-access.ts +386 -0
- package/src/artifacts.ts +85 -0
- package/src/client/display-config.ts +62 -0
- package/src/client/index.tsx +1580 -0
- package/src/client/model-variants-hider.ts +159 -0
- package/src/client/paste-images.tsx +747 -0
- package/src/config.ts +290 -0
- package/src/defaults.ts +5 -0
- package/src/errors.ts +62 -0
- package/src/evidence-cache.ts +418 -0
- package/src/exposure.ts +265 -0
- package/src/image-input-variants.ts +996 -0
- package/src/index.ts +141 -0
- package/src/paste-images.ts +286 -0
- package/src/paths.ts +383 -0
- package/src/plugin-update.ts +1143 -0
- package/src/runtime-install.ts +1161 -0
- package/src/runtime-manager.ts +174 -0
- package/src/runtime.ts +2189 -0
- package/src/skill.ts +35 -0
- package/src/tools.ts +691 -0
- package/src/upstream.ts +1078 -0
- package/src/version.ts +37 -0
- package/src/web-request.ts +27 -0
- package/src/web.ts +594 -0
- package/vendor/agent-vision-toolkit/CHANGELOG.md +30 -0
- package/vendor/agent-vision-toolkit/LICENSE +21 -0
- package/vendor/agent-vision-toolkit/README.md +405 -0
- package/vendor/agent-vision-toolkit/UPSTREAM_MANIFEST.json +94 -0
- package/vendor/agent-vision-toolkit/bin/crop +90 -0
- package/vendor/agent-vision-toolkit/bin/detect +13 -0
- package/vendor/agent-vision-toolkit/bin/glance +93 -0
- package/vendor/agent-vision-toolkit/bin/ground +13 -0
- package/vendor/agent-vision-toolkit/bin/trace +129 -0
- package/vendor/agent-vision-toolkit/detect.py +60 -0
- package/vendor/agent-vision-toolkit/ground.py +267 -0
- package/vendor/agent-vision-toolkit/skills/vision-tools/scripts/dominant_colors.py +224 -0
- package/vendor/agent-vision-toolkit/skills/vision-tools/scripts/extract_fg.py +278 -0
- package/vendor/agent-vision-toolkit/skills/vision-tools/scripts/html_shot.py +420 -0
- package/vendor/agent-vision-toolkit/skills/vision-tools/scripts/long_screenshot_ocr.py +1245 -0
- package/vendor/agent-vision-toolkit/skills/vision-tools/scripts/pixel_diff.py +88 -0
- package/vendor/agent-vision-toolkit/tests/test_vision_client.py +450 -0
- package/vendor/agent-vision-toolkit/vision_client.py +310 -0
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
# Configure the Python runtime
|
|
2
|
+
|
|
3
|
+
By default the plugin picks a system Python 3.11+, or downloads a standalone Python from the domestic mirror (`dsh-vision-python-bootstrap-1317715800.cos.ap-guangzhou.myqcloud.com`) when none is found, falling back to the GitHub release when the mirror is unreachable; most users never need to configure this section. The rest is for advanced setups where automatic discovery fails, a specific interpreter is required, or an external runtime is used.
|
|
4
|
+
|
|
5
|
+
The packaged `managed` runtime creates its own isolated virtual environment. `runtime.python` selects the Python executable used to bootstrap or refresh that environment; it does not replace the managed environment with the interpreter's global site-packages. Set it when automatic discovery fails or when several Python installations exist. The override is also used by `runtime.mode: external`.
|
|
6
|
+
|
|
7
|
+
Python 3.11 or newer is required; the automatically downloaded standalone Python is 3.13.15 and, like a system interpreter, is only used to bootstrap the isolated environment. Without an override, the plugin tries `python3` then `python` on macOS/Linux, and `python`, `py -3`, then `python3` on Windows, before falling back to the domestic-mirror standalone download (GitHub release as a secondary fallback). A configured value is passed as one executable name or path, not as a shell command with arguments, so use `py` (not `py -3`) for the Windows launcher; use an absolute path when you need a specific version.
|
|
8
|
+
|
|
9
|
+
Configure it in the Profile patch:
|
|
10
|
+
|
|
11
|
+
```yaml
|
|
12
|
+
- id: vision-toolkit
|
|
13
|
+
config:
|
|
14
|
+
runtime:
|
|
15
|
+
# macOS/Linux system Python
|
|
16
|
+
python: python3
|
|
17
|
+
# Or a project-local environment:
|
|
18
|
+
# python: /absolute/path/to/project/.venv/bin/python
|
|
19
|
+
# Windows venv (forward slashes also work in YAML):
|
|
20
|
+
# python: C:/Users/you/project/.venv/Scripts/python.exe
|
|
21
|
+
# Windows launcher, when its default Python is 3.11+:
|
|
22
|
+
# python: py
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
For a managed runtime, create the project-local interpreter and point `runtime.python` at it. The plugin installs the locked dependencies into its own managed cache (Tencent Cloud PyPI mirror first, official PyPI as fallback), so installing the lockfile into this bootstrap environment is optional:
|
|
26
|
+
|
|
27
|
+
```sh
|
|
28
|
+
python3 --version # must report 3.11 or newer
|
|
29
|
+
uv venv .venv --python 3.13
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
For `runtime.mode: external`, install the locked dependencies using the `runtime/requirements.lock` from the **DSH Vision Toolkit plugin** checkout, then point `runtime.agentVisionToolkitPath` at a separate exact `agent-vision-toolkit` snapshot. The packaged `vendor/agent-vision-toolkit` directory is such a snapshot when it has not been modified:
|
|
33
|
+
|
|
34
|
+
```sh
|
|
35
|
+
uv pip install --python .venv/bin/python \
|
|
36
|
+
-r /absolute/path/to/dsh-vision-toolkit/runtime/requirements.lock
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
```yaml
|
|
40
|
+
- id: vision-toolkit
|
|
41
|
+
config:
|
|
42
|
+
runtime:
|
|
43
|
+
mode: external
|
|
44
|
+
python: /absolute/path/to/dsh-vision-toolkit/.venv/bin/python
|
|
45
|
+
agentVisionToolkitPath: /absolute/path/to/dsh-vision-toolkit/vendor/agent-vision-toolkit
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
On Windows, use `py -3 --version` for the version check and `.venv\Scripts\python.exe` plus `runtime\requirements.lock` in the corresponding commands:
|
|
49
|
+
|
|
50
|
+
```powershell
|
|
51
|
+
py -3 --version # must report 3.11 or newer
|
|
52
|
+
uv venv .venv --python 3.13
|
|
53
|
+
# External mode only; use the plugin checkout's absolute lockfile path:
|
|
54
|
+
uv pip install --python .venv\Scripts\python.exe -r C:\absolute\path\to\dsh-vision-toolkit\runtime\requirements.lock
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
Point `runtime.python` at the same interpreter, save the Profile patch, and restart the Web Profile. Then open **Settings → Vision Toolkit**: the Runtime panel should show the resolved interpreter and Python version, and **Run health check** plus **Test vision model** should complete without the Python-version error. A final smoke test is to place a PNG/JPEG in the session workspace and call `vision_glance`.
|
|
58
|
+
|
|
59
|
+
## Updating the standalone Python mirror
|
|
60
|
+
|
|
61
|
+
The standalone Python is pinned in `assets/python-bootstrap.json` and mirrored at `https://dsh-vision-python-bootstrap-1317715800.cos.ap-guangzhou.myqcloud.com` (Tencent Cloud COS, `ap-guangzhou`). When upgrading the Python build, sync the mirror with:
|
|
62
|
+
|
|
63
|
+
```sh
|
|
64
|
+
node scripts/python-bootstrap.mjs --write # fetch the latest GitHub release manifest
|
|
65
|
+
node scripts/python-bootstrap-mirror.mjs # download and sha256-verify every platform archive
|
|
66
|
+
# run the coscmd publish command printed by the script to push .python-bootstrap-dist/<buildTag>/
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
After pushing, verify each mirror URL returns `206`/`200` and that `Content-Length` matches the `size` field in the manifest.
|
|
70
|
+
|
|
71
|
+
The mirror bucket is public-read; archives live at `https://dsh-vision-python-bootstrap-1317715800.cos.ap-guangzhou.myqcloud.com/<buildTag>/`.
|
|
72
|
+
|
|
73
|
+
## Allowed input directories
|
|
74
|
+
|
|
75
|
+
The path fence automatically allows the session workspace and the platform temporary directory. On macOS/Linux the temporary root is `/tmp`. On Windows it is `TEMP`, then `TMP`, with the operating-system fallback if neither is set; model-generated `/tmp/...` paths are translated to that Windows directory before the normal realpath fence runs. No `allowedDirs` entry is needed for these platform temporary paths.
|
|
76
|
+
|
|
77
|
+
Use `allowedDirs` only for additional trusted input roots outside the workspace and platform temporary directory:
|
|
78
|
+
|
|
79
|
+
```yaml
|
|
80
|
+
- id: vision-toolkit
|
|
81
|
+
config:
|
|
82
|
+
allowedDirs:
|
|
83
|
+
# macOS/Linux example
|
|
84
|
+
- /srv/vision-inputs
|
|
85
|
+
# Windows example (use this instead on Windows)
|
|
86
|
+
# - D:/vision-inputs
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
`allowedDirs` is an input allowlist, not the managed runtime cache. The managed runtime keeps its own files under `$DSH_HOME/cache/dsh-vision-toolkit` (or `~/.dsh/cache/dsh-vision-toolkit` when `DSH_HOME` is unset); that directory does not need to be added. Environment-variable forms such as `$env:TEMP` and `%TEMP%` are not expanded inside `allowedDirs`, so configure extra roots with real absolute paths.
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
# 配置 Python 运行时
|
|
2
|
+
|
|
3
|
+
默认情况下插件会自动选择系统 Python 3.11+,找不到时从国内镜像(`dsh-vision-python-bootstrap-1317715800.cos.ap-guangzhou.myqcloud.com`)下载托管 Python,镜像不可用时自动回退到 GitHub 官方发布源,普通用户无需配置本节。以下内容供自动发现失败、需要固定版本或使用外部运行时的高级场景参考。
|
|
4
|
+
|
|
5
|
+
打包的 `managed` 运行时会创建自己的隔离虚拟环境。`runtime.python` 指定的是引导或刷新该环境时使用的 Python 解释器,并不会把 managed 运行时替换成系统解释器的全局 site-packages。当自动发现失败或机器上有多个 Python 时,应设置这个选项;`runtime.mode: external` 也使用该覆盖值。
|
|
6
|
+
|
|
7
|
+
要求 Python 3.11 或更高版本;自动下载的托管 Python 为 3.13.15,与系统 Python 一样只用于引导隔离环境。不设置覆盖值时,插件在 macOS/Linux 上依次尝试 `python3`、`python`,在 Windows 上依次尝试 `python`、`py -3`、`python3`,全部不可用时会自动从国内镜像下载托管 Python,镜像不可用时回退到 GitHub 官方发布源。手动配置的值会作为一个可执行文件名或路径传入,而不是作为带参数的 Shell 命令,因此 Windows 启动器应填写 `py`(不要填写 `py -3`);需要固定版本时,请填写绝对路径。
|
|
8
|
+
|
|
9
|
+
在 Profile patch 中配置:
|
|
10
|
+
|
|
11
|
+
```yaml
|
|
12
|
+
- id: vision-toolkit
|
|
13
|
+
config:
|
|
14
|
+
runtime:
|
|
15
|
+
# macOS/Linux 系统 Python
|
|
16
|
+
python: python3
|
|
17
|
+
# 或使用项目内虚拟环境:
|
|
18
|
+
# python: /absolute/path/to/project/.venv/bin/python
|
|
19
|
+
# Windows 虚拟环境(YAML 中也可以使用正斜杠):
|
|
20
|
+
# python: C:/Users/you/project/.venv/Scripts/python.exe
|
|
21
|
+
# Windows 启动器;其默认 Python 必须是 3.11+:
|
|
22
|
+
# python: py
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
对于 managed 运行时,创建项目内解释器并将 `runtime.python` 指向它即可。插件会把锁定依赖安装到自己的 managed 缓存中(优先使用腾讯云 PyPI 镜像,镜像不可用时回退官方 PyPI),因此将 lockfile 安装到这个引导环境是可选的:
|
|
26
|
+
|
|
27
|
+
```sh
|
|
28
|
+
python3 --version # 必须是 3.11 或更高
|
|
29
|
+
uv venv .venv --python 3.13
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
对于 `runtime.mode: external`,请使用 **DSH Vision Toolkit 插件** checkout 中的 `runtime/requirements.lock` 安装锁定依赖,再把 `runtime.agentVisionToolkitPath` 指向另一个准确的 `agent-vision-toolkit` 快照。未被修改的打包目录 `vendor/agent-vision-toolkit` 就是这样的快照:
|
|
33
|
+
|
|
34
|
+
```sh
|
|
35
|
+
uv pip install --python .venv/bin/python \
|
|
36
|
+
-r /absolute/path/to/dsh-vision-toolkit/runtime/requirements.lock
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
```yaml
|
|
40
|
+
- id: vision-toolkit
|
|
41
|
+
config:
|
|
42
|
+
runtime:
|
|
43
|
+
mode: external
|
|
44
|
+
python: /absolute/path/to/dsh-vision-toolkit/.venv/bin/python
|
|
45
|
+
agentVisionToolkitPath: /absolute/path/to/dsh-vision-toolkit/vendor/agent-vision-toolkit
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
Windows 请使用 `py -3 --version` 检查版本,并在对应命令中使用 `.venv\Scripts\python.exe` 和 `runtime\requirements.lock`:
|
|
49
|
+
|
|
50
|
+
```powershell
|
|
51
|
+
py -3 --version # 必须是 3.11 或更高
|
|
52
|
+
uv venv .venv --python 3.13
|
|
53
|
+
# 仅 external 模式需要;请使用插件 checkout 中 lockfile 的绝对路径:
|
|
54
|
+
uv pip install --python .venv\Scripts\python.exe -r C:\absolute\path\to\dsh-vision-toolkit\runtime\requirements.lock
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
把 `runtime.python` 指向同一个解释器,保存 Profile patch 后重启 Web Profile。然后打开 **设置 → 视觉工具**:运行时面板应显示实际使用的解释器和 Python 版本;点击 **运行健康检查** 和 **测试视觉模型**,确认不再出现 Python 版本错误。最后可将一张 PNG/JPEG 放入会话工作区并调用 `vision_glance` 做冒烟测试。
|
|
58
|
+
|
|
59
|
+
## 更新托管 Python 镜像
|
|
60
|
+
|
|
61
|
+
托管 Python 由 `assets/python-bootstrap.json` 固定版本和国内镜像(`https://dsh-vision-python-bootstrap-1317715800.cos.ap-guangzhou.myqcloud.com`,腾讯云 COS `ap-guangzhou`)共同维护。升级 Python 构建后按以下步骤同步镜像:
|
|
62
|
+
|
|
63
|
+
```sh
|
|
64
|
+
node scripts/python-bootstrap.mjs --write # 从 GitHub 拉取最新清单并写回 manifest
|
|
65
|
+
node scripts/python-bootstrap-mirror.mjs # 下载全部平台压缩包并校验 sha256
|
|
66
|
+
# 执行脚本最后打印的 coscmd 发布命令,把 .python-bootstrap-dist/<buildTag>/ 推到 COS 桶
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
推送后逐个验证镜像 URL 返回 `206`/`200` 且 `Content-Length` 与 manifest 中的 `size` 一致。
|
|
70
|
+
|
|
71
|
+
镜像桶为公有读;归档地址为 `https://dsh-vision-python-bootstrap-1317715800.cos.ap-guangzhou.myqcloud.com/<buildTag>/`。
|
|
72
|
+
|
|
73
|
+
## 允许读取的输入目录
|
|
74
|
+
|
|
75
|
+
路径围栏会自动允许会话工作区和平台临时目录。macOS/Linux 的临时目录根路径是 `/tmp`。Windows 依次读取 `TEMP`、`TMP`,两者都未设置时使用操作系统回退值;模型生成的 `/tmp/...` 路径会先映射到该 Windows 临时目录,再执行常规 realpath 路径围栏检查。这些平台临时路径无需加入 `allowedDirs`。
|
|
76
|
+
|
|
77
|
+
只有在需要读取会话工作区和平台临时目录之外的可信输入根目录时,才配置 `allowedDirs`:
|
|
78
|
+
|
|
79
|
+
```yaml
|
|
80
|
+
- id: vision-toolkit
|
|
81
|
+
config:
|
|
82
|
+
allowedDirs:
|
|
83
|
+
# macOS/Linux 示例
|
|
84
|
+
- /srv/vision-inputs
|
|
85
|
+
# Windows 示例(Windows 上改用这一项)
|
|
86
|
+
# - D:/vision-inputs
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
`allowedDirs` 是输入目录白名单,不是 managed 运行时缓存目录。managed 运行时自己的文件位于 `$DSH_HOME/cache/dsh-vision-toolkit`(未设置 `DSH_HOME` 时是 `~/.dsh/cache/dsh-vision-toolkit`),无需加入白名单。`allowedDirs` 内不会展开 `$env:TEMP` 或 `%TEMP%` 这类环境变量,因此额外输入根目录必须填写真实绝对路径。
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
# Bilingual-pair consistency record (docs/i18n/README.md): the git blob hash of each
|
|
2
|
+
# side as of the last confirmed-consistent state. Both languages carry equal authority;
|
|
3
|
+
# after editing either side, bring the other along and re-record with:
|
|
4
|
+
# pnpm run verify-translation-pairing --write dsh-vision-toolkit/docs/requirements-traceability/README.md
|
|
5
|
+
README.md: 5bc9040f66acef30c930203ab0fe6c55cb76773e
|
|
6
|
+
README.zh.md: 53bc1f0cb498e59529ca3f915e6a5649142567ad
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
# Vision Toolkit requirements traceability
|
|
2
|
+
|
|
3
|
+
English | [中文](README.zh.md)
|
|
4
|
+
|
|
5
|
+
This reference maps the DSH Vision Toolkit product brief's committed P0/P1 requirements to their owning implementation, automated coverage, and runnable acceptance evidence. A row marked **Delivered** is part of the package contract; P2/P3 rows document intentional product boundaries rather than unfinished P0/P1 work.
|
|
6
|
+
|
|
7
|
+
## P0 product requirements
|
|
8
|
+
|
|
9
|
+
| Requirement | Status | Owning implementation | Verification |
|
|
10
|
+
|---|---|---|---|
|
|
11
|
+
| P0-1 Standard Profile Bundle | **Delivered** | [`package.json`](../../package.json), [`cordis.patch.yml`](../../cordis.patch.yml), [`src/index.ts`](../../src/index.ts), committed `lib/` | [`tests/package-layout.spec.ts`](../../tests/package-layout.spec.ts), [`tests/profile-install.e2e.spec.ts`](../../tests/profile-install.e2e.spec.ts), clean `--dump-config`, Web/Headless boot, disable, and removal checks |
|
|
12
|
+
| P0-2 Upstream reuse | **Delivered** | [`src/version.ts`](../../src/version.ts), [`src/runtime-install.ts`](../../src/runtime-install.ts), [`scripts/upstream-manifest.mjs`](../../scripts/upstream-manifest.mjs), [`scripts/sync-upstream.mjs`](../../scripts/sync-upstream.mjs), [`vendor/agent-vision-toolkit/UPSTREAM_MANIFEST.json`](../../vendor/agent-vision-toolkit/UPSTREAM_MANIFEST.json) | [`tests/upstream.spec.ts`](../../tests/upstream.spec.ts), [`tests/runtime-install.spec.ts`](../../tests/runtime-install.spec.ts), build-time manifest verification |
|
|
13
|
+
| P0-3 Native tools | **Delivered** | Independent definitions in [`src/tools.ts`](../../src/tools.ts), Agent-scoped publication in [`src/exposure.ts`](../../src/exposure.ts), shared execution in [`src/runtime.ts`](../../src/runtime.ts), upstream adapter in [`src/upstream.ts`](../../src/upstream.ts) | [`tests/tools.spec.ts`](../../tests/tools.spec.ts), [`tests/runtime.spec.ts`](../../tests/runtime.spec.ts), [`tests/upstream.spec.ts`](../../tests/upstream.spec.ts), [`tests/vision-prompt-guard.spec.ts`](../../tests/vision-prompt-guard.spec.ts), real-profile progressive calls for all five P0 tools |
|
|
14
|
+
| P0-4 Configuration and Credentials | **Delivered** | [`src/config.ts`](../../src/config.ts), per-operation resolution in [`src/runtime.ts`](../../src/runtime.ts), isolated environment construction in [`src/upstream.ts`](../../src/upstream.ts) | [`tests/config.spec.ts`](../../tests/config.spec.ts), Credential/error/redaction cases in [`tests/runtime.spec.ts`](../../tests/runtime.spec.ts) and [`tests/errors.spec.ts`](../../tests/errors.spec.ts) |
|
|
15
|
+
| P0-5 Skill lifecycle | **Delivered** | Readiness ordering, lifecycle abort, and global disposer in [`src/index.ts`](../../src/index.ts); per-Agent activation, restoration, and teardown in [`src/exposure.ts`](../../src/exposure.ts); bundled content in [`src/skill.ts`](../../src/skill.ts) | Agent isolation, native/direct/Code Mode activation, Session restoration, in-flight cancellation, and disposal cases in [`tests/tools.spec.ts`](../../tests/tools.spec.ts); progressive exposure plus disable/uninstall paths in [`tests/profile-install.e2e.spec.ts`](../../tests/profile-install.e2e.spec.ts) |
|
|
16
|
+
| P0-6 Text-only model results | **Delivered** | JSON output schemas and pure renderers in [`src/tools.ts`](../../src/tools.ts); canonical Artifact descriptors in [`src/artifacts.ts`](../../src/artifacts.ts); schema visibility derived from durable Skill-load evidence in [`src/exposure.ts`](../../src/exposure.ts) | Tool schema/presentation assertions in [`tests/tools.spec.ts`](../../tests/tools.spec.ts), request-by-request schema and model-facing transcript assertions in [`tests/profile-install.e2e.spec.ts`](../../tests/profile-install.e2e.spec.ts) |
|
|
17
|
+
| P0-7 Stable errors | **Delivered** | [`src/errors.ts`](../../src/errors.ts), boundary validation in [`src/paths.ts`](../../src/paths.ts), [`src/runtime.ts`](../../src/runtime.ts), and [`src/upstream.ts`](../../src/upstream.ts) | [`tests/errors.spec.ts`](../../tests/errors.spec.ts), [`tests/paths.spec.ts`](../../tests/paths.spec.ts), parser, timeout, cancellation, credential, and capacity cases in runtime/upstream tests |
|
|
18
|
+
| P0-8 Tests and documentation | **Delivered** | Bilingual [`README.md`](../../README.md), package tests, managed runtime, example, and committed build output | `pnpm run build`, `pnpm test`, `pnpm pack --dry-run`, translation/Markdown gates, and the keyless clean-profile e2e |
|
|
19
|
+
|
|
20
|
+
## P1 product requirements
|
|
21
|
+
|
|
22
|
+
| Requirement | Status | Owning implementation | Verification |
|
|
23
|
+
|---|---|---|---|
|
|
24
|
+
| P1-1 Artifact delivery | **Delivered** | Descriptor creation in [`src/artifacts.ts`](../../src/artifacts.ts), fenced atomic paths in [`src/paths.ts`](../../src/paths.ts), signed capability delivery in [`src/artifact-access.ts`](../../src/artifact-access.ts) | [`tests/artifacts.spec.ts`](../../tests/artifacts.spec.ts), [`tests/artifact-access.spec.ts`](../../tests/artifact-access.spec.ts), Artifact-producing runtime/profile tests |
|
|
25
|
+
| P1-2 Extended tools | **Delivered** | `vision_pixel_diff`, `vision_long_screenshot_ocr`, `vision_extract_foreground`, `vision_dominant_colors`, and `vision_html_screenshot` in [`src/tools.ts`](../../src/tools.ts) and [`src/runtime.ts`](../../src/runtime.ts) | P1 parser and runtime cases in [`tests/upstream.spec.ts`](../../tests/upstream.spec.ts) and [`tests/runtime.spec.ts`](../../tests/runtime.spec.ts); pixel-diff and long-OCR real-profile calls |
|
|
26
|
+
| P1-3 Dedicated Web presentation | **Delivered** | Browser plugin and dedicated cards in [`src/client/index.tsx`](../../src/client/index.tsx); presentation-only capability metadata in [`src/artifact-access.ts`](../../src/artifact-access.ts) | [`tests/client.spec.ts`](../../tests/client.spec.ts), safe preview tests in [`tests/artifact-access.spec.ts`](../../tests/artifact-access.spec.ts), Web visual/console QA |
|
|
27
|
+
| P1-4 Health checks | **Delivered** | Health/version runtime contracts in [`src/runtime.ts`](../../src/runtime.ts), same-origin Web actions in [`src/web.ts`](../../src/web.ts), and the Settings surface in [`src/client/index.tsx`](../../src/client/index.tsx); Settings distinguishes the lightweight authenticated `GET /models` probe from an explicit real multimodal request using the bundled diagnostic image, and these administrative diagnostics are deliberately absent from the model tool registry | Health and real-model success/failure cases in [`tests/runtime.spec.ts`](../../tests/runtime.spec.ts), explicit API/model-test behavior in [`tests/web.spec.ts`](../../tests/web.spec.ts) and [`tests/client.spec.ts`](../../tests/client.spec.ts), plus model-tool absence in [`tests/tools.spec.ts`](../../tests/tools.spec.ts) |
|
|
28
|
+
| P1-5 Settings | **Delivered** | Namespace/config in [`src/config.ts`](../../src/config.ts), prepare-before-swap manager in [`src/runtime-manager.ts`](../../src/runtime-manager.ts), private same-origin route in [`src/web.ts`](../../src/web.ts), section in [`src/client/index.tsx`](../../src/client/index.tsx) | [`tests/runtime-manager.spec.ts`](../../tests/runtime-manager.spec.ts), [`tests/web.spec.ts`](../../tests/web.spec.ts), [`tests/client.spec.ts`](../../tests/client.spec.ts), clean Web-profile save/restart QA |
|
|
29
|
+
| P1-6 Install and upgrade experience | **Delivered** | Bundle lifecycle in [`src/index.ts`](../../src/index.ts), content-addressed managed runtime in [`src/runtime-install.ts`](../../src/runtime-install.ts), generation manager in [`src/runtime-manager.ts`](../../src/runtime-manager.ts), and the registry/Profile-constrained Settings updater with DSH Web restart handoff in [`src/plugin-update.ts`](../../src/plugin-update.ts) | Runtime interruption/concurrency tests, frozen-lockfile rollback and runtime-readiness checks in [`tests/plugin-update.spec.ts`](../../tests/plugin-update.spec.ts), package-layout test, clean-profile lifecycle, persisted Settings and failed-candidate retention checks |
|
|
30
|
+
|
|
31
|
+
## Cross-cutting requirements
|
|
32
|
+
|
|
33
|
+
| Area | Contract and evidence |
|
|
34
|
+
|---|---|
|
|
35
|
+
| Security | [`src/paths.ts`](../../src/paths.ts) confines reads and writes by realpath; [`src/runtime.ts`](../../src/runtime.ts) decodes and limits images before upload and structurally parses trace SVG before commit; [`src/upstream.ts`](../../src/upstream.ts) marks image text/instructions as untrusted in every direct and long-OCR visual-model prompt; [`src/tools.ts`](../../src/tools.ts) and [`src/skill.ts`](../../src/skill.ts) tell the text agent to treat derived output as evidence, not commands; [`src/artifact-access.ts`](../../src/artifact-access.ts) revalidates signed files on every read and sandboxes SVG; [`src/errors.ts`](../../src/errors.ts) redacts secrets. Path, symlink, format, size, XML/doctype, prompt guard, token-forgery, file-replacement, and CSP cases are automated. |
|
|
36
|
+
| Portability | Runtime and browser calls use argv vectors and Node filesystem/process APIs rather than POSIX shell composition. Managed preparation has `uv` and `venv`/pip paths; Python and Chrome discovery include platform-specific candidates. Package tests avoid machine-local dependency specifiers, and the checked-in fixture/profile flow is keyless. |
|
|
37
|
+
| Performance and cancellation | [`src/runtime.ts`](../../src/runtime.ts) applies one hard deadline, propagates `AbortSignal`, bounds per-session concurrency, rejects oversized decoded images before remote I/O, deduplicates repeated inputs within one glance operation, and keeps a one-entry content/configuration-keyed cache for the last successful identical glance in each live Session. [`src/index.ts`](../../src/index.ts) aborts plugin-owned calls before unregistering tools. Timeout, caller/plugin cancellation, cache-hit/miss, semaphore, and independent-session behavior are automated. |
|
|
38
|
+
| Observability | [`src/runtime.ts`](../../src/runtime.ts) logs bounded tool name, outcome, total/upstream duration, image count/bytes/pixels, cache hits, model, and error category while excluding base64, credentials, headers, and unbounded upstream output. |
|
|
39
|
+
| Model-context economy | The profile-global runtime publishes one small bootstrap, while [`src/exposure.ts`](../../src/exposure.ts) mounts the ten execution schemas only in an Agent that loads `vision-skills` and hides the bootstrap afterward. Other Agents remain unchanged. Health, connection, and version diagnostics stay exclusively on the Web Settings seam and never become model tools. Unit tests cover Agent isolation and restoration; every real-profile tool flow asserts the initial and activated schema sets. |
|
|
40
|
+
| Maintainability | Every tool calls one [`VisionToolkitRuntime`](../../src/runtime.ts); DSH-specific adaptation remains in [`src/tools.ts`](../../src/tools.ts), [`src/exposure.ts`](../../src/exposure.ts), [`src/index.ts`](../../src/index.ts), [`src/web.ts`](../../src/web.ts), and [`src/client/index.tsx`](../../src/client/index.tsx), while the pinned upstream remains the sole algorithm source. Runtime readiness, Skill/bootstrap publication, and Agent-scoped schemas belong to one lifecycle generation. |
|
|
41
|
+
| HTML screenshot isolation | The pinned screenshot guard uses a disposable Chrome profile, `--use-mock-keychain`, and `--incognito`, removes the profile after each call, and keeps network disabled. [`tests/html-screenshot-guard.spec.ts`](../../tests/html-screenshot-guard.spec.ts) captures the actual argv and cleanup behavior. |
|
|
42
|
+
| UI restoration acceptance | [`scripts/ui-restoration-example.ts`](../../scripts/ui-restoration-example.ts) performs reference → HTML render → pixel diff through the real runtime. [`examples/ui-restoration/README.md`](../../examples/ui-restoration/README.md) owns the reproducible procedure and checked-in evidence; [`tests/ui-restoration-example.spec.ts`](../../tests/ui-restoration-example.spec.ts) enforces it. |
|
|
43
|
+
|
|
44
|
+
## Error and lifecycle scenarios
|
|
45
|
+
|
|
46
|
+
| Scenario | Expected behavior | Evidence |
|
|
47
|
+
|---|---|---|
|
|
48
|
+
| Missing/invalid image, format, region, or path | Reject before upstream execution with an input, capacity, or path-safe error | [`tests/paths.spec.ts`](../../tests/paths.spec.ts), [`tests/runtime.spec.ts`](../../tests/runtime.spec.ts) |
|
|
49
|
+
| Missing Credential | Local tools remain usable; remote tools plus explicit API-connection and real-model tests report a redacted configuration/service action | [`tests/runtime.spec.ts`](../../tests/runtime.spec.ts), [`tests/web.spec.ts`](../../tests/web.spec.ts) |
|
|
50
|
+
| 401/403, 429, timeout, malformed output, or cancellation | Return a stable actionable category, preserve bounded diagnostics, and stop the request/subprocess | [`tests/errors.spec.ts`](../../tests/errors.spec.ts), [`tests/runtime.spec.ts`](../../tests/runtime.spec.ts), [`tests/upstream.spec.ts`](../../tests/upstream.spec.ts) |
|
|
51
|
+
| Runtime unavailable during initial load | Register no Skill, activation bootstrap, or Agent-scoped tools; keep Web Settings available for repair | [`src/index.ts`](../../src/index.ts), lifecycle tests in [`tests/tools.spec.ts`](../../tests/tools.spec.ts) and [`tests/web.spec.ts`](../../tests/web.spec.ts) |
|
|
52
|
+
| Runtime candidate fails during live update | Preserve the current serving generation and stored usable configuration | [`tests/runtime-manager.spec.ts`](../../tests/runtime-manager.spec.ts), [`tests/web.spec.ts`](../../tests/web.spec.ts) |
|
|
53
|
+
| Concurrent Settings candidates complete out of order | The newer ticket wins; an obsolete slower candidate cannot activate | [`tests/runtime-manager.spec.ts`](../../tests/runtime-manager.spec.ts) |
|
|
54
|
+
| Disable, re-enable, or uninstall | Active plugin-owned calls are cancelled, Agent-scoped tools, bootstrap, and Skill disappear and return as one lifecycle unit, and uninstall removes the bundle layer | [`tests/tools.spec.ts`](../../tests/tools.spec.ts), [`tests/profile-install.e2e.spec.ts`](../../tests/profile-install.e2e.spec.ts) |
|
|
55
|
+
|
|
56
|
+
## P2 and P3 boundary
|
|
57
|
+
|
|
58
|
+
| Scope | Status | Decision |
|
|
59
|
+
|---|---|---|
|
|
60
|
+
| P2 stable `ctx.visionToolkit` service and capability discovery | **Deferred by design** | The product brief requires at least one independent plugin consumer before stabilizing this API. `VisionToolkitRuntime` remains package-internal, so P0/P1 can evolve without creating a false compatibility promise. |
|
|
61
|
+
| P2 provider ecosystem | **Deferred by design** | The package supports its pinned upstream and one configured endpoint through OpenAI Chat Completions or Anthropic Messages; it does not prebuild an unused provider registry. |
|
|
62
|
+
| P3 exploratory inputs and automation | **Out of scope** | Upload/drag-and-drop, camera/video/audio/document ingestion, interactive annotations, automatic clicking, remote clusters, model routing/voting, and cross-session caches are not part of this release contract. |
|
|
63
|
+
|
|
64
|
+
## Reproducible verification
|
|
65
|
+
|
|
66
|
+
Run package checks from `dsh-vision-toolkit/`:
|
|
67
|
+
|
|
68
|
+
```sh
|
|
69
|
+
pnpm run build
|
|
70
|
+
pnpm test
|
|
71
|
+
pnpm run example:ui-restoration
|
|
72
|
+
pnpm pack --dry-run
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
The release acceptance pass additionally runs the repository's plugin checker, installs the package into clean Web and Headless `DSH_HOME` directories, inspects `--dump-config`, exercises local and keyless mock-backed remote tool calls, verifies Settings persistence and live switching, checks dedicated Web cards with zero browser-console errors, disables/re-enables the row, and removes the package. These runtime checks complement the automated tests; they do not replace them.
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
# Vision Toolkit 需求追踪
|
|
2
|
+
|
|
3
|
+
[English](README.md) | 中文
|
|
4
|
+
|
|
5
|
+
本参考将 DSH Vision Toolkit 产品需求中承诺的 P0/P1 条目映射到对应实现、自动化覆盖和可运行验收证据。标记为**已交付**的条目属于软件包契约;P2/P3 条目记录有意设置的产品边界,不代表尚未完成的 P0/P1 工作。
|
|
6
|
+
|
|
7
|
+
## P0 产品需求
|
|
8
|
+
|
|
9
|
+
| 需求 | 状态 | 负责实现 | 验证 |
|
|
10
|
+
|---|---|---|---|
|
|
11
|
+
| P0-1 标准 Profile Bundle | **已交付** | [`package.json`](../../package.json)、[`cordis.patch.yml`](../../cordis.patch.yml)、[`src/index.ts`](../../src/index.ts)、已提交的 `lib/` | [`tests/package-layout.spec.ts`](../../tests/package-layout.spec.ts)、[`tests/profile-install.e2e.spec.ts`](../../tests/profile-install.e2e.spec.ts)、干净 `--dump-config`、Web/Headless 启动、禁用和移除检查 |
|
|
12
|
+
| P0-2 上游复用 | **已交付** | [`src/version.ts`](../../src/version.ts)、[`src/runtime-install.ts`](../../src/runtime-install.ts)、[`scripts/upstream-manifest.mjs`](../../scripts/upstream-manifest.mjs)、[`scripts/sync-upstream.mjs`](../../scripts/sync-upstream.mjs)、[`vendor/agent-vision-toolkit/UPSTREAM_MANIFEST.json`](../../vendor/agent-vision-toolkit/UPSTREAM_MANIFEST.json) | [`tests/upstream.spec.ts`](../../tests/upstream.spec.ts)、[`tests/runtime-install.spec.ts`](../../tests/runtime-install.spec.ts)、构建时 manifest 验证 |
|
|
13
|
+
| P0-3 原生工具 | **已交付** | [`src/tools.ts`](../../src/tools.ts) 中的独立定义、[`src/exposure.ts`](../../src/exposure.ts) 中的 Agent 级发布、[`src/runtime.ts`](../../src/runtime.ts) 中的共享执行、[`src/upstream.ts`](../../src/upstream.ts) 中的上游适配 | [`tests/tools.spec.ts`](../../tests/tools.spec.ts)、[`tests/runtime.spec.ts`](../../tests/runtime.spec.ts)、[`tests/upstream.spec.ts`](../../tests/upstream.spec.ts)、[`tests/vision-prompt-guard.spec.ts`](../../tests/vision-prompt-guard.spec.ts)、全部五个 P0 工具的真实 Profile 渐进调用 |
|
|
14
|
+
| P0-4 配置与 Credential | **已交付** | [`src/config.ts`](../../src/config.ts)、[`src/runtime.ts`](../../src/runtime.ts) 中的逐操作解析、[`src/upstream.ts`](../../src/upstream.ts) 中的隔离环境构造 | [`tests/config.spec.ts`](../../tests/config.spec.ts)、[`tests/runtime.spec.ts`](../../tests/runtime.spec.ts) 和 [`tests/errors.spec.ts`](../../tests/errors.spec.ts) 中的 Credential/错误/脱敏用例 |
|
|
15
|
+
| P0-5 skill 生命周期 | **已交付** | [`src/index.ts`](../../src/index.ts) 中的就绪顺序、生命周期中止和全局 disposer;[`src/exposure.ts`](../../src/exposure.ts) 中的逐 Agent 激活、恢复和释放;[`src/skill.ts`](../../src/skill.ts) 中的打包内容 | [`tests/tools.spec.ts`](../../tests/tools.spec.ts) 中的 Agent 隔离、原生/直接/Code Mode 激活、Session 恢复、在途取消和释放用例;[`tests/profile-install.e2e.spec.ts`](../../tests/profile-install.e2e.spec.ts) 中的渐进暴露、禁用和卸载路径 |
|
|
16
|
+
| P0-6 纯文本模型结果 | **已交付** | [`src/tools.ts`](../../src/tools.ts) 中的 JSON 输出 schema 与纯渲染函数;[`src/artifacts.ts`](../../src/artifacts.ts) 中的规范产物描述;[`src/exposure.ts`](../../src/exposure.ts) 中由持久 Skill 加载证据派生的 schema 可见性 | [`tests/tools.spec.ts`](../../tests/tools.spec.ts) 中的工具 schema/展示断言、[`tests/profile-install.e2e.spec.ts`](../../tests/profile-install.e2e.spec.ts) 中逐请求的 schema 与模型可见 transcript(文本记录)断言 |
|
|
17
|
+
| P0-7 稳定错误 | **已交付** | [`src/errors.ts`](../../src/errors.ts),以及 [`src/paths.ts`](../../src/paths.ts)、[`src/runtime.ts`](../../src/runtime.ts)、[`src/upstream.ts`](../../src/upstream.ts) 中的边界验证 | [`tests/errors.spec.ts`](../../tests/errors.spec.ts)、[`tests/paths.spec.ts`](../../tests/paths.spec.ts),以及运行时/上游测试中的解析、超时、取消、Credential 和容量用例 |
|
|
18
|
+
| P0-8 测试与文档 | **已交付** | 双语 [`README.md`](../../README.md)、软件包测试、managed 运行时、示例和已提交构建产物 | `pnpm run build`、`pnpm test`、`pnpm pack --dry-run`、翻译/Markdown 门禁和无真实 Key 的干净 Profile e2e |
|
|
19
|
+
|
|
20
|
+
## P1 产品需求
|
|
21
|
+
|
|
22
|
+
| 需求 | 状态 | 负责实现 | 验证 |
|
|
23
|
+
|---|---|---|---|
|
|
24
|
+
| P1-1 产物交付 | **已交付** | [`src/artifacts.ts`](../../src/artifacts.ts) 中的产物描述创建、[`src/paths.ts`](../../src/paths.ts) 中受围栏保护的原子路径、[`src/artifact-access.ts`](../../src/artifact-access.ts) 中的签名能力交付 | [`tests/artifacts.spec.ts`](../../tests/artifacts.spec.ts)、[`tests/artifact-access.spec.ts`](../../tests/artifact-access.spec.ts)、会生成产物的运行时/Profile 测试 |
|
|
25
|
+
| P1-2 扩展工具 | **已交付** | [`src/tools.ts`](../../src/tools.ts) 和 [`src/runtime.ts`](../../src/runtime.ts) 中的 `vision_pixel_diff`、`vision_long_screenshot_ocr`、`vision_extract_foreground`、`vision_dominant_colors`、`vision_html_screenshot` | [`tests/upstream.spec.ts`](../../tests/upstream.spec.ts) 和 [`tests/runtime.spec.ts`](../../tests/runtime.spec.ts) 中的 P1 解析器/运行时用例;真实 Profile pixel-diff 和长截图 OCR 调用 |
|
|
26
|
+
| P1-3 专用 Web 展示 | **已交付** | [`src/client/index.tsx`](../../src/client/index.tsx) 中的浏览器插件与专用卡片;[`src/artifact-access.ts`](../../src/artifact-access.ts) 中仅供展示的能力元数据 | [`tests/client.spec.ts`](../../tests/client.spec.ts)、[`tests/artifact-access.spec.ts`](../../tests/artifact-access.spec.ts) 中的安全预览测试、Web 视觉/Console QA |
|
|
27
|
+
| P1-4 健康检查 | **已交付** | [`src/runtime.ts`](../../src/runtime.ts) 中的健康检查/版本运行时契约、[`src/web.ts`](../../src/web.ts) 中的同源 Web 操作,以及 [`src/client/index.tsx`](../../src/client/index.tsx) 中的 Settings 界面;Settings 明确区分携带凭据的轻量 `GET /models` 探测与使用自带诊断图片的显式真实多模态请求,这些管理诊断能力有意不进入模型工具注册表 | [`tests/runtime.spec.ts`](../../tests/runtime.spec.ts) 中的健康检查及真实模型成功/失败用例、[`tests/web.spec.ts`](../../tests/web.spec.ts) 与 [`tests/client.spec.ts`](../../tests/client.spec.ts) 中的显式 API/模型测试行为,以及 [`tests/tools.spec.ts`](../../tests/tools.spec.ts) 中的模型工具缺席断言 |
|
|
28
|
+
| P1-5 Settings | **已交付** | [`src/config.ts`](../../src/config.ts) 中的 namespace/配置、[`src/runtime-manager.ts`](../../src/runtime-manager.ts) 中的 prepare-before-swap manager、[`src/web.ts`](../../src/web.ts) 中的同源私有路由、[`src/client/index.tsx`](../../src/client/index.tsx) 中的 Settings 分区 | [`tests/runtime-manager.spec.ts`](../../tests/runtime-manager.spec.ts)、[`tests/web.spec.ts`](../../tests/web.spec.ts)、[`tests/client.spec.ts`](../../tests/client.spec.ts)、干净 Web Profile 保存/重启 QA |
|
|
29
|
+
| P1-6 安装与升级体验 | **已交付** | [`src/index.ts`](../../src/index.ts) 中的 Bundle 生命周期、[`src/runtime-install.ts`](../../src/runtime-install.ts) 中的内容寻址 managed 运行时、[`src/runtime-manager.ts`](../../src/runtime-manager.ts) 中的 generation manager,以及 [`src/plugin-update.ts`](../../src/plugin-update.ts) 中按 registry/Profile 安全约束执行的 Settings 更新器和 DSH Web 重启交接 | 运行时中断/并发测试、[`tests/plugin-update.spec.ts`](../../tests/plugin-update.spec.ts) 中的 frozen-lockfile 回滚与 Runtime 就绪检查、软件包布局测试、干净 Profile 生命周期、Settings 持久化和失败候选保留检查 |
|
|
30
|
+
|
|
31
|
+
## 横切需求
|
|
32
|
+
|
|
33
|
+
| 领域 | 契约与证据 |
|
|
34
|
+
|---|---|
|
|
35
|
+
| 安全 | [`src/paths.ts`](../../src/paths.ts) 通过 realpath 限制读写范围;[`src/runtime.ts`](../../src/runtime.ts) 在上传前解码并限制图片,并在提交前结构化解析 trace SVG;[`src/upstream.ts`](../../src/upstream.ts) 在每个直接和长截图 OCR 视觉模型提示词中把图片文字/指令标记为不可信;[`src/tools.ts`](../../src/tools.ts) 和 [`src/skill.ts`](../../src/skill.ts) 要求文本 agent 只把衍生输出当作证据而非命令;[`src/artifact-access.ts`](../../src/artifact-access.ts) 每次读取都重新验证签名文件并 sandbox SVG;[`src/errors.ts`](../../src/errors.ts) 对密钥脱敏。路径、符号链接、格式、大小、XML/doctype、提示词 guard、伪造 token、文件替换和 CSP 用例均有自动化覆盖。 |
|
|
36
|
+
| 可移植性 | 运行时和浏览器调用使用 argv 向量与 Node 文件系统/进程 API,不拼接 POSIX Shell。Managed 准备同时提供 `uv` 和 `venv`/pip 路径;Python 与 Chrome 探测包含平台候选。软件包测试拒绝机器本地依赖声明,已提交 fixture/Profile 流程无需真实 Key。 |
|
|
37
|
+
| 性能与取消 | [`src/runtime.ts`](../../src/runtime.ts) 应用一个硬截止时间、传递 `AbortSignal`、限制每个会话的并发数、在远程 I/O 前拒绝解码后过大的图片、在一次 glance 操作中对重复输入去重,并为每个活动会话保留一条按内容/配置键控的最近成功相同 glance 缓存。[`src/index.ts`](../../src/index.ts) 会在注销工具前中止插件拥有的调用。超时、调用方/插件取消、缓存命中/未命中、信号量和独立会话行为均有自动化覆盖。 |
|
|
38
|
+
| 可观察性 | [`src/runtime.ts`](../../src/runtime.ts) 记录有界的工具名、结果、总耗时/上游耗时、图片数量/字节/像素、缓存命中、模型和错误类别,同时排除 base64、Credential、鉴权头和无界上游输出。 |
|
|
39
|
+
| 模型上下文经济性 | Profile 级运行时只发布一个很小的引导工具,[`src/exposure.ts`](../../src/exposure.ts) 仅为加载 `vision-skills` 的 Agent 挂载 10 个执行 schema,并在成功后隐藏引导工具。其他 Agent 不受影响。健康检查、连接测试和版本诊断只存在于 Web Settings 边界,永远不会成为模型工具。单元测试覆盖 Agent 隔离与恢复;每条真实 Profile 工具流程都会断言初始和激活后的 schema 集合。 |
|
|
40
|
+
| 可维护性 | 每个工具都调用同一个 [`VisionToolkitRuntime`](../../src/runtime.ts);DSH 专用适配保留在 [`src/tools.ts`](../../src/tools.ts)、[`src/exposure.ts`](../../src/exposure.ts)、[`src/index.ts`](../../src/index.ts)、[`src/web.ts`](../../src/web.ts) 和 [`src/client/index.tsx`](../../src/client/index.tsx),固定上游继续作为算法唯一来源。运行时就绪、skill/引导工具发布和 Agent 级 schema 属于同一个生命周期 generation。 |
|
|
41
|
+
| HTML 截图隔离 | 固定截图 guard 使用一次性 Chrome Profile、`--use-mock-keychain` 和 `--incognito`,每次调用后删除 Profile,并保持网络禁用。[`tests/html-screenshot-guard.spec.ts`](../../tests/html-screenshot-guard.spec.ts) 捕获实际 argv 与清理行为。 |
|
|
42
|
+
| UI 还原验收 | [`scripts/ui-restoration-example.ts`](../../scripts/ui-restoration-example.ts) 通过真实运行时执行参考页面 → HTML 渲染 → 像素差异。[`examples/ui-restoration/README.md`](../../examples/ui-restoration/README.md) 负责可复现流程与已提交证据;[`tests/ui-restoration-example.spec.ts`](../../tests/ui-restoration-example.spec.ts) 强制执行该契约。 |
|
|
43
|
+
|
|
44
|
+
## 错误与生命周期场景
|
|
45
|
+
|
|
46
|
+
| 场景 | 预期行为 | 证据 |
|
|
47
|
+
|---|---|---|
|
|
48
|
+
| 图片缺失/无效、格式、区域或路径错误 | 在执行上游前以输入、容量或路径安全错误拒绝 | [`tests/paths.spec.ts`](../../tests/paths.spec.ts)、[`tests/runtime.spec.ts`](../../tests/runtime.spec.ts) |
|
|
49
|
+
| Credential 缺失 | 本地工具保持可用;远程工具以及显式 API 连接/真实模型测试返回脱敏且可执行下一步的配置/服务结果 | [`tests/runtime.spec.ts`](../../tests/runtime.spec.ts)、[`tests/web.spec.ts`](../../tests/web.spec.ts) |
|
|
50
|
+
| 401/403、429、超时、畸形输出或取消 | 返回稳定且可执行下一步的类别,保留有界诊断信息,并停止请求/子进程 | [`tests/errors.spec.ts`](../../tests/errors.spec.ts)、[`tests/runtime.spec.ts`](../../tests/runtime.spec.ts)、[`tests/upstream.spec.ts`](../../tests/upstream.spec.ts) |
|
|
51
|
+
| 初始加载时运行时不可用 | 不注册 skill、激活引导工具或 Agent 级工具;保留 Web Settings 以供修复 | [`src/index.ts`](../../src/index.ts)、[`tests/tools.spec.ts`](../../tests/tools.spec.ts) 与 [`tests/web.spec.ts`](../../tests/web.spec.ts) 中的生命周期测试 |
|
|
52
|
+
| 实时更新时运行时候选失败 | 保留当前服务 generation 和已存储的可用配置 | [`tests/runtime-manager.spec.ts`](../../tests/runtime-manager.spec.ts)、[`tests/web.spec.ts`](../../tests/web.spec.ts) |
|
|
53
|
+
| 并发 Settings 候选乱序完成 | 较新的 ticket 获胜;较慢的陈旧候选不能激活 | [`tests/runtime-manager.spec.ts`](../../tests/runtime-manager.spec.ts) |
|
|
54
|
+
| 禁用、重新启用或卸载 | 取消插件拥有的活动调用,Agent 级工具、引导工具与 skill 作为一个生命周期单元一起消失和恢复,卸载会移除 Bundle layer | [`tests/tools.spec.ts`](../../tests/tools.spec.ts)、[`tests/profile-install.e2e.spec.ts`](../../tests/profile-install.e2e.spec.ts) |
|
|
55
|
+
|
|
56
|
+
## P2 与 P3 边界
|
|
57
|
+
|
|
58
|
+
| 范围 | 状态 | 决策 |
|
|
59
|
+
|---|---|---|
|
|
60
|
+
| P2 稳定 `ctx.visionToolkit` 服务与能力发现 | **按设计推迟** | 产品需求要求至少一个独立插件消费方出现后再稳定该 API。`VisionToolkitRuntime` 保持包内部使用,使 P0/P1 可以继续演进,而不会制造虚假的兼容性承诺。 |
|
|
61
|
+
| P2 提供方生态 | **按设计推迟** | 本包支持固定上游,并通过 OpenAI Chat Completions 或 Anthropic Messages 使用一个已配置端点;不会预先构建无人使用的提供方注册表。 |
|
|
62
|
+
| P3 探索性输入与自动化 | **范围外** | 上传/拖拽、摄像头/视频/音频/文档输入、交互式标注、自动点击、远程集群、模型路由/投票和跨 Session 缓存不属于本版本契约。 |
|
|
63
|
+
|
|
64
|
+
## 可复现验证
|
|
65
|
+
|
|
66
|
+
在 `dsh-vision-toolkit/` 中运行软件包检查:
|
|
67
|
+
|
|
68
|
+
```sh
|
|
69
|
+
pnpm run build
|
|
70
|
+
pnpm test
|
|
71
|
+
pnpm run example:ui-restoration
|
|
72
|
+
pnpm pack --dry-run
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
发布验收还会运行仓库插件检查器,把软件包分别安装到干净的 Web 和 Headless `DSH_HOME`,检查 `--dump-config`,执行本地工具和由无真实 Key mock 支持的远程工具调用,验证 Settings 持久化与实时切换,检查专用 Web 卡片且确保浏览器 Console 无错误,禁用/重新启用插件行,最后移除软件包。这些运行时检查补充自动化测试,不替代自动化测试。
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
# Bilingual-pair consistency record (docs/i18n/README.md): the git blob hash of each
|
|
2
|
+
# side as of the last confirmed-consistent state. Both languages carry equal authority;
|
|
3
|
+
# after editing either side, bring the other along and re-record with:
|
|
4
|
+
# pnpm run verify-translation-pairing --write dsh-vision-toolkit/examples/ui-restoration/README.md
|
|
5
|
+
README.md: 62aca8723a7f92e47d6803a553882e709fc870f5
|
|
6
|
+
README.zh.md: 94b6ca7b43816d533d44a31d1fc853a23f63b3dd
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
# UI restoration example
|
|
2
|
+
|
|
3
|
+
English | [中文](README.zh.md)
|
|
4
|
+
|
|
5
|
+
This example is a deterministic, keyless proof that DSH Vision Toolkit can close a local UI-restoration loop through its real runtime. It renders a reference page, an intentionally inaccurate first implementation, and the final implementation with `vision_html_screenshot`; it then evaluates both candidates with `vision_pixel_diff` and enforces numeric acceptance thresholds.
|
|
6
|
+
|
|
7
|
+
## Flow
|
|
8
|
+
|
|
9
|
+
1. `tests/fixtures/ui-restoration-reference.html` is copied into a temporary workspace as the reference source.
|
|
10
|
+
2. `initial.html` and `implementation.html` are copied into the same workspace.
|
|
11
|
+
3. The runtime renders all three local files at `1200 × 720` and scale `1` through the pinned Chrome-family adapter.
|
|
12
|
+
4. The runtime compares the initial and final screenshots against the reference with an `8 × 8` grid and six ranked regions.
|
|
13
|
+
5. Check mode verifies the committed evidence; write mode replaces it only after the initial and final thresholds pass.
|
|
14
|
+
|
|
15
|
+
The runner uses the package's `VisionToolkitRuntime` and `UpstreamAdapter`, not a separate screenshot or image-diff implementation. It requires Python with Pillow and NumPy plus Chrome, Chromium, or Edge; it does not require a vision-service Credential.
|
|
16
|
+
|
|
17
|
+
## Inputs and evidence
|
|
18
|
+
|
|
19
|
+
| Path | Role |
|
|
20
|
+
|---|---|
|
|
21
|
+
| `initial.html` | Deliberately inaccurate reconstruction used to prove the comparison detects meaningful drift |
|
|
22
|
+
| `implementation.html` | Final reconstruction expected to match the reference |
|
|
23
|
+
| `assets/reference.png` | Browser-rendered reference image |
|
|
24
|
+
| `assets/initial.png` | Browser-rendered initial reconstruction |
|
|
25
|
+
| `assets/initial-heatmap.png` | Pixel-difference heatmap for the initial reconstruction |
|
|
26
|
+
| `assets/initial-report.json` | Portable initial comparison report with relative image paths |
|
|
27
|
+
| `assets/implementation.png` | Browser-rendered final reconstruction |
|
|
28
|
+
| `assets/final-heatmap.png` | Pixel-difference heatmap for the final reconstruction |
|
|
29
|
+
| `assets/final-report.json` | Portable final comparison report with relative image paths |
|
|
30
|
+
| `assets/metrics.json` | Stable viewport and acceptance metrics used by check mode |
|
|
31
|
+
|
|
32
|
+

|
|
33
|
+
|
|
34
|
+

|
|
35
|
+
|
|
36
|
+

|
|
37
|
+
|
|
38
|
+
## Run
|
|
39
|
+
|
|
40
|
+
From `dsh-vision-toolkit/`:
|
|
41
|
+
|
|
42
|
+
```sh
|
|
43
|
+
npm run example:ui-restoration
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
The command prints a structured result and exits non-zero when the environment, checked-in assets, or thresholds do not match the contract. The committed metrics are:
|
|
47
|
+
|
|
48
|
+
```json
|
|
49
|
+
{
|
|
50
|
+
"initialDifferencePct": 6.04,
|
|
51
|
+
"finalDifferencePct": 0,
|
|
52
|
+
"initialWorstRegions": 6,
|
|
53
|
+
"finalWorstRegions": 0
|
|
54
|
+
}
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
The initial comparison must remain at least `1%` different so the example cannot pass with two equivalent fixtures. The final comparison must remain at or below `0.02%`, and the committed evidence currently records an exact `0%` difference.
|
|
58
|
+
|
|
59
|
+
## Refresh evidence
|
|
60
|
+
|
|
61
|
+
Run write mode only when intentionally changing the reference, reconstruction, viewport, renderer contract, or expected artifacts:
|
|
62
|
+
|
|
63
|
+
```sh
|
|
64
|
+
npm run example:ui-restoration:write
|
|
65
|
+
npm run example:ui-restoration
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
Write mode renders into a temporary workspace, validates the thresholds, copies the approved PNGs and reports into `assets/`, rewrites report paths to portable relative paths, and updates `metrics.json`. The following check-mode run is the required confirmation that the committed package can reproduce the refreshed evidence.
|
|
69
|
+
|
|
70
|
+
The automated regression test is `tests/ui-restoration-example.spec.ts`; the macOS Chrome keychain/profile isolation contract is independently covered by `tests/html-screenshot-guard.spec.ts`.
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
# UI 还原示例
|
|
2
|
+
|
|
3
|
+
[English](README.md) | 中文
|
|
4
|
+
|
|
5
|
+
本示例以确定性、无真实 Key 的方式证明 DSH Vision Toolkit 可以通过真实运行时闭环完成本地 UI 还原。它先用 `vision_html_screenshot` 渲染参考页面、故意不准确的初版实现和最终实现,再用 `vision_pixel_diff` 评估两个候选结果,并执行数值验收阈值。
|
|
6
|
+
|
|
7
|
+
## 流程
|
|
8
|
+
|
|
9
|
+
1. 将 `tests/fixtures/ui-restoration-reference.html` 复制到临时工作区,作为参考源文件。
|
|
10
|
+
2. 将 `initial.html` 和 `implementation.html` 复制到同一工作区。
|
|
11
|
+
3. 运行时通过固定 Chrome 系适配器,以 `1200 × 720`、缩放 `1` 渲染 3 个本地文件。
|
|
12
|
+
4. 运行时使用 `8 × 8` 网格和 6 个排序区域,将初版和最终截图分别与参考图比较。
|
|
13
|
+
5. Check 模式验证已提交证据;write 模式只在初版和最终阈值都通过后替换证据。
|
|
14
|
+
|
|
15
|
+
Runner 使用本包的 `VisionToolkitRuntime` 和 `UpstreamAdapter`,不会另行实现截图或图片差异算法。它需要带 Pillow、NumPy 的 Python,以及 Chrome、Chromium 或 Edge;不需要视觉服务 Credential。
|
|
16
|
+
|
|
17
|
+
## 输入与证据
|
|
18
|
+
|
|
19
|
+
| 路径 | 作用 |
|
|
20
|
+
|---|---|
|
|
21
|
+
| `initial.html` | 故意不准确的还原结果,用于证明比较流程能检测有意义的偏差 |
|
|
22
|
+
| `implementation.html` | 预期与参考页面匹配的最终还原结果 |
|
|
23
|
+
| `assets/reference.png` | 浏览器渲染的参考图 |
|
|
24
|
+
| `assets/initial.png` | 浏览器渲染的初版结果 |
|
|
25
|
+
| `assets/initial-heatmap.png` | 初版结果的像素差异热力图 |
|
|
26
|
+
| `assets/initial-report.json` | 使用相对图片路径的可移植初版比较报告 |
|
|
27
|
+
| `assets/implementation.png` | 浏览器渲染的最终结果 |
|
|
28
|
+
| `assets/final-heatmap.png` | 最终结果的像素差异热力图 |
|
|
29
|
+
| `assets/final-report.json` | 使用相对图片路径的可移植最终比较报告 |
|
|
30
|
+
| `assets/metrics.json` | Check 模式使用的稳定视口和验收指标 |
|
|
31
|
+
|
|
32
|
+

|
|
33
|
+
|
|
34
|
+

|
|
35
|
+
|
|
36
|
+

|
|
37
|
+
|
|
38
|
+
## 运行
|
|
39
|
+
|
|
40
|
+
在 `dsh-vision-toolkit/` 中执行:
|
|
41
|
+
|
|
42
|
+
```sh
|
|
43
|
+
npm run example:ui-restoration
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
该命令会输出结构化结果;环境、已提交资源或阈值不符合契约时以非零状态退出。已提交指标如下:
|
|
47
|
+
|
|
48
|
+
```json
|
|
49
|
+
{
|
|
50
|
+
"initialDifferencePct": 6.04,
|
|
51
|
+
"finalDifferencePct": 0,
|
|
52
|
+
"initialWorstRegions": 6,
|
|
53
|
+
"finalWorstRegions": 0
|
|
54
|
+
}
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
初版差异必须保持在 `1%` 以上,避免两个等价 fixture 让示例失去检测意义。最终差异必须不高于 `0.02%`;当前已提交证据记录精确的 `0%` 差异。
|
|
58
|
+
|
|
59
|
+
## 刷新证据
|
|
60
|
+
|
|
61
|
+
只有有意修改参考页面、还原页面、视口、渲染器契约或预期产物时,才运行 write 模式:
|
|
62
|
+
|
|
63
|
+
```sh
|
|
64
|
+
npm run example:ui-restoration:write
|
|
65
|
+
npm run example:ui-restoration
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
Write 模式会在临时工作区中渲染,验证阈值,把通过验收的 PNG 和报告复制到 `assets/`,将报告路径改写为可移植相对路径,并更新 `metrics.json`。随后必须执行 check 模式,确认已提交软件包可以复现刷新后的证据。
|
|
69
|
+
|
|
70
|
+
自动回归测试位于 `tests/ui-restoration-example.spec.ts`;macOS Chrome 钥匙串/Profile 隔离契约由 `tests/html-screenshot-guard.spec.ts` 独立覆盖。
|
|
Binary file
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
{
|
|
2
|
+
"schemaVersion": 1,
|
|
3
|
+
"sourceTool": "vision_pixel_diff",
|
|
4
|
+
"original": {
|
|
5
|
+
"path": "assets/reference.png",
|
|
6
|
+
"bytes": 137315,
|
|
7
|
+
"width": 1200,
|
|
8
|
+
"height": 720,
|
|
9
|
+
"format": "png"
|
|
10
|
+
},
|
|
11
|
+
"rebuilt": {
|
|
12
|
+
"path": "assets/implementation.png",
|
|
13
|
+
"bytes": 137315,
|
|
14
|
+
"width": 1200,
|
|
15
|
+
"height": 720,
|
|
16
|
+
"format": "png"
|
|
17
|
+
},
|
|
18
|
+
"scaled": false,
|
|
19
|
+
"overallDifferencePct": 0,
|
|
20
|
+
"grid": 8,
|
|
21
|
+
"worstRegions": [
|
|
22
|
+
{
|
|
23
|
+
"index": 1,
|
|
24
|
+
"differencePct": 0,
|
|
25
|
+
"box": {
|
|
26
|
+
"x1": 1050,
|
|
27
|
+
"y1": 630,
|
|
28
|
+
"x2": 1200,
|
|
29
|
+
"y2": 720
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
"index": 2,
|
|
34
|
+
"differencePct": 0,
|
|
35
|
+
"box": {
|
|
36
|
+
"x1": 1050,
|
|
37
|
+
"y1": 540,
|
|
38
|
+
"x2": 1200,
|
|
39
|
+
"y2": 630
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
"index": 3,
|
|
44
|
+
"differencePct": 0,
|
|
45
|
+
"box": {
|
|
46
|
+
"x1": 1050,
|
|
47
|
+
"y1": 450,
|
|
48
|
+
"x2": 1200,
|
|
49
|
+
"y2": 540
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
"index": 4,
|
|
54
|
+
"differencePct": 0,
|
|
55
|
+
"box": {
|
|
56
|
+
"x1": 1050,
|
|
57
|
+
"y1": 360,
|
|
58
|
+
"x2": 1200,
|
|
59
|
+
"y2": 450
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
"index": 5,
|
|
64
|
+
"differencePct": 0,
|
|
65
|
+
"box": {
|
|
66
|
+
"x1": 1050,
|
|
67
|
+
"y1": 270,
|
|
68
|
+
"x2": 1200,
|
|
69
|
+
"y2": 360
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
"index": 6,
|
|
74
|
+
"differencePct": 0,
|
|
75
|
+
"box": {
|
|
76
|
+
"x1": 1050,
|
|
77
|
+
"y1": 180,
|
|
78
|
+
"x2": 1200,
|
|
79
|
+
"y2": 270
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
]
|
|
83
|
+
}
|
|
Binary file
|
|
Binary file
|