AdithyaSK HF Staff commited on
Commit
130c4a0
·
verified ·
1 Parent(s): a27e19a

Add files using upload-large-folder tool

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. tasks/dasyn_260630_00013/environment/Dockerfile +3 -0
  2. tasks/dasyn_260630_00013/environment/setup/setup.sh +15 -0
  3. tasks/dasyn_260630_00013/tests/grade.json +4 -0
  4. tasks/dasyn_260630_00013/tests/grade.py +88 -0
  5. tasks/dasyn_260630_00013/tests/test.sh +4 -0
  6. tasks/dasyn_260630_00013/tests/webdev/__init__.py +0 -0
  7. tasks/dasyn_260630_00013/tests/webdev/eval_rubric.py +117 -0
  8. tasks/dasyn_260630_00013/tests/webdev/shot.py +249 -0
  9. tasks/dasyn_260630_00013/tests/webdev/verdict.py +42 -0
  10. tasks/dasyn_260630_00014/environment/Dockerfile +3 -0
  11. tasks/dasyn_260630_00014/environment/setup/setup.sh +15 -0
  12. tasks/dasyn_260630_00014/tests/grade.json +4 -0
  13. tasks/dasyn_260630_00014/tests/grade.py +88 -0
  14. tasks/dasyn_260630_00014/tests/test.sh +4 -0
  15. tasks/dasyn_260630_00014/tests/webdev/__init__.py +0 -0
  16. tasks/dasyn_260630_00014/tests/webdev/eval_rubric.py +117 -0
  17. tasks/dasyn_260630_00014/tests/webdev/shot.py +249 -0
  18. tasks/dasyn_260630_00014/tests/webdev/verdict.py +42 -0
  19. tasks/dasyn_260630_00015/environment/Dockerfile +3 -0
  20. tasks/dasyn_260630_00015/environment/setup/setup.sh +15 -0
  21. tasks/dasyn_260630_00015/tests/grade.json +4 -0
  22. tasks/dasyn_260630_00015/tests/grade.py +88 -0
  23. tasks/dasyn_260630_00015/tests/test.sh +4 -0
  24. tasks/dasyn_260630_00015/tests/webdev/__init__.py +0 -0
  25. tasks/dasyn_260630_00015/tests/webdev/eval_rubric.py +117 -0
  26. tasks/dasyn_260630_00015/tests/webdev/shot.py +249 -0
  27. tasks/dasyn_260630_00015/tests/webdev/verdict.py +42 -0
  28. tasks/dasyn_260630_00025/environment/Dockerfile +3 -0
  29. tasks/dasyn_260630_00025/environment/setup/setup.sh +15 -0
  30. tasks/dasyn_260630_00025/tests/grade.json +4 -0
  31. tasks/dasyn_260630_00025/tests/grade.py +88 -0
  32. tasks/dasyn_260630_00025/tests/test.sh +4 -0
  33. tasks/dasyn_260630_00025/tests/webdev/__init__.py +0 -0
  34. tasks/dasyn_260630_00025/tests/webdev/eval_rubric.py +117 -0
  35. tasks/dasyn_260630_00025/tests/webdev/shot.py +249 -0
  36. tasks/dasyn_260630_00025/tests/webdev/verdict.py +42 -0
  37. tasks/dasyn_260630_00040/environment/Dockerfile +3 -0
  38. tasks/dasyn_260630_00040/environment/setup/setup.sh +15 -0
  39. tasks/dasyn_260630_00040/tests/grade.json +4 -0
  40. tasks/dasyn_260630_00040/tests/grade.py +88 -0
  41. tasks/dasyn_260630_00040/tests/test.sh +4 -0
  42. tasks/dasyn_260630_00040/tests/webdev/__init__.py +0 -0
  43. tasks/dasyn_260630_00040/tests/webdev/eval_rubric.py +117 -0
  44. tasks/dasyn_260630_00040/tests/webdev/shot.py +249 -0
  45. tasks/dasyn_260630_00040/tests/webdev/verdict.py +42 -0
  46. tasks/dasyn_260630_00047/environment/Dockerfile +3 -0
  47. tasks/dasyn_260630_00047/environment/setup/setup.sh +15 -0
  48. tasks/dasyn_260630_00047/tests/grade.json +4 -0
  49. tasks/dasyn_260630_00047/tests/grade.py +88 -0
  50. tasks/dasyn_260630_00047/tests/test.sh +4 -0
tasks/dasyn_260630_00013/environment/Dockerfile ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ # The task's image, pinned by digest (the same as [environment].docker_image).
2
+ # Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy.
3
+ FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:6e30e61bdbe1504470cd1f705b120d317da9e7f57df3ba04a906db6b2e95e14d
tasks/dasyn_260630_00013/environment/setup/setup.sh ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+ # Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into
3
+ # /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness.
4
+ M=/var/lib/mimo
5
+ [ -f "$M/ready" ] && exit 0
6
+ chmod 700 "$M"
7
+ fail() { echo "setup: $*" >&2; exit 1; }
8
+ # the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs
9
+ write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; }
10
+
11
+ # Webdev: verl recipes/design webdev-eval, as the explorer runs it. No blocklist: npm and CDNs are fair game.
12
+ mkdir -p /workspace/dist
13
+
14
+ touch "$M/ready"
15
+ echo "setup done"
tasks/dasyn_260630_00013/tests/grade.json ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ {
2
+ "cwd": "/workspace",
3
+ "query": "Create a corporate architecture gallery event site in React + Tailwind, elegant original design, static sample projects/speakers only, smooth page transitions."
4
+ }
tasks/dasyn_260630_00013/tests/grade.py ADDED
@@ -0,0 +1,88 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Grade a Webdev task as the explorer does (verl recipes/design webdev-eval): render, shrink, judge.
2
+
3
+ No index.html in dist/ scores 0. A render that fails, or a judge that never answers, writes no reward (not scored):
4
+ neither says anything about the page."""
5
+ import base64
6
+ import io
7
+ import json
8
+ import os
9
+ import random
10
+ import subprocess
11
+ import sys
12
+ import time
13
+ import urllib.request
14
+ from pathlib import Path
15
+
16
+ sys.path.insert(0, "/tests")
17
+ os.environ["WEBDEV_GRADE_HTTP"] = "1" # serve over loopback http so React/Vue/ES-module sites actually run
18
+ from webdev.eval_rubric import build_prompt # noqa: E402
19
+ from webdev.shot import _build_shot_cmd, _parse_render_env, _parse_shot_b64 # noqa: E402
20
+ from webdev.verdict import parse_verdict # noqa: E402
21
+
22
+ cfg = json.loads(Path("/tests/grade.json").read_text())
23
+ V = Path("/logs/verifier")
24
+ V.mkdir(parents=True, exist_ok=True)
25
+ dist = Path(cfg["cwd"]) / "dist"
26
+
27
+
28
+ def done(reward: float | None, why: str, **extra) -> None:
29
+ (V / "result.json").write_text(json.dumps({"reward": reward, "summary": why, **extra}, indent=1))
30
+ print(why)
31
+ if reward is None:
32
+ print("not scored", file=sys.stderr)
33
+ sys.exit(1)
34
+ (V / "reward.txt").write_text(f"{reward}\n")
35
+ sys.exit(0)
36
+
37
+
38
+ files = sorted(str(p.relative_to(dist)) for p in dist.rglob("*") if p.is_file())[:200] if dist.is_dir() else []
39
+ if "index.html" not in files:
40
+ done(0.0, "The agent delivered nothing to dist/." if not files else "dist/ has no index.html, so there is no page to open.",
41
+ delivered=files)
42
+ res = subprocess.run(["sh", "-c", _build_shot_cmd(f"file://{dist}/index.html")], capture_output=True, text=True,
43
+ timeout=150) # SHOT_TIMEOUT_S
44
+ shot = {"output": (res.stdout or "") + "\n" + (res.stderr or "")}
45
+ shot_b64, console_errors = _parse_shot_b64(shot)
46
+ render_env = _parse_render_env(shot)
47
+ if render_env.get("proxy_failed") or not shot_b64:
48
+ print(shot["output"][-2000:], file=sys.stderr)
49
+ done(None, "external assets were unreachable on every route" if render_env.get("proxy_failed")
50
+ else "the screenshot produced no image")
51
+ jpg = base64.b64decode(shot_b64)
52
+ try: # eval_mode._shrink: the judge refuses shots over 20 MP; proportional, quality 75
53
+ from PIL import Image
54
+ Image.MAX_IMAGE_PIXELS = None
55
+ im = Image.open(io.BytesIO(jpg))
56
+ size = im.size
57
+ if im.width * im.height > 20e6:
58
+ k = (20e6 / (im.width * im.height)) ** 0.5
59
+ im = im.convert("RGB").resize((max(1, int(im.width * k)), max(1, int(im.height * k))), Image.LANCZOS)
60
+ b = io.BytesIO(); im.save(b, "JPEG", quality=75); jpg = b.getvalue(); size = im.size
61
+ except ImportError:
62
+ size = None
63
+ (V / "screenshot.jpg").write_bytes(jpg)
64
+ content = [{"type": "image_url", "image_url": {"url": "data:image/jpeg;base64," + base64.b64encode(jpg).decode()}},
65
+ {"type": "text", "text": build_prompt().format(query=cfg["query"][:1500])}] # QUERY_CAP
66
+ url = os.environ.get("WEBDEV_JUDGE_URL", "https://router.huggingface.co/v1").rstrip("/") + "/chat/completions"
67
+ body = json.dumps({"model": os.environ["WEBDEV_JUDGE_MODEL"], "temperature": 1.0,
68
+ "messages": [{"role": "user", "content": content}]}).encode()
69
+ verdict, last = None, ""
70
+ for attempt in range(4): # JUDGE_RETRIES, with eval_mode's backoff
71
+ if attempt:
72
+ time.sleep(min(60.0, 3.0 * (3 ** (attempt - 1))) * (0.5 + random.random()))
73
+ try:
74
+ req = urllib.request.Request(url, data=body, method="POST", headers={
75
+ "Content-Type": "application/json", "Authorization": f"Bearer {os.environ.get('WEBDEV_JUDGE_KEY', '')}"})
76
+ with urllib.request.urlopen(req, timeout=180) as r: # JUDGE_TIMEOUT_S
77
+ msg = json.loads(r.read())["choices"][0]["message"]
78
+ v = parse_verdict(msg.get("content") or msg.get("reasoning_content") or "")
79
+ if "_failed" not in v:
80
+ verdict = v
81
+ break
82
+ last = v["_failed"]
83
+ except Exception as e: # noqa: BLE001
84
+ last = f"{type(e).__name__}: {e}"[:200]
85
+ if not verdict:
86
+ done(None, f"judge unavailable: {last}")
87
+ done(verdict["score"], verdict.get("reason", ""), dims=verdict["dims"], visual=verdict["visual"], screenshot_size=size,
88
+ console_errors=console_errors[:1500] if console_errors not in ("", "[]") else "")
tasks/dasyn_260630_00013/tests/test.sh ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ #!/bin/bash
2
+ # Webdev grading: a full-page render of dist/index.html, judged by a vision model against the brief.
3
+ mkdir -p /logs/verifier
4
+ cd /tests && python3 /tests/grade.py
tasks/dasyn_260630_00013/tests/webdev/__init__.py ADDED
File without changes
tasks/dasyn_260630_00013/tests/webdev/eval_rubric.py ADDED
@@ -0,0 +1,117 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright 2026 Bytedance Ltd. and/or its affiliates
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+ """The seven-dimension evaluation rubric. **The wording below is the ruler itself.**
15
+
16
+ One vision call returns seven dimensions, and the evaluation score is an equal-weight mean
17
+ of three of them::
18
+
19
+ score = (visual + query_fulfillment + premium_assets) / 3
20
+ visual = mean(layout_integrity, typography_hierarchy, color_harmony,
21
+ whitespace, content_richness)
22
+
23
+ ``BANDS`` and ``RICHNESS`` are kept **byte for byte** as the run that produced this arm's
24
+ published numbers used them, and they are in Chinese for the same reason. They are not
25
+ documentation of a scoring policy -- they ARE the scoring policy, handed to the judge model
26
+ verbatim. Translating or rewording them measures something else and makes every historical
27
+ result incomparable. To change the rubric, copy this file and change ``RUBRIC_ID``; a test
28
+ pins the rendered prompt's hash so an accidental edit fails loudly instead of silently
29
+ shifting the reward distribution.
30
+
31
+ Two deliberate differences from the earlier four-term formula:
32
+
33
+ * The fourth term (a static code check, weight 0.1) is gone. Its dominant component was an
34
+ INVERSE indicator: bucketing by ``premium_assets``, rows in [0, 0.2) averaged 0.900 on it
35
+ while rows in [0.8, 1.0] averaged only 0.425, with ``visual`` rising monotonically across
36
+ the same buckets. It was paying a bonus for not daring to reference external assets --
37
+ the highest-scoring arm on that term was the one that referenced the fewest (0.823,
38
+ against 0.638 and 0.648 for the RL arms).
39
+ * The remaining three are equal-weight rather than 0.6 / 0.1 / 0.2. ``premium_assets``
40
+ separates the arms most sharply (0.417 against 0.619, a gap of 0.20, where ``visual``
41
+ differs by 0.042 and ``query`` by 0.054), so equal weighting stops a 0.6-weighted
42
+ ``visual`` from drowning out the dimension that actually discriminates.
43
+ """
44
+
45
+ BANDS = """1. layout_integrity(布局完整性)
46
+ - [0.0, 0.2):布局严重损坏,核心内容大面积重叠、截断、溢出或无法阅读
47
+ - [0.2, 0.4):多处明显布局错误,显著影响主要内容使用
48
+ - [0.4, 0.6):主体可用,但有一处严重或多处明显的对齐、重叠、超框问题
49
+ - [0.6, 0.8):整体完整,仅有少量轻微对齐、间距或边界问题
50
+ - [0.8, 1.0]:布局完整稳定,未见可感知的重叠、错位、截断或溢出
51
+
52
+ 2. typography_hierarchy(排版层级)
53
+ - [0.0, 0.2):文字普遍不可读,字号/层级严重失控
54
+ - [0.2, 0.4):标题正文层级混乱,多处字号、行高或字重明显不当
55
+ - [0.4, 0.6):基本可读,但层级辨识或排版节奏存在明显缺陷
56
+ - [0.6, 0.8):层级清楚、阅读顺畅,仅有少量轻微排版问题
57
+ - [0.8, 1.0]:标题、正文、辅助文字层级鲜明且比例、行高、字重均成熟
58
+
59
+ 3. color_harmony(配色与对比)
60
+ - [0.0, 0.2):配色严重冲突或关键文字几乎无法辨认
61
+ - [0.2, 0.4):多处颜色不协调、对比不足,明显损害观感或可读性
62
+ - [0.4, 0.6):基本可用,但色彩体系、对比或一致性有明显问题
63
+ - [0.6, 0.8):配色协调且可读,仅有少量轻微不一致或对比问题
64
+ - [0.8, 1.0]:色彩体系统一成熟,对比清晰,无明显问题
65
+
66
+ 4. whitespace(留白与密度)
67
+ - [0.0, 0.2):页面极度拥挤或空洞,信息组织基本失效
68
+ - [0.2, 0.4):多处明显过密/过空,严重破坏浏览节奏
69
+ - [0.4, 0.6):整体可浏览,但局部密度、间距或区块节奏有明显问题
70
+ - [0.6, 0.8):留白与内容密度总体合理,仅有少量轻微问题
71
+ - [0.8, 1.0]:留白、间距和区块节奏自然一致,密度控制成熟
72
+
73
+ {richness}
74
+ {nq}. query_fulfillment(需求实现度)
75
+ - [0.0, 0.2):截图可见内容基本没有实现 query,或主题完全错误
76
+ - [0.2, 0.4):只实现少量表面元素,多数核心要求缺失
77
+ - [0.4, 0.6):实现主要方向,但多个关键板块、要素或功能界面明显缺失
78
+ - [0.6, 0.8):主体要求已实现,仅有少量次要缺失或偏差
79
+ - [0.8, 1.0]:截图可见范围内完整、准确地实现 query 的主题、板块、要素和功能界面
80
+
81
+ {na}. premium_assets(高级素材与质感)
82
+ - [0.0, 0.2):无有效视觉素材,或主要依赖简陋 emoji、裸占位、低质/模糊图像
83
+ - [0.2, 0.4):素材较普通或粗糙,缺乏统一设计感;少量装饰不能形成质感
84
+ - [0.4, 0.6):素材清晰且基本协调,但主要是普��图片或纯 CSS 视觉,没有高级素材
85
+ - [0.6, 0.8):使用了高品质真实图片、艺术化图像、成体系插画或精致 mockup,整体质感良好但仍有小缺陷
86
+ - [0.8, 1.0]:高级素材质量突出、体系完整,并与版式高度融合,达到成熟专业作品水准"""
87
+
88
+ RICHNESS = """5. content_richness(内容丰富度)
89
+ - [0.0, 0.2):近乎空壳,一屏都撑不满,只有标题、空架子或极少占位内容
90
+ - [0.2, 0.4):只有 1–2 个简单板块,内容高度重复、空泛或以占位为主
91
+ - [0.4, 0.6):已有若干实际板块,但数量或内容深度明显不足以支撑完整网站
92
+ - [0.6, 0.8):板块较完整、内容较具体,仅少数部分偏单薄
93
+ - [0.8, 1.0]:约 4 个及以上成形板块,内容具体充实,足以支撑完整网站体验"""
94
+
95
+
96
+ VISUAL_KEYS = ("layout_integrity", "typography_hierarchy", "color_harmony", "whitespace", "content_richness")
97
+ SCORE_KEYS = ("visual", "query_fulfillment", "premium_assets") # 等权平均的三项
98
+ ALL_KEYS = VISUAL_KEYS + ("query_fulfillment", "premium_assets")
99
+ RUBRIC_ID = "rva1:mean(visual,query,asset)"
100
+
101
+
102
+ def build_prompt() -> str:
103
+ """评测用的 7 维 prompt(含 content_richness)。`{query}` 占位符留给调用方 format。"""
104
+ dims = BANDS.format(richness=RICHNESS, nq=6, na=7)
105
+ return f"""你是网页 UI 评审。只依据 fullpage 截图可见证据评分。前 5 项构成 visual:前四项只评客观视觉问题,第五项评完整网站所需的信息量;第 6 项依据 query;第 7 项评素材品质。各维独立判断,不要因为某一维表现好或差而连带改变其它维。
106
+
107
+ query: {{query}}
108
+
109
+ 每个维度输出 0 到 1 的连续分数,可使用任意小数。先依据该维的五段描述确定分数所在区间,再根据问题严重程度、数量和影响在区间内连续取值;不要只输出区间端点或固定档位。五段边界统一为 [0.0,0.2)、[0.2,0.4)、[0.4,0.6)、[0.6,0.8)、[0.8,1.0]。临界情况选择与可见证据最匹配的相邻区间。premium_assets 没有高级素材时不得进入 [0.6,1.0]。
110
+
111
+ {dims}
112
+
113
+ 空白、严重加载失败或完全不可见时,所有维度输出 0。仅输出 JSON,不要 markdown:
114
+ {{{{"layout_integrity":0.0,"typography_hierarchy":0.0,"color_harmony":0.0,"whitespace":0.0,"content_richness":0.0,"query_fulfillment":0.0,"premium_assets":0.0,"reason":"核心依据"}}}}"""
115
+
116
+
117
+ __all__ = ["BANDS", "RICHNESS", "VISUAL_KEYS", "SCORE_KEYS", "ALL_KEYS", "RUBRIC_ID", "build_prompt"]
tasks/dasyn_260630_00013/tests/webdev/shot.py ADDED
@@ -0,0 +1,249 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright 2026 Bytedance Ltd. and/or its affiliates
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+ """In-pod full-page screenshot pipeline: playwright inside the agent's own sandbox.
15
+
16
+ Only the EVALUATION path uses this. Training ships the workspace to the grading service and
17
+ lets it render; evaluation renders here instead, so that it does not depend on that service
18
+ running -- evaluation is usually done in an environment that has no such long-lived service.
19
+
20
+ ``_SHOT_SCRIPT`` is kept **byte for byte**. Every non-obvious line in it encodes a failure
21
+ that was actually hit and diagnosed in a pod: proxy auth handed to the wrong playwright
22
+ field, a loopback bypass that the dict API silently drops, blank ``file://`` renders of
23
+ runtime-rendered pages, reveal-on-scroll content captured at opacity 0, sticky headers
24
+ painted at an in-flight scroll offset, parallax backgrounds going black below the fold. Read
25
+ the inline comments before changing any of it; none of these failures announce themselves --
26
+ they all arrive as a plausible-looking screenshot that scores badly.
27
+
28
+ The sandbox image must carry node, playwright and chromium. A missing chromium surfaces as
29
+ ``render_failed``, which the caller masks, rather than as a bad score.
30
+ """
31
+
32
+ from __future__ import annotations
33
+
34
+ import base64
35
+ import json
36
+ import os
37
+ import shlex
38
+
39
+ _SHOT_SCRIPT = r'''
40
+ import sys, json, base64, argparse
41
+ from playwright.sync_api import sync_playwright
42
+ ap = argparse.ArgumentParser()
43
+ ap.add_argument("--url", required=True)
44
+ ap.add_argument("--actions-b64", default="")
45
+ ap.add_argument("--proxy", default="") # comma-separated failover chain; empty entry = direct
46
+ ap.add_argument("--vw", type=int, default=1440)
47
+ ap.add_argument("--vh", type=int, default=900)
48
+ ap.add_argument("--serve-root", default="") # serve this dir over local http and rewrite --url onto it
49
+ a = ap.parse_args()
50
+ if a.serve_root:
51
+ import threading, functools
52
+ from http.server import ThreadingHTTPServer, SimpleHTTPRequestHandler
53
+ class _QuietHandler(SimpleHTTPRequestHandler):
54
+ def log_message(self, *args, **kw): # keep stdout clean for SHOT_B64 parsing
55
+ pass
56
+ _handler = functools.partial(_QuietHandler, directory=a.serve_root)
57
+ _srv = ThreadingHTTPServer(("127.0.0.1", 0), _handler)
58
+ threading.Thread(target=_srv.serve_forever, daemon=True).start()
59
+ _page = a.url.rsplit("/", 1)[-1] if a.url.rsplit("/", 1)[-1].endswith(".html") else "index.html"
60
+ a.url = "http://127.0.0.1:%d/%s" % (_srv.server_address[1], _page)
61
+ actions = json.loads(base64.b64decode(a.actions_b64).decode()) if a.actions_b64 else []
62
+ BASE_LAUNCH = {"headless": True, "args": ["--no-sandbox", "--disable-dev-shm-usage",
63
+ "--proxy-bypass-list=127.0.0.1;localhost"]}
64
+
65
+ def _proxy_cfg(purl):
66
+ from urllib.parse import urlparse as _up
67
+ _pu = _up(purl)
68
+ cfg = {"server": _pu.scheme + "://" + _pu.hostname + ":" + str(_pu.port)}
69
+ if _pu.username:
70
+ cfg["username"] = _pu.username
71
+ cfg["password"] = _pu.password or ""
72
+ return cfg
73
+
74
+ proxy_chain = [s.strip() for s in a.proxy.split(",")] if a.proxy else [""]
75
+ if a.proxy and "" not in proxy_chain:
76
+ proxy_chain.append("")
77
+ FATAL_NET = ("ERR_PROXY_CONNECTION_FAILED", "ERR_TUNNEL_CONNECTION_FAILED",
78
+ "ERR_SOCKS_CONNECTION_FAILED", "ERR_NAME_NOT_RESOLVED",
79
+ "ERR_INTERNET_DISCONNECTED", "ERR_CONNECTION_TIMED_OUT",
80
+ "ERR_CONNECTION_REFUSED", "ERR_CONNECTION_RESET", "ERR_TIMED_OUT",
81
+ "ERR_EMPTY_RESPONSE")
82
+ errs = []
83
+ fatal = [] # fatal external request failures of the CURRENT load attempt
84
+ render_env = {"proxy_failed": False, "recovered": None, "attempts": [], "fatal": []}
85
+
86
+ def _on_request_failed(req):
87
+ try:
88
+ u = req.url or ""
89
+ if not u.startswith("http") or u.startswith("http://127.0.0.1") or u.startswith("http://localhost"):
90
+ return # local server / file:// subresources are page defects, not env
91
+ f = req.failure or ""
92
+ if any(k in f for k in FATAL_NET):
93
+ fatal.append(f + " " + u[:120])
94
+ except Exception:
95
+ pass
96
+
97
+ SETTLE_JS = """async () => {
98
+ try {
99
+ document.documentElement.style.setProperty('scroll-behavior', 'auto', 'important');
100
+ if (document.body) document.body.style.setProperty('scroll-behavior', 'auto', 'important');
101
+ } catch (e) {}
102
+ if (document.fonts && document.fonts.ready) { try { await document.fonts.ready; } catch (e) {} }
103
+ const H = () => Math.max(document.body.scrollHeight, document.documentElement.scrollHeight);
104
+ const step = Math.max(400, Math.floor(window.innerHeight * 0.8));
105
+ for (let y = 0; y <= Math.min(H(), 30000); y += step) {
106
+ window.scrollTo(0, y);
107
+ await new Promise(r => setTimeout(r, 120));
108
+ }
109
+ window.scrollTo(0, H());
110
+ await new Promise(r => setTimeout(r, 400));
111
+ window.scrollTo(0, 0);
112
+ await new Promise(r => setTimeout(r, 300));
113
+ }"""
114
+ FREEZE_CSS = ("*,*::before,*::after{animation-delay:0s !important;animation-duration:.01s !important;"
115
+ "transition-delay:0s !important;transition-duration:.01s !important;"
116
+ "background-attachment:scroll !important;scroll-behavior:auto !important;}")
117
+
118
+ with sync_playwright() as p:
119
+ b = None
120
+ pg = None
121
+
122
+ def _open(purl):
123
+ global b, pg
124
+ if b is not None:
125
+ try:
126
+ b.close()
127
+ except Exception:
128
+ pass
129
+ kw = dict(BASE_LAUNCH)
130
+ if purl:
131
+ kw["proxy"] = _proxy_cfg(purl)
132
+ b = p.chromium.launch(**kw)
133
+ pg = b.new_context(viewport={"width": a.vw, "height": a.vh}).new_page()
134
+ pg.on("console", lambda m: errs.append(m.text) if m.type == "error" else None)
135
+ pg.on("pageerror", lambda e: errs.append("pageerror: " + str(e)))
136
+ pg.on("requestfailed", _on_request_failed)
137
+
138
+ def _load():
139
+ del fatal[:]
140
+ try:
141
+ resp = pg.goto(a.url, wait_until="load", timeout=25000)
142
+ if resp is not None and a.url.startswith("http") and resp.status >= 500:
143
+ fatal.append("PAGE_HTTP_%d %s" % (resp.status, a.url[:120]))
144
+ except Exception as e:
145
+ errs.append("goto failed: " + str(e))
146
+ pg.wait_for_timeout(2000)
147
+
148
+ for i, purl in enumerate(proxy_chain):
149
+ label = (purl.split("@")[-1] or "direct") if purl else "direct"
150
+ try:
151
+ _open(purl)
152
+ _load()
153
+ except Exception as e:
154
+ errs.append("launch failed via " + label + ": " + str(e))
155
+ del fatal[:]
156
+ fatal.append("LAUNCH_FAILED " + label)
157
+ if fatal:
158
+ render_env["attempts"].append({"via": label, "fatal": fatal[:3]})
159
+ if pg is not None and not fatal[0].startswith("LAUNCH_FAILED"):
160
+ _load()
161
+ if not fatal and pg is not None:
162
+ if render_env["attempts"]:
163
+ render_env["recovered"] = "via " + label
164
+ break
165
+ render_env["proxy_failed"] = bool(fatal) or pg is None
166
+ render_env["fatal"] = fatal[:5]
167
+ if pg is None: # every route failed to even open a browser: report env, no shot
168
+ sys.stdout.write("CONSOLE_ERRORS:" + json.dumps(errs[:15]) + "\n")
169
+ sys.stdout.write("RENDER_ENV:" + json.dumps(render_env) + "\n")
170
+ sys.exit(0)
171
+ try:
172
+ pg.evaluate(SETTLE_JS)
173
+ pg.add_style_tag(content=FREEZE_CSS)
174
+ pg.wait_for_timeout(300)
175
+ except Exception as e:
176
+ errs.append("settle failed: " + str(e))
177
+ for act in actions:
178
+ t = act.get("type")
179
+ try:
180
+ if t == "click":
181
+ pg.click(act["selector"], timeout=5000)
182
+ elif t == "fill":
183
+ pg.fill(act["selector"], act.get("value", ""), timeout=5000)
184
+ pg.wait_for_timeout(800)
185
+ except Exception as e:
186
+ errs.append("action " + json.dumps(act) + " failed: " + str(e))
187
+ try:
188
+ pg.evaluate("window.scrollTo(0, 0)")
189
+ pg.wait_for_timeout(250)
190
+ except Exception as e:
191
+ errs.append("scroll-top failed: " + str(e))
192
+ png = pg.screenshot(full_page=True, type="jpeg", quality=75)
193
+ b.close()
194
+ sys.stdout.write("SHOT_B64:" + base64.b64encode(png).decode() + "\n")
195
+ sys.stdout.write("CONSOLE_ERRORS:" + json.dumps(errs[:15]) + "\n")
196
+ sys.stdout.write("RENDER_ENV:" + json.dumps(render_env) + "\n")
197
+ '''
198
+
199
+
200
+ def _build_shot_cmd(url: str, *, actions_b64: str = "", proxy: str = "") -> str:
201
+ """Pod-side command that runs _SHOT_SCRIPT against `url`. Shared by ScreenshotTool
202
+ (feeds the multimodal grader) and capture_fullpage (lands the JPEG to disk).
203
+
204
+ ``WEBDEV_GRADE_HTTP=1`` switches ``file://`` rendering to a loopback http server inside
205
+ the shot script (see ``--serve-root``) so runtime-rendered pages actually execute. **The
206
+ launcher sets this on**, and it must stay on: browsers block module loading, fetch and
207
+ XHR on the file protocol, so a React, Vue or ES-module deliverable renders as an empty
208
+ body no matter how good it is -- measured at 44 of 182 shots blank, essentially all of
209
+ them runtime-rendered. Since React is named in 30% of the training briefs, the old
210
+ default was scoring a large share of the task pool as necessarily broken and teaching the
211
+ policy to avoid the very stack the brief asked for.
212
+
213
+ Scores across this boundary are NOT comparable: a React page goes from certainly-0 to
214
+ gradeable. Set it to 0 only to reproduce a pre-flip run.
215
+ """
216
+ script_b64 = base64.b64encode(_SHOT_SCRIPT.encode()).decode()
217
+ serve_root = ""
218
+ if os.environ.get("WEBDEV_GRADE_HTTP") == "1" and url.startswith("file://"):
219
+ serve_root = os.path.dirname(url[len("file://") :]) or "/"
220
+ return (
221
+ f"echo {script_b64} | base64 -d > /tmp/_webdev_shot.py && "
222
+ f"python3 /tmp/_webdev_shot.py --url {shlex.quote(url)} "
223
+ f"--actions-b64 {shlex.quote(actions_b64)} --proxy {shlex.quote(proxy)}"
224
+ + (f" --serve-root {shlex.quote(serve_root)}" if serve_root else "")
225
+ )
226
+
227
+
228
+ def _parse_shot_b64(r: dict) -> tuple[str, str]:
229
+ """Pull (SHOT_B64, CONSOLE_ERRORS) out of an env.execute result; empty b64 on miss."""
230
+ out = r.get("output") or ""
231
+ shot_b64, console_errors = "", "[]"
232
+ for line in out.splitlines():
233
+ if line.startswith("SHOT_B64:"):
234
+ shot_b64 = line[len("SHOT_B64:") :].strip()
235
+ elif line.startswith("CONSOLE_ERRORS:"):
236
+ console_errors = line[len("CONSOLE_ERRORS:") :].strip()
237
+ return shot_b64, console_errors
238
+
239
+
240
+ def _parse_render_env(r: dict) -> dict:
241
+ """Pull the RENDER_ENV json out of an env.execute result. {} when absent
242
+ (old pod script) or unparseable — callers treat that as env-healthy."""
243
+ for line in (r.get("output") or "").splitlines():
244
+ if line.startswith("RENDER_ENV:"):
245
+ try:
246
+ return json.loads(line[len("RENDER_ENV:") :].strip())
247
+ except Exception:
248
+ return {}
249
+ return {}
tasks/dasyn_260630_00013/tests/webdev/verdict.py ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright 2026 Xiaomi / the verl authors. Apache-2.0 (see ../LICENSE-verl.txt).
2
+ # `parse_verdict` copied unchanged from XiaomiMiMo/verl recipes/design/webdev/eval_mode.py.
3
+ import json
4
+ import re
5
+
6
+ from .eval_rubric import ALL_KEYS, VISUAL_KEYS
7
+
8
+ _JSON_RE = re.compile(r"\{.*\}", re.DOTALL)
9
+
10
+
11
+ def parse_verdict(raw_text: str) -> dict:
12
+ """Judge JSON -> per-dimension scores, ``visual``, ``score``, ``reason``.
13
+
14
+ Returns ``{"_failed": why}`` when it cannot be parsed. A missing dimension counts as a
15
+ parse failure rather than defaulting to 0: defaulting would turn "the judge forgot to
16
+ mention a dimension" into "the page scores 0 on it", inventing a low score out of
17
+ nothing.
18
+ """
19
+ m = _JSON_RE.search(raw_text or "")
20
+ if not m:
21
+ return {"_failed": f"no json in judge output: {(raw_text or '')[:160]}"}
22
+ try:
23
+ data = json.loads(m.group(0))
24
+ except Exception as e: # noqa: BLE001
25
+ return {"_failed": f"json error: {type(e).__name__}: {e}"}
26
+ dims: dict[str, float] = {}
27
+ for k in ALL_KEYS:
28
+ v = data.get(k)
29
+ if v is None:
30
+ return {"_failed": f"judge omitted dimension {k!r}"}
31
+ try:
32
+ dims[k] = max(0.0, min(1.0, float(v)))
33
+ except (TypeError, ValueError):
34
+ return {"_failed": f"dimension {k!r} is not a number: {v!r}"}
35
+ visual = sum(dims[k] for k in VISUAL_KEYS) / len(VISUAL_KEYS)
36
+ score = (visual + dims["query_fulfillment"] + dims["premium_assets"]) / 3.0
37
+ return {
38
+ "dims": dims,
39
+ "visual": round(visual, 4),
40
+ "score": round(score, 4),
41
+ "reason": str(data.get("reason", ""))[:500],
42
+ }
tasks/dasyn_260630_00014/environment/Dockerfile ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ # The task's image, pinned by digest (the same as [environment].docker_image).
2
+ # Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy.
3
+ FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:6e30e61bdbe1504470cd1f705b120d317da9e7f57df3ba04a906db6b2e95e14d
tasks/dasyn_260630_00014/environment/setup/setup.sh ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+ # Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into
3
+ # /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness.
4
+ M=/var/lib/mimo
5
+ [ -f "$M/ready" ] && exit 0
6
+ chmod 700 "$M"
7
+ fail() { echo "setup: $*" >&2; exit 1; }
8
+ # the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs
9
+ write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; }
10
+
11
+ # Webdev: verl recipes/design webdev-eval, as the explorer runs it. No blocklist: npm and CDNs are fair game.
12
+ mkdir -p /workspace/dist
13
+
14
+ touch "$M/ready"
15
+ echo "setup done"
tasks/dasyn_260630_00014/tests/grade.json ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ {
2
+ "cwd": "/workspace",
3
+ "query": "Build me a static website for a small Scandinavian style restaurant/cafe that also publishes local music news and weekly listening picks. I want it to feel clean like ProductHunt cards but warmer, with lots of white space, soft beige/blue colors, simple typography, and easy UI. Pages/sections: hero with restaurant name and short intro, featured music news cards, today menu, upcoming acoustic nights, chef playlist picks, about section, opening hours, location text, and contact/footer. Use only vanilla HTML CSS and JS, no backend or API, all news/menu/event content can be sample static data in the page. Add simple interactions like category filter for news cards and mobile menu."
4
+ }
tasks/dasyn_260630_00014/tests/grade.py ADDED
@@ -0,0 +1,88 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Grade a Webdev task as the explorer does (verl recipes/design webdev-eval): render, shrink, judge.
2
+
3
+ No index.html in dist/ scores 0. A render that fails, or a judge that never answers, writes no reward (not scored):
4
+ neither says anything about the page."""
5
+ import base64
6
+ import io
7
+ import json
8
+ import os
9
+ import random
10
+ import subprocess
11
+ import sys
12
+ import time
13
+ import urllib.request
14
+ from pathlib import Path
15
+
16
+ sys.path.insert(0, "/tests")
17
+ os.environ["WEBDEV_GRADE_HTTP"] = "1" # serve over loopback http so React/Vue/ES-module sites actually run
18
+ from webdev.eval_rubric import build_prompt # noqa: E402
19
+ from webdev.shot import _build_shot_cmd, _parse_render_env, _parse_shot_b64 # noqa: E402
20
+ from webdev.verdict import parse_verdict # noqa: E402
21
+
22
+ cfg = json.loads(Path("/tests/grade.json").read_text())
23
+ V = Path("/logs/verifier")
24
+ V.mkdir(parents=True, exist_ok=True)
25
+ dist = Path(cfg["cwd"]) / "dist"
26
+
27
+
28
+ def done(reward: float | None, why: str, **extra) -> None:
29
+ (V / "result.json").write_text(json.dumps({"reward": reward, "summary": why, **extra}, indent=1))
30
+ print(why)
31
+ if reward is None:
32
+ print("not scored", file=sys.stderr)
33
+ sys.exit(1)
34
+ (V / "reward.txt").write_text(f"{reward}\n")
35
+ sys.exit(0)
36
+
37
+
38
+ files = sorted(str(p.relative_to(dist)) for p in dist.rglob("*") if p.is_file())[:200] if dist.is_dir() else []
39
+ if "index.html" not in files:
40
+ done(0.0, "The agent delivered nothing to dist/." if not files else "dist/ has no index.html, so there is no page to open.",
41
+ delivered=files)
42
+ res = subprocess.run(["sh", "-c", _build_shot_cmd(f"file://{dist}/index.html")], capture_output=True, text=True,
43
+ timeout=150) # SHOT_TIMEOUT_S
44
+ shot = {"output": (res.stdout or "") + "\n" + (res.stderr or "")}
45
+ shot_b64, console_errors = _parse_shot_b64(shot)
46
+ render_env = _parse_render_env(shot)
47
+ if render_env.get("proxy_failed") or not shot_b64:
48
+ print(shot["output"][-2000:], file=sys.stderr)
49
+ done(None, "external assets were unreachable on every route" if render_env.get("proxy_failed")
50
+ else "the screenshot produced no image")
51
+ jpg = base64.b64decode(shot_b64)
52
+ try: # eval_mode._shrink: the judge refuses shots over 20 MP; proportional, quality 75
53
+ from PIL import Image
54
+ Image.MAX_IMAGE_PIXELS = None
55
+ im = Image.open(io.BytesIO(jpg))
56
+ size = im.size
57
+ if im.width * im.height > 20e6:
58
+ k = (20e6 / (im.width * im.height)) ** 0.5
59
+ im = im.convert("RGB").resize((max(1, int(im.width * k)), max(1, int(im.height * k))), Image.LANCZOS)
60
+ b = io.BytesIO(); im.save(b, "JPEG", quality=75); jpg = b.getvalue(); size = im.size
61
+ except ImportError:
62
+ size = None
63
+ (V / "screenshot.jpg").write_bytes(jpg)
64
+ content = [{"type": "image_url", "image_url": {"url": "data:image/jpeg;base64," + base64.b64encode(jpg).decode()}},
65
+ {"type": "text", "text": build_prompt().format(query=cfg["query"][:1500])}] # QUERY_CAP
66
+ url = os.environ.get("WEBDEV_JUDGE_URL", "https://router.huggingface.co/v1").rstrip("/") + "/chat/completions"
67
+ body = json.dumps({"model": os.environ["WEBDEV_JUDGE_MODEL"], "temperature": 1.0,
68
+ "messages": [{"role": "user", "content": content}]}).encode()
69
+ verdict, last = None, ""
70
+ for attempt in range(4): # JUDGE_RETRIES, with eval_mode's backoff
71
+ if attempt:
72
+ time.sleep(min(60.0, 3.0 * (3 ** (attempt - 1))) * (0.5 + random.random()))
73
+ try:
74
+ req = urllib.request.Request(url, data=body, method="POST", headers={
75
+ "Content-Type": "application/json", "Authorization": f"Bearer {os.environ.get('WEBDEV_JUDGE_KEY', '')}"})
76
+ with urllib.request.urlopen(req, timeout=180) as r: # JUDGE_TIMEOUT_S
77
+ msg = json.loads(r.read())["choices"][0]["message"]
78
+ v = parse_verdict(msg.get("content") or msg.get("reasoning_content") or "")
79
+ if "_failed" not in v:
80
+ verdict = v
81
+ break
82
+ last = v["_failed"]
83
+ except Exception as e: # noqa: BLE001
84
+ last = f"{type(e).__name__}: {e}"[:200]
85
+ if not verdict:
86
+ done(None, f"judge unavailable: {last}")
87
+ done(verdict["score"], verdict.get("reason", ""), dims=verdict["dims"], visual=verdict["visual"], screenshot_size=size,
88
+ console_errors=console_errors[:1500] if console_errors not in ("", "[]") else "")
tasks/dasyn_260630_00014/tests/test.sh ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ #!/bin/bash
2
+ # Webdev grading: a full-page render of dist/index.html, judged by a vision model against the brief.
3
+ mkdir -p /logs/verifier
4
+ cd /tests && python3 /tests/grade.py
tasks/dasyn_260630_00014/tests/webdev/__init__.py ADDED
File without changes
tasks/dasyn_260630_00014/tests/webdev/eval_rubric.py ADDED
@@ -0,0 +1,117 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright 2026 Bytedance Ltd. and/or its affiliates
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+ """The seven-dimension evaluation rubric. **The wording below is the ruler itself.**
15
+
16
+ One vision call returns seven dimensions, and the evaluation score is an equal-weight mean
17
+ of three of them::
18
+
19
+ score = (visual + query_fulfillment + premium_assets) / 3
20
+ visual = mean(layout_integrity, typography_hierarchy, color_harmony,
21
+ whitespace, content_richness)
22
+
23
+ ``BANDS`` and ``RICHNESS`` are kept **byte for byte** as the run that produced this arm's
24
+ published numbers used them, and they are in Chinese for the same reason. They are not
25
+ documentation of a scoring policy -- they ARE the scoring policy, handed to the judge model
26
+ verbatim. Translating or rewording them measures something else and makes every historical
27
+ result incomparable. To change the rubric, copy this file and change ``RUBRIC_ID``; a test
28
+ pins the rendered prompt's hash so an accidental edit fails loudly instead of silently
29
+ shifting the reward distribution.
30
+
31
+ Two deliberate differences from the earlier four-term formula:
32
+
33
+ * The fourth term (a static code check, weight 0.1) is gone. Its dominant component was an
34
+ INVERSE indicator: bucketing by ``premium_assets``, rows in [0, 0.2) averaged 0.900 on it
35
+ while rows in [0.8, 1.0] averaged only 0.425, with ``visual`` rising monotonically across
36
+ the same buckets. It was paying a bonus for not daring to reference external assets --
37
+ the highest-scoring arm on that term was the one that referenced the fewest (0.823,
38
+ against 0.638 and 0.648 for the RL arms).
39
+ * The remaining three are equal-weight rather than 0.6 / 0.1 / 0.2. ``premium_assets``
40
+ separates the arms most sharply (0.417 against 0.619, a gap of 0.20, where ``visual``
41
+ differs by 0.042 and ``query`` by 0.054), so equal weighting stops a 0.6-weighted
42
+ ``visual`` from drowning out the dimension that actually discriminates.
43
+ """
44
+
45
+ BANDS = """1. layout_integrity(布局完整性)
46
+ - [0.0, 0.2):布局严重损坏,核心内容大面积重叠、截断、溢出或无法阅读
47
+ - [0.2, 0.4):多处明显布局错误,显著影响主要内容使用
48
+ - [0.4, 0.6):主体可用,但有一处严重或多处明显的对齐、重叠、超框问题
49
+ - [0.6, 0.8):整体完整,仅有少量轻微对齐、间距或边界问题
50
+ - [0.8, 1.0]:布局完整稳定,未见可感知的重叠、错位、截断或溢出
51
+
52
+ 2. typography_hierarchy(排版层级)
53
+ - [0.0, 0.2):文字普遍不可读,字号/层级严重失控
54
+ - [0.2, 0.4):标题正文层级混乱,多处字号、行高或字重明显不当
55
+ - [0.4, 0.6):基本可读,但层级辨识或排版节奏存在明显缺陷
56
+ - [0.6, 0.8):层级清楚、阅读顺畅,仅有少量轻微排版问题
57
+ - [0.8, 1.0]:标题、正文、辅助文字层级鲜明且比例、行高、字重均成熟
58
+
59
+ 3. color_harmony(配色与对比)
60
+ - [0.0, 0.2):配色严重冲突或关键文字几乎无法辨认
61
+ - [0.2, 0.4):多处颜色不协调、对比不足,明显损害观感或可读性
62
+ - [0.4, 0.6):基本可用,但色彩体系、对比或一致性有明显问题
63
+ - [0.6, 0.8):配色协调且可读,仅有少量轻微不一致或对比问题
64
+ - [0.8, 1.0]:色彩体系统一成熟,对比清晰,无明显问题
65
+
66
+ 4. whitespace(留白与密度)
67
+ - [0.0, 0.2):页面极度拥挤或空洞,信息组织基本失效
68
+ - [0.2, 0.4):多处明显过密/过空,严重破坏浏览节奏
69
+ - [0.4, 0.6):整体可浏览,但局部密度、间距或区块节奏有明显问题
70
+ - [0.6, 0.8):留白与内容密度总体合理,仅有少量轻微问题
71
+ - [0.8, 1.0]:留白、间距和区块节奏自然一致,密度控制成熟
72
+
73
+ {richness}
74
+ {nq}. query_fulfillment(需求实现度)
75
+ - [0.0, 0.2):截图可见内容基本没有实现 query,或主题完全错误
76
+ - [0.2, 0.4):只实现少量表面元素,多数核心要求缺失
77
+ - [0.4, 0.6):实现主要方向,但多个关键板块、要素或功能界面明显缺失
78
+ - [0.6, 0.8):主体要求已实现,仅有少量次要缺失或偏差
79
+ - [0.8, 1.0]:截图可见范围内完整、准确地实现 query 的主题、板块、要素和功能界面
80
+
81
+ {na}. premium_assets(高级素材与质感)
82
+ - [0.0, 0.2):无有效视觉素材,或主要依赖简陋 emoji、裸占位、低质/模糊图像
83
+ - [0.2, 0.4):素材较普通或粗糙,缺乏统一设计感;少量装饰不能形成质感
84
+ - [0.4, 0.6):素材清晰且基本协调,但主要是普��图片或纯 CSS 视觉,没有高级素材
85
+ - [0.6, 0.8):使用了高品质真实图片、艺术化图像、成体系插画或精致 mockup,整体质感良好但仍有小缺陷
86
+ - [0.8, 1.0]:高级素材质量突出、体系完整,并与版式高度融合,达到成熟专业作品水准"""
87
+
88
+ RICHNESS = """5. content_richness(内容丰富度)
89
+ - [0.0, 0.2):近乎空壳,一屏都撑不满,只有标题、空架子或极少占位内容
90
+ - [0.2, 0.4):只有 1–2 个简单板块,内容高度重复、空泛或以占位为主
91
+ - [0.4, 0.6):已有若干实际板块,但数量或内容深度明显不足以支撑完整网站
92
+ - [0.6, 0.8):板块较完整、内容较具体,仅少数部分偏单薄
93
+ - [0.8, 1.0]:约 4 个及以上成形板块,内容具体充实,足以支撑完整网站体验"""
94
+
95
+
96
+ VISUAL_KEYS = ("layout_integrity", "typography_hierarchy", "color_harmony", "whitespace", "content_richness")
97
+ SCORE_KEYS = ("visual", "query_fulfillment", "premium_assets") # 等权平均的三项
98
+ ALL_KEYS = VISUAL_KEYS + ("query_fulfillment", "premium_assets")
99
+ RUBRIC_ID = "rva1:mean(visual,query,asset)"
100
+
101
+
102
+ def build_prompt() -> str:
103
+ """评测用的 7 维 prompt(含 content_richness)。`{query}` 占位符留给调用方 format。"""
104
+ dims = BANDS.format(richness=RICHNESS, nq=6, na=7)
105
+ return f"""你是网页 UI 评审。只依据 fullpage 截图可见证据评分。前 5 项构成 visual:前四项只评客观视觉问题,第五项评完整网站所需的信息量;第 6 项依据 query;第 7 项评素材品质。各维独立判断,不要因为某一维表现好或差而连带改变其它维。
106
+
107
+ query: {{query}}
108
+
109
+ 每个维度输出 0 到 1 的连续分数,可使用任意小数。先依据该维的五段描述确定分数所在区间,再根据问题严重程度、数量和影响在区间内连续取值;不要只输出区间端点或固定档位。五段边界统一为 [0.0,0.2)、[0.2,0.4)、[0.4,0.6)、[0.6,0.8)、[0.8,1.0]。临界情况选择与可见证据最匹配的相邻区间。premium_assets 没有高级素材时不得进入 [0.6,1.0]。
110
+
111
+ {dims}
112
+
113
+ 空白、严重加载失败或完全不可见时,所有维度输出 0。仅输出 JSON,不要 markdown:
114
+ {{{{"layout_integrity":0.0,"typography_hierarchy":0.0,"color_harmony":0.0,"whitespace":0.0,"content_richness":0.0,"query_fulfillment":0.0,"premium_assets":0.0,"reason":"核心依据"}}}}"""
115
+
116
+
117
+ __all__ = ["BANDS", "RICHNESS", "VISUAL_KEYS", "SCORE_KEYS", "ALL_KEYS", "RUBRIC_ID", "build_prompt"]
tasks/dasyn_260630_00014/tests/webdev/shot.py ADDED
@@ -0,0 +1,249 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright 2026 Bytedance Ltd. and/or its affiliates
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+ """In-pod full-page screenshot pipeline: playwright inside the agent's own sandbox.
15
+
16
+ Only the EVALUATION path uses this. Training ships the workspace to the grading service and
17
+ lets it render; evaluation renders here instead, so that it does not depend on that service
18
+ running -- evaluation is usually done in an environment that has no such long-lived service.
19
+
20
+ ``_SHOT_SCRIPT`` is kept **byte for byte**. Every non-obvious line in it encodes a failure
21
+ that was actually hit and diagnosed in a pod: proxy auth handed to the wrong playwright
22
+ field, a loopback bypass that the dict API silently drops, blank ``file://`` renders of
23
+ runtime-rendered pages, reveal-on-scroll content captured at opacity 0, sticky headers
24
+ painted at an in-flight scroll offset, parallax backgrounds going black below the fold. Read
25
+ the inline comments before changing any of it; none of these failures announce themselves --
26
+ they all arrive as a plausible-looking screenshot that scores badly.
27
+
28
+ The sandbox image must carry node, playwright and chromium. A missing chromium surfaces as
29
+ ``render_failed``, which the caller masks, rather than as a bad score.
30
+ """
31
+
32
+ from __future__ import annotations
33
+
34
+ import base64
35
+ import json
36
+ import os
37
+ import shlex
38
+
39
+ _SHOT_SCRIPT = r'''
40
+ import sys, json, base64, argparse
41
+ from playwright.sync_api import sync_playwright
42
+ ap = argparse.ArgumentParser()
43
+ ap.add_argument("--url", required=True)
44
+ ap.add_argument("--actions-b64", default="")
45
+ ap.add_argument("--proxy", default="") # comma-separated failover chain; empty entry = direct
46
+ ap.add_argument("--vw", type=int, default=1440)
47
+ ap.add_argument("--vh", type=int, default=900)
48
+ ap.add_argument("--serve-root", default="") # serve this dir over local http and rewrite --url onto it
49
+ a = ap.parse_args()
50
+ if a.serve_root:
51
+ import threading, functools
52
+ from http.server import ThreadingHTTPServer, SimpleHTTPRequestHandler
53
+ class _QuietHandler(SimpleHTTPRequestHandler):
54
+ def log_message(self, *args, **kw): # keep stdout clean for SHOT_B64 parsing
55
+ pass
56
+ _handler = functools.partial(_QuietHandler, directory=a.serve_root)
57
+ _srv = ThreadingHTTPServer(("127.0.0.1", 0), _handler)
58
+ threading.Thread(target=_srv.serve_forever, daemon=True).start()
59
+ _page = a.url.rsplit("/", 1)[-1] if a.url.rsplit("/", 1)[-1].endswith(".html") else "index.html"
60
+ a.url = "http://127.0.0.1:%d/%s" % (_srv.server_address[1], _page)
61
+ actions = json.loads(base64.b64decode(a.actions_b64).decode()) if a.actions_b64 else []
62
+ BASE_LAUNCH = {"headless": True, "args": ["--no-sandbox", "--disable-dev-shm-usage",
63
+ "--proxy-bypass-list=127.0.0.1;localhost"]}
64
+
65
+ def _proxy_cfg(purl):
66
+ from urllib.parse import urlparse as _up
67
+ _pu = _up(purl)
68
+ cfg = {"server": _pu.scheme + "://" + _pu.hostname + ":" + str(_pu.port)}
69
+ if _pu.username:
70
+ cfg["username"] = _pu.username
71
+ cfg["password"] = _pu.password or ""
72
+ return cfg
73
+
74
+ proxy_chain = [s.strip() for s in a.proxy.split(",")] if a.proxy else [""]
75
+ if a.proxy and "" not in proxy_chain:
76
+ proxy_chain.append("")
77
+ FATAL_NET = ("ERR_PROXY_CONNECTION_FAILED", "ERR_TUNNEL_CONNECTION_FAILED",
78
+ "ERR_SOCKS_CONNECTION_FAILED", "ERR_NAME_NOT_RESOLVED",
79
+ "ERR_INTERNET_DISCONNECTED", "ERR_CONNECTION_TIMED_OUT",
80
+ "ERR_CONNECTION_REFUSED", "ERR_CONNECTION_RESET", "ERR_TIMED_OUT",
81
+ "ERR_EMPTY_RESPONSE")
82
+ errs = []
83
+ fatal = [] # fatal external request failures of the CURRENT load attempt
84
+ render_env = {"proxy_failed": False, "recovered": None, "attempts": [], "fatal": []}
85
+
86
+ def _on_request_failed(req):
87
+ try:
88
+ u = req.url or ""
89
+ if not u.startswith("http") or u.startswith("http://127.0.0.1") or u.startswith("http://localhost"):
90
+ return # local server / file:// subresources are page defects, not env
91
+ f = req.failure or ""
92
+ if any(k in f for k in FATAL_NET):
93
+ fatal.append(f + " " + u[:120])
94
+ except Exception:
95
+ pass
96
+
97
+ SETTLE_JS = """async () => {
98
+ try {
99
+ document.documentElement.style.setProperty('scroll-behavior', 'auto', 'important');
100
+ if (document.body) document.body.style.setProperty('scroll-behavior', 'auto', 'important');
101
+ } catch (e) {}
102
+ if (document.fonts && document.fonts.ready) { try { await document.fonts.ready; } catch (e) {} }
103
+ const H = () => Math.max(document.body.scrollHeight, document.documentElement.scrollHeight);
104
+ const step = Math.max(400, Math.floor(window.innerHeight * 0.8));
105
+ for (let y = 0; y <= Math.min(H(), 30000); y += step) {
106
+ window.scrollTo(0, y);
107
+ await new Promise(r => setTimeout(r, 120));
108
+ }
109
+ window.scrollTo(0, H());
110
+ await new Promise(r => setTimeout(r, 400));
111
+ window.scrollTo(0, 0);
112
+ await new Promise(r => setTimeout(r, 300));
113
+ }"""
114
+ FREEZE_CSS = ("*,*::before,*::after{animation-delay:0s !important;animation-duration:.01s !important;"
115
+ "transition-delay:0s !important;transition-duration:.01s !important;"
116
+ "background-attachment:scroll !important;scroll-behavior:auto !important;}")
117
+
118
+ with sync_playwright() as p:
119
+ b = None
120
+ pg = None
121
+
122
+ def _open(purl):
123
+ global b, pg
124
+ if b is not None:
125
+ try:
126
+ b.close()
127
+ except Exception:
128
+ pass
129
+ kw = dict(BASE_LAUNCH)
130
+ if purl:
131
+ kw["proxy"] = _proxy_cfg(purl)
132
+ b = p.chromium.launch(**kw)
133
+ pg = b.new_context(viewport={"width": a.vw, "height": a.vh}).new_page()
134
+ pg.on("console", lambda m: errs.append(m.text) if m.type == "error" else None)
135
+ pg.on("pageerror", lambda e: errs.append("pageerror: " + str(e)))
136
+ pg.on("requestfailed", _on_request_failed)
137
+
138
+ def _load():
139
+ del fatal[:]
140
+ try:
141
+ resp = pg.goto(a.url, wait_until="load", timeout=25000)
142
+ if resp is not None and a.url.startswith("http") and resp.status >= 500:
143
+ fatal.append("PAGE_HTTP_%d %s" % (resp.status, a.url[:120]))
144
+ except Exception as e:
145
+ errs.append("goto failed: " + str(e))
146
+ pg.wait_for_timeout(2000)
147
+
148
+ for i, purl in enumerate(proxy_chain):
149
+ label = (purl.split("@")[-1] or "direct") if purl else "direct"
150
+ try:
151
+ _open(purl)
152
+ _load()
153
+ except Exception as e:
154
+ errs.append("launch failed via " + label + ": " + str(e))
155
+ del fatal[:]
156
+ fatal.append("LAUNCH_FAILED " + label)
157
+ if fatal:
158
+ render_env["attempts"].append({"via": label, "fatal": fatal[:3]})
159
+ if pg is not None and not fatal[0].startswith("LAUNCH_FAILED"):
160
+ _load()
161
+ if not fatal and pg is not None:
162
+ if render_env["attempts"]:
163
+ render_env["recovered"] = "via " + label
164
+ break
165
+ render_env["proxy_failed"] = bool(fatal) or pg is None
166
+ render_env["fatal"] = fatal[:5]
167
+ if pg is None: # every route failed to even open a browser: report env, no shot
168
+ sys.stdout.write("CONSOLE_ERRORS:" + json.dumps(errs[:15]) + "\n")
169
+ sys.stdout.write("RENDER_ENV:" + json.dumps(render_env) + "\n")
170
+ sys.exit(0)
171
+ try:
172
+ pg.evaluate(SETTLE_JS)
173
+ pg.add_style_tag(content=FREEZE_CSS)
174
+ pg.wait_for_timeout(300)
175
+ except Exception as e:
176
+ errs.append("settle failed: " + str(e))
177
+ for act in actions:
178
+ t = act.get("type")
179
+ try:
180
+ if t == "click":
181
+ pg.click(act["selector"], timeout=5000)
182
+ elif t == "fill":
183
+ pg.fill(act["selector"], act.get("value", ""), timeout=5000)
184
+ pg.wait_for_timeout(800)
185
+ except Exception as e:
186
+ errs.append("action " + json.dumps(act) + " failed: " + str(e))
187
+ try:
188
+ pg.evaluate("window.scrollTo(0, 0)")
189
+ pg.wait_for_timeout(250)
190
+ except Exception as e:
191
+ errs.append("scroll-top failed: " + str(e))
192
+ png = pg.screenshot(full_page=True, type="jpeg", quality=75)
193
+ b.close()
194
+ sys.stdout.write("SHOT_B64:" + base64.b64encode(png).decode() + "\n")
195
+ sys.stdout.write("CONSOLE_ERRORS:" + json.dumps(errs[:15]) + "\n")
196
+ sys.stdout.write("RENDER_ENV:" + json.dumps(render_env) + "\n")
197
+ '''
198
+
199
+
200
+ def _build_shot_cmd(url: str, *, actions_b64: str = "", proxy: str = "") -> str:
201
+ """Pod-side command that runs _SHOT_SCRIPT against `url`. Shared by ScreenshotTool
202
+ (feeds the multimodal grader) and capture_fullpage (lands the JPEG to disk).
203
+
204
+ ``WEBDEV_GRADE_HTTP=1`` switches ``file://`` rendering to a loopback http server inside
205
+ the shot script (see ``--serve-root``) so runtime-rendered pages actually execute. **The
206
+ launcher sets this on**, and it must stay on: browsers block module loading, fetch and
207
+ XHR on the file protocol, so a React, Vue or ES-module deliverable renders as an empty
208
+ body no matter how good it is -- measured at 44 of 182 shots blank, essentially all of
209
+ them runtime-rendered. Since React is named in 30% of the training briefs, the old
210
+ default was scoring a large share of the task pool as necessarily broken and teaching the
211
+ policy to avoid the very stack the brief asked for.
212
+
213
+ Scores across this boundary are NOT comparable: a React page goes from certainly-0 to
214
+ gradeable. Set it to 0 only to reproduce a pre-flip run.
215
+ """
216
+ script_b64 = base64.b64encode(_SHOT_SCRIPT.encode()).decode()
217
+ serve_root = ""
218
+ if os.environ.get("WEBDEV_GRADE_HTTP") == "1" and url.startswith("file://"):
219
+ serve_root = os.path.dirname(url[len("file://") :]) or "/"
220
+ return (
221
+ f"echo {script_b64} | base64 -d > /tmp/_webdev_shot.py && "
222
+ f"python3 /tmp/_webdev_shot.py --url {shlex.quote(url)} "
223
+ f"--actions-b64 {shlex.quote(actions_b64)} --proxy {shlex.quote(proxy)}"
224
+ + (f" --serve-root {shlex.quote(serve_root)}" if serve_root else "")
225
+ )
226
+
227
+
228
+ def _parse_shot_b64(r: dict) -> tuple[str, str]:
229
+ """Pull (SHOT_B64, CONSOLE_ERRORS) out of an env.execute result; empty b64 on miss."""
230
+ out = r.get("output") or ""
231
+ shot_b64, console_errors = "", "[]"
232
+ for line in out.splitlines():
233
+ if line.startswith("SHOT_B64:"):
234
+ shot_b64 = line[len("SHOT_B64:") :].strip()
235
+ elif line.startswith("CONSOLE_ERRORS:"):
236
+ console_errors = line[len("CONSOLE_ERRORS:") :].strip()
237
+ return shot_b64, console_errors
238
+
239
+
240
+ def _parse_render_env(r: dict) -> dict:
241
+ """Pull the RENDER_ENV json out of an env.execute result. {} when absent
242
+ (old pod script) or unparseable — callers treat that as env-healthy."""
243
+ for line in (r.get("output") or "").splitlines():
244
+ if line.startswith("RENDER_ENV:"):
245
+ try:
246
+ return json.loads(line[len("RENDER_ENV:") :].strip())
247
+ except Exception:
248
+ return {}
249
+ return {}
tasks/dasyn_260630_00014/tests/webdev/verdict.py ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright 2026 Xiaomi / the verl authors. Apache-2.0 (see ../LICENSE-verl.txt).
2
+ # `parse_verdict` copied unchanged from XiaomiMiMo/verl recipes/design/webdev/eval_mode.py.
3
+ import json
4
+ import re
5
+
6
+ from .eval_rubric import ALL_KEYS, VISUAL_KEYS
7
+
8
+ _JSON_RE = re.compile(r"\{.*\}", re.DOTALL)
9
+
10
+
11
+ def parse_verdict(raw_text: str) -> dict:
12
+ """Judge JSON -> per-dimension scores, ``visual``, ``score``, ``reason``.
13
+
14
+ Returns ``{"_failed": why}`` when it cannot be parsed. A missing dimension counts as a
15
+ parse failure rather than defaulting to 0: defaulting would turn "the judge forgot to
16
+ mention a dimension" into "the page scores 0 on it", inventing a low score out of
17
+ nothing.
18
+ """
19
+ m = _JSON_RE.search(raw_text or "")
20
+ if not m:
21
+ return {"_failed": f"no json in judge output: {(raw_text or '')[:160]}"}
22
+ try:
23
+ data = json.loads(m.group(0))
24
+ except Exception as e: # noqa: BLE001
25
+ return {"_failed": f"json error: {type(e).__name__}: {e}"}
26
+ dims: dict[str, float] = {}
27
+ for k in ALL_KEYS:
28
+ v = data.get(k)
29
+ if v is None:
30
+ return {"_failed": f"judge omitted dimension {k!r}"}
31
+ try:
32
+ dims[k] = max(0.0, min(1.0, float(v)))
33
+ except (TypeError, ValueError):
34
+ return {"_failed": f"dimension {k!r} is not a number: {v!r}"}
35
+ visual = sum(dims[k] for k in VISUAL_KEYS) / len(VISUAL_KEYS)
36
+ score = (visual + dims["query_fulfillment"] + dims["premium_assets"]) / 3.0
37
+ return {
38
+ "dims": dims,
39
+ "visual": round(visual, 4),
40
+ "score": round(score, 4),
41
+ "reason": str(data.get("reason", ""))[:500],
42
+ }
tasks/dasyn_260630_00015/environment/Dockerfile ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ # The task's image, pinned by digest (the same as [environment].docker_image).
2
+ # Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy.
3
+ FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:6e30e61bdbe1504470cd1f705b120d317da9e7f57df3ba04a906db6b2e95e14d
tasks/dasyn_260630_00015/environment/setup/setup.sh ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+ # Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into
3
+ # /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness.
4
+ M=/var/lib/mimo
5
+ [ -f "$M/ready" ] && exit 0
6
+ chmod 700 "$M"
7
+ fail() { echo "setup: $*" >&2; exit 1; }
8
+ # the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs
9
+ write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; }
10
+
11
+ # Webdev: verl recipes/design webdev-eval, as the explorer runs it. No blocklist: npm and CDNs are fair game.
12
+ mkdir -p /workspace/dist
13
+
14
+ touch "$M/ready"
15
+ echo "setup done"
tasks/dasyn_260630_00015/tests/grade.json ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ {
2
+ "cwd": "/workspace",
3
+ "query": "Make a bold charity shop editorial website like a clean GitHub project page style, where people can read stories about donated products and browse items for a cause. Add a simple search bar to filter the mock products and articles, use GSAP for smooth section animations, and keep everything static with sample content only, no login or payment system."
4
+ }
tasks/dasyn_260630_00015/tests/grade.py ADDED
@@ -0,0 +1,88 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Grade a Webdev task as the explorer does (verl recipes/design webdev-eval): render, shrink, judge.
2
+
3
+ No index.html in dist/ scores 0. A render that fails, or a judge that never answers, writes no reward (not scored):
4
+ neither says anything about the page."""
5
+ import base64
6
+ import io
7
+ import json
8
+ import os
9
+ import random
10
+ import subprocess
11
+ import sys
12
+ import time
13
+ import urllib.request
14
+ from pathlib import Path
15
+
16
+ sys.path.insert(0, "/tests")
17
+ os.environ["WEBDEV_GRADE_HTTP"] = "1" # serve over loopback http so React/Vue/ES-module sites actually run
18
+ from webdev.eval_rubric import build_prompt # noqa: E402
19
+ from webdev.shot import _build_shot_cmd, _parse_render_env, _parse_shot_b64 # noqa: E402
20
+ from webdev.verdict import parse_verdict # noqa: E402
21
+
22
+ cfg = json.loads(Path("/tests/grade.json").read_text())
23
+ V = Path("/logs/verifier")
24
+ V.mkdir(parents=True, exist_ok=True)
25
+ dist = Path(cfg["cwd"]) / "dist"
26
+
27
+
28
+ def done(reward: float | None, why: str, **extra) -> None:
29
+ (V / "result.json").write_text(json.dumps({"reward": reward, "summary": why, **extra}, indent=1))
30
+ print(why)
31
+ if reward is None:
32
+ print("not scored", file=sys.stderr)
33
+ sys.exit(1)
34
+ (V / "reward.txt").write_text(f"{reward}\n")
35
+ sys.exit(0)
36
+
37
+
38
+ files = sorted(str(p.relative_to(dist)) for p in dist.rglob("*") if p.is_file())[:200] if dist.is_dir() else []
39
+ if "index.html" not in files:
40
+ done(0.0, "The agent delivered nothing to dist/." if not files else "dist/ has no index.html, so there is no page to open.",
41
+ delivered=files)
42
+ res = subprocess.run(["sh", "-c", _build_shot_cmd(f"file://{dist}/index.html")], capture_output=True, text=True,
43
+ timeout=150) # SHOT_TIMEOUT_S
44
+ shot = {"output": (res.stdout or "") + "\n" + (res.stderr or "")}
45
+ shot_b64, console_errors = _parse_shot_b64(shot)
46
+ render_env = _parse_render_env(shot)
47
+ if render_env.get("proxy_failed") or not shot_b64:
48
+ print(shot["output"][-2000:], file=sys.stderr)
49
+ done(None, "external assets were unreachable on every route" if render_env.get("proxy_failed")
50
+ else "the screenshot produced no image")
51
+ jpg = base64.b64decode(shot_b64)
52
+ try: # eval_mode._shrink: the judge refuses shots over 20 MP; proportional, quality 75
53
+ from PIL import Image
54
+ Image.MAX_IMAGE_PIXELS = None
55
+ im = Image.open(io.BytesIO(jpg))
56
+ size = im.size
57
+ if im.width * im.height > 20e6:
58
+ k = (20e6 / (im.width * im.height)) ** 0.5
59
+ im = im.convert("RGB").resize((max(1, int(im.width * k)), max(1, int(im.height * k))), Image.LANCZOS)
60
+ b = io.BytesIO(); im.save(b, "JPEG", quality=75); jpg = b.getvalue(); size = im.size
61
+ except ImportError:
62
+ size = None
63
+ (V / "screenshot.jpg").write_bytes(jpg)
64
+ content = [{"type": "image_url", "image_url": {"url": "data:image/jpeg;base64," + base64.b64encode(jpg).decode()}},
65
+ {"type": "text", "text": build_prompt().format(query=cfg["query"][:1500])}] # QUERY_CAP
66
+ url = os.environ.get("WEBDEV_JUDGE_URL", "https://router.huggingface.co/v1").rstrip("/") + "/chat/completions"
67
+ body = json.dumps({"model": os.environ["WEBDEV_JUDGE_MODEL"], "temperature": 1.0,
68
+ "messages": [{"role": "user", "content": content}]}).encode()
69
+ verdict, last = None, ""
70
+ for attempt in range(4): # JUDGE_RETRIES, with eval_mode's backoff
71
+ if attempt:
72
+ time.sleep(min(60.0, 3.0 * (3 ** (attempt - 1))) * (0.5 + random.random()))
73
+ try:
74
+ req = urllib.request.Request(url, data=body, method="POST", headers={
75
+ "Content-Type": "application/json", "Authorization": f"Bearer {os.environ.get('WEBDEV_JUDGE_KEY', '')}"})
76
+ with urllib.request.urlopen(req, timeout=180) as r: # JUDGE_TIMEOUT_S
77
+ msg = json.loads(r.read())["choices"][0]["message"]
78
+ v = parse_verdict(msg.get("content") or msg.get("reasoning_content") or "")
79
+ if "_failed" not in v:
80
+ verdict = v
81
+ break
82
+ last = v["_failed"]
83
+ except Exception as e: # noqa: BLE001
84
+ last = f"{type(e).__name__}: {e}"[:200]
85
+ if not verdict:
86
+ done(None, f"judge unavailable: {last}")
87
+ done(verdict["score"], verdict.get("reason", ""), dims=verdict["dims"], visual=verdict["visual"], screenshot_size=size,
88
+ console_errors=console_errors[:1500] if console_errors not in ("", "[]") else "")
tasks/dasyn_260630_00015/tests/test.sh ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ #!/bin/bash
2
+ # Webdev grading: a full-page render of dist/index.html, judged by a vision model against the brief.
3
+ mkdir -p /logs/verifier
4
+ cd /tests && python3 /tests/grade.py
tasks/dasyn_260630_00015/tests/webdev/__init__.py ADDED
File without changes
tasks/dasyn_260630_00015/tests/webdev/eval_rubric.py ADDED
@@ -0,0 +1,117 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright 2026 Bytedance Ltd. and/or its affiliates
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+ """The seven-dimension evaluation rubric. **The wording below is the ruler itself.**
15
+
16
+ One vision call returns seven dimensions, and the evaluation score is an equal-weight mean
17
+ of three of them::
18
+
19
+ score = (visual + query_fulfillment + premium_assets) / 3
20
+ visual = mean(layout_integrity, typography_hierarchy, color_harmony,
21
+ whitespace, content_richness)
22
+
23
+ ``BANDS`` and ``RICHNESS`` are kept **byte for byte** as the run that produced this arm's
24
+ published numbers used them, and they are in Chinese for the same reason. They are not
25
+ documentation of a scoring policy -- they ARE the scoring policy, handed to the judge model
26
+ verbatim. Translating or rewording them measures something else and makes every historical
27
+ result incomparable. To change the rubric, copy this file and change ``RUBRIC_ID``; a test
28
+ pins the rendered prompt's hash so an accidental edit fails loudly instead of silently
29
+ shifting the reward distribution.
30
+
31
+ Two deliberate differences from the earlier four-term formula:
32
+
33
+ * The fourth term (a static code check, weight 0.1) is gone. Its dominant component was an
34
+ INVERSE indicator: bucketing by ``premium_assets``, rows in [0, 0.2) averaged 0.900 on it
35
+ while rows in [0.8, 1.0] averaged only 0.425, with ``visual`` rising monotonically across
36
+ the same buckets. It was paying a bonus for not daring to reference external assets --
37
+ the highest-scoring arm on that term was the one that referenced the fewest (0.823,
38
+ against 0.638 and 0.648 for the RL arms).
39
+ * The remaining three are equal-weight rather than 0.6 / 0.1 / 0.2. ``premium_assets``
40
+ separates the arms most sharply (0.417 against 0.619, a gap of 0.20, where ``visual``
41
+ differs by 0.042 and ``query`` by 0.054), so equal weighting stops a 0.6-weighted
42
+ ``visual`` from drowning out the dimension that actually discriminates.
43
+ """
44
+
45
+ BANDS = """1. layout_integrity(布局完整性)
46
+ - [0.0, 0.2):布局严重损坏,核心内容大面积重叠、截断、溢出或无法阅读
47
+ - [0.2, 0.4):多处明显布局错误,显著影响主要内容使用
48
+ - [0.4, 0.6):主体可用,但有一处严重或多处明显的对齐、重叠、超框问题
49
+ - [0.6, 0.8):整体完整,仅有少量轻微对齐、间距或边界问题
50
+ - [0.8, 1.0]:布局完整稳定,未见可感知的重叠、错位、截断或溢出
51
+
52
+ 2. typography_hierarchy(排版层级)
53
+ - [0.0, 0.2):文字普遍不可读,字号/层级严重失控
54
+ - [0.2, 0.4):标题正文层级混乱,多处字号、行高或字重明显不当
55
+ - [0.4, 0.6):基本可读,但层级辨识或排版节奏存在明显缺陷
56
+ - [0.6, 0.8):层级清楚、阅读顺畅,仅有少量轻微排版问题
57
+ - [0.8, 1.0]:标题、正文、辅助文字层级鲜明且比例、行高、字重均成熟
58
+
59
+ 3. color_harmony(配色与对比)
60
+ - [0.0, 0.2):配色严重冲突或关键文字几乎无法辨认
61
+ - [0.2, 0.4):多处颜色不协调、对比不足,明显损害观感或可读性
62
+ - [0.4, 0.6):基本可用,但色彩体系、对比或一致性有明显问题
63
+ - [0.6, 0.8):配色协调且可读,仅有少量轻微不一致或对比问题
64
+ - [0.8, 1.0]:色彩体系统一成熟,对比清晰,无明显问题
65
+
66
+ 4. whitespace(留白与密度)
67
+ - [0.0, 0.2):页面极度拥挤或空洞,信息组织基本失效
68
+ - [0.2, 0.4):多处明显过密/过空,严重破坏浏览节奏
69
+ - [0.4, 0.6):整体可浏览,但局部密度、间距或区块节奏有明显问题
70
+ - [0.6, 0.8):留白与内容密度总体合理,仅有少量轻微问题
71
+ - [0.8, 1.0]:留白、间距和区块节奏自然一致,密度控制成熟
72
+
73
+ {richness}
74
+ {nq}. query_fulfillment(需求实现度)
75
+ - [0.0, 0.2):截图可见内容基本没有实现 query,或主题完全错误
76
+ - [0.2, 0.4):只实现少量表面元素,多数核心要求缺失
77
+ - [0.4, 0.6):实现主要方向,但多个关键板块、要素或功能界面明显缺失
78
+ - [0.6, 0.8):主体要求已实现,仅有少量次要缺失或偏差
79
+ - [0.8, 1.0]:截图可见范围内完整、准确地实现 query 的主题、板块、要素和功能界面
80
+
81
+ {na}. premium_assets(高级素材与质感)
82
+ - [0.0, 0.2):无有效视觉素材,或主要依赖简陋 emoji、裸占位、低质/模糊图像
83
+ - [0.2, 0.4):素材较普通或粗糙,缺乏统一设计感;少量装饰不能形成质感
84
+ - [0.4, 0.6):素材清晰且基本协调,但主要是普��图片或纯 CSS 视觉,没有高级素材
85
+ - [0.6, 0.8):使用了高品质真实图片、艺术化图像、成体系插画或精致 mockup,整体质感良好但仍有小缺陷
86
+ - [0.8, 1.0]:高级素材质量突出、体系完整,并与版式高度融合,达到成熟专业作品水准"""
87
+
88
+ RICHNESS = """5. content_richness(内容丰富度)
89
+ - [0.0, 0.2):近乎空壳,一屏都撑不满,只有标题、空架子或极少占位内容
90
+ - [0.2, 0.4):只有 1–2 个简单板块,内容高度重复、空泛或以占位为主
91
+ - [0.4, 0.6):已有若干实际板块,但数量或内容深度明显不足以支撑完整网站
92
+ - [0.6, 0.8):板块较完整、内容较具体,仅少数部分偏单薄
93
+ - [0.8, 1.0]:约 4 个及以上成形板块,内容具体充实,足以支撑完整网站体验"""
94
+
95
+
96
+ VISUAL_KEYS = ("layout_integrity", "typography_hierarchy", "color_harmony", "whitespace", "content_richness")
97
+ SCORE_KEYS = ("visual", "query_fulfillment", "premium_assets") # 等权平均的三项
98
+ ALL_KEYS = VISUAL_KEYS + ("query_fulfillment", "premium_assets")
99
+ RUBRIC_ID = "rva1:mean(visual,query,asset)"
100
+
101
+
102
+ def build_prompt() -> str:
103
+ """评测用的 7 维 prompt(含 content_richness)。`{query}` 占位符留给调用方 format。"""
104
+ dims = BANDS.format(richness=RICHNESS, nq=6, na=7)
105
+ return f"""你是网页 UI 评审。只依据 fullpage 截图可见证据评分。前 5 项构成 visual:前四项只评客观视觉问题,第五项评完整网站所需的信息量;第 6 项依据 query;第 7 项评素材品质。各维独立判断,不要因为某一维表现好或差而连带改变其它维。
106
+
107
+ query: {{query}}
108
+
109
+ 每个维度输出 0 到 1 的连续分数,可使用任意小数。先依据该维的五段描述确定分数所在区间,再根据问题严重程度、数量和影响在区间内连续取值;不要只输出区间端点或固定档位。五段边界统一为 [0.0,0.2)、[0.2,0.4)、[0.4,0.6)、[0.6,0.8)、[0.8,1.0]。临界情况选择与可见证据最匹配的相邻区间。premium_assets 没有高级素材时不得进入 [0.6,1.0]。
110
+
111
+ {dims}
112
+
113
+ 空白、严重加载失败或完全不可见时,所有维度输出 0。仅输出 JSON,不要 markdown:
114
+ {{{{"layout_integrity":0.0,"typography_hierarchy":0.0,"color_harmony":0.0,"whitespace":0.0,"content_richness":0.0,"query_fulfillment":0.0,"premium_assets":0.0,"reason":"核心依据"}}}}"""
115
+
116
+
117
+ __all__ = ["BANDS", "RICHNESS", "VISUAL_KEYS", "SCORE_KEYS", "ALL_KEYS", "RUBRIC_ID", "build_prompt"]
tasks/dasyn_260630_00015/tests/webdev/shot.py ADDED
@@ -0,0 +1,249 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright 2026 Bytedance Ltd. and/or its affiliates
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+ """In-pod full-page screenshot pipeline: playwright inside the agent's own sandbox.
15
+
16
+ Only the EVALUATION path uses this. Training ships the workspace to the grading service and
17
+ lets it render; evaluation renders here instead, so that it does not depend on that service
18
+ running -- evaluation is usually done in an environment that has no such long-lived service.
19
+
20
+ ``_SHOT_SCRIPT`` is kept **byte for byte**. Every non-obvious line in it encodes a failure
21
+ that was actually hit and diagnosed in a pod: proxy auth handed to the wrong playwright
22
+ field, a loopback bypass that the dict API silently drops, blank ``file://`` renders of
23
+ runtime-rendered pages, reveal-on-scroll content captured at opacity 0, sticky headers
24
+ painted at an in-flight scroll offset, parallax backgrounds going black below the fold. Read
25
+ the inline comments before changing any of it; none of these failures announce themselves --
26
+ they all arrive as a plausible-looking screenshot that scores badly.
27
+
28
+ The sandbox image must carry node, playwright and chromium. A missing chromium surfaces as
29
+ ``render_failed``, which the caller masks, rather than as a bad score.
30
+ """
31
+
32
+ from __future__ import annotations
33
+
34
+ import base64
35
+ import json
36
+ import os
37
+ import shlex
38
+
39
+ _SHOT_SCRIPT = r'''
40
+ import sys, json, base64, argparse
41
+ from playwright.sync_api import sync_playwright
42
+ ap = argparse.ArgumentParser()
43
+ ap.add_argument("--url", required=True)
44
+ ap.add_argument("--actions-b64", default="")
45
+ ap.add_argument("--proxy", default="") # comma-separated failover chain; empty entry = direct
46
+ ap.add_argument("--vw", type=int, default=1440)
47
+ ap.add_argument("--vh", type=int, default=900)
48
+ ap.add_argument("--serve-root", default="") # serve this dir over local http and rewrite --url onto it
49
+ a = ap.parse_args()
50
+ if a.serve_root:
51
+ import threading, functools
52
+ from http.server import ThreadingHTTPServer, SimpleHTTPRequestHandler
53
+ class _QuietHandler(SimpleHTTPRequestHandler):
54
+ def log_message(self, *args, **kw): # keep stdout clean for SHOT_B64 parsing
55
+ pass
56
+ _handler = functools.partial(_QuietHandler, directory=a.serve_root)
57
+ _srv = ThreadingHTTPServer(("127.0.0.1", 0), _handler)
58
+ threading.Thread(target=_srv.serve_forever, daemon=True).start()
59
+ _page = a.url.rsplit("/", 1)[-1] if a.url.rsplit("/", 1)[-1].endswith(".html") else "index.html"
60
+ a.url = "http://127.0.0.1:%d/%s" % (_srv.server_address[1], _page)
61
+ actions = json.loads(base64.b64decode(a.actions_b64).decode()) if a.actions_b64 else []
62
+ BASE_LAUNCH = {"headless": True, "args": ["--no-sandbox", "--disable-dev-shm-usage",
63
+ "--proxy-bypass-list=127.0.0.1;localhost"]}
64
+
65
+ def _proxy_cfg(purl):
66
+ from urllib.parse import urlparse as _up
67
+ _pu = _up(purl)
68
+ cfg = {"server": _pu.scheme + "://" + _pu.hostname + ":" + str(_pu.port)}
69
+ if _pu.username:
70
+ cfg["username"] = _pu.username
71
+ cfg["password"] = _pu.password or ""
72
+ return cfg
73
+
74
+ proxy_chain = [s.strip() for s in a.proxy.split(",")] if a.proxy else [""]
75
+ if a.proxy and "" not in proxy_chain:
76
+ proxy_chain.append("")
77
+ FATAL_NET = ("ERR_PROXY_CONNECTION_FAILED", "ERR_TUNNEL_CONNECTION_FAILED",
78
+ "ERR_SOCKS_CONNECTION_FAILED", "ERR_NAME_NOT_RESOLVED",
79
+ "ERR_INTERNET_DISCONNECTED", "ERR_CONNECTION_TIMED_OUT",
80
+ "ERR_CONNECTION_REFUSED", "ERR_CONNECTION_RESET", "ERR_TIMED_OUT",
81
+ "ERR_EMPTY_RESPONSE")
82
+ errs = []
83
+ fatal = [] # fatal external request failures of the CURRENT load attempt
84
+ render_env = {"proxy_failed": False, "recovered": None, "attempts": [], "fatal": []}
85
+
86
+ def _on_request_failed(req):
87
+ try:
88
+ u = req.url or ""
89
+ if not u.startswith("http") or u.startswith("http://127.0.0.1") or u.startswith("http://localhost"):
90
+ return # local server / file:// subresources are page defects, not env
91
+ f = req.failure or ""
92
+ if any(k in f for k in FATAL_NET):
93
+ fatal.append(f + " " + u[:120])
94
+ except Exception:
95
+ pass
96
+
97
+ SETTLE_JS = """async () => {
98
+ try {
99
+ document.documentElement.style.setProperty('scroll-behavior', 'auto', 'important');
100
+ if (document.body) document.body.style.setProperty('scroll-behavior', 'auto', 'important');
101
+ } catch (e) {}
102
+ if (document.fonts && document.fonts.ready) { try { await document.fonts.ready; } catch (e) {} }
103
+ const H = () => Math.max(document.body.scrollHeight, document.documentElement.scrollHeight);
104
+ const step = Math.max(400, Math.floor(window.innerHeight * 0.8));
105
+ for (let y = 0; y <= Math.min(H(), 30000); y += step) {
106
+ window.scrollTo(0, y);
107
+ await new Promise(r => setTimeout(r, 120));
108
+ }
109
+ window.scrollTo(0, H());
110
+ await new Promise(r => setTimeout(r, 400));
111
+ window.scrollTo(0, 0);
112
+ await new Promise(r => setTimeout(r, 300));
113
+ }"""
114
+ FREEZE_CSS = ("*,*::before,*::after{animation-delay:0s !important;animation-duration:.01s !important;"
115
+ "transition-delay:0s !important;transition-duration:.01s !important;"
116
+ "background-attachment:scroll !important;scroll-behavior:auto !important;}")
117
+
118
+ with sync_playwright() as p:
119
+ b = None
120
+ pg = None
121
+
122
+ def _open(purl):
123
+ global b, pg
124
+ if b is not None:
125
+ try:
126
+ b.close()
127
+ except Exception:
128
+ pass
129
+ kw = dict(BASE_LAUNCH)
130
+ if purl:
131
+ kw["proxy"] = _proxy_cfg(purl)
132
+ b = p.chromium.launch(**kw)
133
+ pg = b.new_context(viewport={"width": a.vw, "height": a.vh}).new_page()
134
+ pg.on("console", lambda m: errs.append(m.text) if m.type == "error" else None)
135
+ pg.on("pageerror", lambda e: errs.append("pageerror: " + str(e)))
136
+ pg.on("requestfailed", _on_request_failed)
137
+
138
+ def _load():
139
+ del fatal[:]
140
+ try:
141
+ resp = pg.goto(a.url, wait_until="load", timeout=25000)
142
+ if resp is not None and a.url.startswith("http") and resp.status >= 500:
143
+ fatal.append("PAGE_HTTP_%d %s" % (resp.status, a.url[:120]))
144
+ except Exception as e:
145
+ errs.append("goto failed: " + str(e))
146
+ pg.wait_for_timeout(2000)
147
+
148
+ for i, purl in enumerate(proxy_chain):
149
+ label = (purl.split("@")[-1] or "direct") if purl else "direct"
150
+ try:
151
+ _open(purl)
152
+ _load()
153
+ except Exception as e:
154
+ errs.append("launch failed via " + label + ": " + str(e))
155
+ del fatal[:]
156
+ fatal.append("LAUNCH_FAILED " + label)
157
+ if fatal:
158
+ render_env["attempts"].append({"via": label, "fatal": fatal[:3]})
159
+ if pg is not None and not fatal[0].startswith("LAUNCH_FAILED"):
160
+ _load()
161
+ if not fatal and pg is not None:
162
+ if render_env["attempts"]:
163
+ render_env["recovered"] = "via " + label
164
+ break
165
+ render_env["proxy_failed"] = bool(fatal) or pg is None
166
+ render_env["fatal"] = fatal[:5]
167
+ if pg is None: # every route failed to even open a browser: report env, no shot
168
+ sys.stdout.write("CONSOLE_ERRORS:" + json.dumps(errs[:15]) + "\n")
169
+ sys.stdout.write("RENDER_ENV:" + json.dumps(render_env) + "\n")
170
+ sys.exit(0)
171
+ try:
172
+ pg.evaluate(SETTLE_JS)
173
+ pg.add_style_tag(content=FREEZE_CSS)
174
+ pg.wait_for_timeout(300)
175
+ except Exception as e:
176
+ errs.append("settle failed: " + str(e))
177
+ for act in actions:
178
+ t = act.get("type")
179
+ try:
180
+ if t == "click":
181
+ pg.click(act["selector"], timeout=5000)
182
+ elif t == "fill":
183
+ pg.fill(act["selector"], act.get("value", ""), timeout=5000)
184
+ pg.wait_for_timeout(800)
185
+ except Exception as e:
186
+ errs.append("action " + json.dumps(act) + " failed: " + str(e))
187
+ try:
188
+ pg.evaluate("window.scrollTo(0, 0)")
189
+ pg.wait_for_timeout(250)
190
+ except Exception as e:
191
+ errs.append("scroll-top failed: " + str(e))
192
+ png = pg.screenshot(full_page=True, type="jpeg", quality=75)
193
+ b.close()
194
+ sys.stdout.write("SHOT_B64:" + base64.b64encode(png).decode() + "\n")
195
+ sys.stdout.write("CONSOLE_ERRORS:" + json.dumps(errs[:15]) + "\n")
196
+ sys.stdout.write("RENDER_ENV:" + json.dumps(render_env) + "\n")
197
+ '''
198
+
199
+
200
+ def _build_shot_cmd(url: str, *, actions_b64: str = "", proxy: str = "") -> str:
201
+ """Pod-side command that runs _SHOT_SCRIPT against `url`. Shared by ScreenshotTool
202
+ (feeds the multimodal grader) and capture_fullpage (lands the JPEG to disk).
203
+
204
+ ``WEBDEV_GRADE_HTTP=1`` switches ``file://`` rendering to a loopback http server inside
205
+ the shot script (see ``--serve-root``) so runtime-rendered pages actually execute. **The
206
+ launcher sets this on**, and it must stay on: browsers block module loading, fetch and
207
+ XHR on the file protocol, so a React, Vue or ES-module deliverable renders as an empty
208
+ body no matter how good it is -- measured at 44 of 182 shots blank, essentially all of
209
+ them runtime-rendered. Since React is named in 30% of the training briefs, the old
210
+ default was scoring a large share of the task pool as necessarily broken and teaching the
211
+ policy to avoid the very stack the brief asked for.
212
+
213
+ Scores across this boundary are NOT comparable: a React page goes from certainly-0 to
214
+ gradeable. Set it to 0 only to reproduce a pre-flip run.
215
+ """
216
+ script_b64 = base64.b64encode(_SHOT_SCRIPT.encode()).decode()
217
+ serve_root = ""
218
+ if os.environ.get("WEBDEV_GRADE_HTTP") == "1" and url.startswith("file://"):
219
+ serve_root = os.path.dirname(url[len("file://") :]) or "/"
220
+ return (
221
+ f"echo {script_b64} | base64 -d > /tmp/_webdev_shot.py && "
222
+ f"python3 /tmp/_webdev_shot.py --url {shlex.quote(url)} "
223
+ f"--actions-b64 {shlex.quote(actions_b64)} --proxy {shlex.quote(proxy)}"
224
+ + (f" --serve-root {shlex.quote(serve_root)}" if serve_root else "")
225
+ )
226
+
227
+
228
+ def _parse_shot_b64(r: dict) -> tuple[str, str]:
229
+ """Pull (SHOT_B64, CONSOLE_ERRORS) out of an env.execute result; empty b64 on miss."""
230
+ out = r.get("output") or ""
231
+ shot_b64, console_errors = "", "[]"
232
+ for line in out.splitlines():
233
+ if line.startswith("SHOT_B64:"):
234
+ shot_b64 = line[len("SHOT_B64:") :].strip()
235
+ elif line.startswith("CONSOLE_ERRORS:"):
236
+ console_errors = line[len("CONSOLE_ERRORS:") :].strip()
237
+ return shot_b64, console_errors
238
+
239
+
240
+ def _parse_render_env(r: dict) -> dict:
241
+ """Pull the RENDER_ENV json out of an env.execute result. {} when absent
242
+ (old pod script) or unparseable — callers treat that as env-healthy."""
243
+ for line in (r.get("output") or "").splitlines():
244
+ if line.startswith("RENDER_ENV:"):
245
+ try:
246
+ return json.loads(line[len("RENDER_ENV:") :].strip())
247
+ except Exception:
248
+ return {}
249
+ return {}
tasks/dasyn_260630_00015/tests/webdev/verdict.py ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright 2026 Xiaomi / the verl authors. Apache-2.0 (see ../LICENSE-verl.txt).
2
+ # `parse_verdict` copied unchanged from XiaomiMiMo/verl recipes/design/webdev/eval_mode.py.
3
+ import json
4
+ import re
5
+
6
+ from .eval_rubric import ALL_KEYS, VISUAL_KEYS
7
+
8
+ _JSON_RE = re.compile(r"\{.*\}", re.DOTALL)
9
+
10
+
11
+ def parse_verdict(raw_text: str) -> dict:
12
+ """Judge JSON -> per-dimension scores, ``visual``, ``score``, ``reason``.
13
+
14
+ Returns ``{"_failed": why}`` when it cannot be parsed. A missing dimension counts as a
15
+ parse failure rather than defaulting to 0: defaulting would turn "the judge forgot to
16
+ mention a dimension" into "the page scores 0 on it", inventing a low score out of
17
+ nothing.
18
+ """
19
+ m = _JSON_RE.search(raw_text or "")
20
+ if not m:
21
+ return {"_failed": f"no json in judge output: {(raw_text or '')[:160]}"}
22
+ try:
23
+ data = json.loads(m.group(0))
24
+ except Exception as e: # noqa: BLE001
25
+ return {"_failed": f"json error: {type(e).__name__}: {e}"}
26
+ dims: dict[str, float] = {}
27
+ for k in ALL_KEYS:
28
+ v = data.get(k)
29
+ if v is None:
30
+ return {"_failed": f"judge omitted dimension {k!r}"}
31
+ try:
32
+ dims[k] = max(0.0, min(1.0, float(v)))
33
+ except (TypeError, ValueError):
34
+ return {"_failed": f"dimension {k!r} is not a number: {v!r}"}
35
+ visual = sum(dims[k] for k in VISUAL_KEYS) / len(VISUAL_KEYS)
36
+ score = (visual + dims["query_fulfillment"] + dims["premium_assets"]) / 3.0
37
+ return {
38
+ "dims": dims,
39
+ "visual": round(visual, 4),
40
+ "score": round(score, 4),
41
+ "reason": str(data.get("reason", ""))[:500],
42
+ }
tasks/dasyn_260630_00025/environment/Dockerfile ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ # The task's image, pinned by digest (the same as [environment].docker_image).
2
+ # Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy.
3
+ FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:6e30e61bdbe1504470cd1f705b120d317da9e7f57df3ba04a906db6b2e95e14d
tasks/dasyn_260630_00025/environment/setup/setup.sh ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+ # Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into
3
+ # /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness.
4
+ M=/var/lib/mimo
5
+ [ -f "$M/ready" ] && exit 0
6
+ chmod 700 "$M"
7
+ fail() { echo "setup: $*" >&2; exit 1; }
8
+ # the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs
9
+ write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; }
10
+
11
+ # Webdev: verl recipes/design webdev-eval, as the explorer runs it. No blocklist: npm and CDNs are fair game.
12
+ mkdir -p /workspace/dist
13
+
14
+ touch "$M/ready"
15
+ echo "setup done"
tasks/dasyn_260630_00025/tests/grade.json ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ {
2
+ "cwd": "/workspace",
3
+ "query": "Design a clean swiss style landing page for an online entertainment store like Amazon but only for movies, music albums, comedy shows and event tickets, make it static front end only with sample products and fake prices. I want a hero section with big bold typography, white space, black red and yellow accent colors, product cards arranged like amazon deals, featured categories, best sellers, new releases, customer ratings shown as static stars, and a simple cart preview area. Add drag and drop interaction where users can drag product cards into a wishlist or cart box and use GSAP animations for smooth card movement, hover effects, section reveal and banner transitions. Include sections for today entertainment deals, streaming bundles, concert pass offers, kids shows, and gift cards. Make it look professional and easy to shop, responsive for mobile and desktop, no login, no payment, no real checkout, no backend or database, just mock content and static sample images/placeholders. Add editable contact/footer text and a promo strip like Amazon but more modern and minimal."
4
+ }
tasks/dasyn_260630_00025/tests/grade.py ADDED
@@ -0,0 +1,88 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Grade a Webdev task as the explorer does (verl recipes/design webdev-eval): render, shrink, judge.
2
+
3
+ No index.html in dist/ scores 0. A render that fails, or a judge that never answers, writes no reward (not scored):
4
+ neither says anything about the page."""
5
+ import base64
6
+ import io
7
+ import json
8
+ import os
9
+ import random
10
+ import subprocess
11
+ import sys
12
+ import time
13
+ import urllib.request
14
+ from pathlib import Path
15
+
16
+ sys.path.insert(0, "/tests")
17
+ os.environ["WEBDEV_GRADE_HTTP"] = "1" # serve over loopback http so React/Vue/ES-module sites actually run
18
+ from webdev.eval_rubric import build_prompt # noqa: E402
19
+ from webdev.shot import _build_shot_cmd, _parse_render_env, _parse_shot_b64 # noqa: E402
20
+ from webdev.verdict import parse_verdict # noqa: E402
21
+
22
+ cfg = json.loads(Path("/tests/grade.json").read_text())
23
+ V = Path("/logs/verifier")
24
+ V.mkdir(parents=True, exist_ok=True)
25
+ dist = Path(cfg["cwd"]) / "dist"
26
+
27
+
28
+ def done(reward: float | None, why: str, **extra) -> None:
29
+ (V / "result.json").write_text(json.dumps({"reward": reward, "summary": why, **extra}, indent=1))
30
+ print(why)
31
+ if reward is None:
32
+ print("not scored", file=sys.stderr)
33
+ sys.exit(1)
34
+ (V / "reward.txt").write_text(f"{reward}\n")
35
+ sys.exit(0)
36
+
37
+
38
+ files = sorted(str(p.relative_to(dist)) for p in dist.rglob("*") if p.is_file())[:200] if dist.is_dir() else []
39
+ if "index.html" not in files:
40
+ done(0.0, "The agent delivered nothing to dist/." if not files else "dist/ has no index.html, so there is no page to open.",
41
+ delivered=files)
42
+ res = subprocess.run(["sh", "-c", _build_shot_cmd(f"file://{dist}/index.html")], capture_output=True, text=True,
43
+ timeout=150) # SHOT_TIMEOUT_S
44
+ shot = {"output": (res.stdout or "") + "\n" + (res.stderr or "")}
45
+ shot_b64, console_errors = _parse_shot_b64(shot)
46
+ render_env = _parse_render_env(shot)
47
+ if render_env.get("proxy_failed") or not shot_b64:
48
+ print(shot["output"][-2000:], file=sys.stderr)
49
+ done(None, "external assets were unreachable on every route" if render_env.get("proxy_failed")
50
+ else "the screenshot produced no image")
51
+ jpg = base64.b64decode(shot_b64)
52
+ try: # eval_mode._shrink: the judge refuses shots over 20 MP; proportional, quality 75
53
+ from PIL import Image
54
+ Image.MAX_IMAGE_PIXELS = None
55
+ im = Image.open(io.BytesIO(jpg))
56
+ size = im.size
57
+ if im.width * im.height > 20e6:
58
+ k = (20e6 / (im.width * im.height)) ** 0.5
59
+ im = im.convert("RGB").resize((max(1, int(im.width * k)), max(1, int(im.height * k))), Image.LANCZOS)
60
+ b = io.BytesIO(); im.save(b, "JPEG", quality=75); jpg = b.getvalue(); size = im.size
61
+ except ImportError:
62
+ size = None
63
+ (V / "screenshot.jpg").write_bytes(jpg)
64
+ content = [{"type": "image_url", "image_url": {"url": "data:image/jpeg;base64," + base64.b64encode(jpg).decode()}},
65
+ {"type": "text", "text": build_prompt().format(query=cfg["query"][:1500])}] # QUERY_CAP
66
+ url = os.environ.get("WEBDEV_JUDGE_URL", "https://router.huggingface.co/v1").rstrip("/") + "/chat/completions"
67
+ body = json.dumps({"model": os.environ["WEBDEV_JUDGE_MODEL"], "temperature": 1.0,
68
+ "messages": [{"role": "user", "content": content}]}).encode()
69
+ verdict, last = None, ""
70
+ for attempt in range(4): # JUDGE_RETRIES, with eval_mode's backoff
71
+ if attempt:
72
+ time.sleep(min(60.0, 3.0 * (3 ** (attempt - 1))) * (0.5 + random.random()))
73
+ try:
74
+ req = urllib.request.Request(url, data=body, method="POST", headers={
75
+ "Content-Type": "application/json", "Authorization": f"Bearer {os.environ.get('WEBDEV_JUDGE_KEY', '')}"})
76
+ with urllib.request.urlopen(req, timeout=180) as r: # JUDGE_TIMEOUT_S
77
+ msg = json.loads(r.read())["choices"][0]["message"]
78
+ v = parse_verdict(msg.get("content") or msg.get("reasoning_content") or "")
79
+ if "_failed" not in v:
80
+ verdict = v
81
+ break
82
+ last = v["_failed"]
83
+ except Exception as e: # noqa: BLE001
84
+ last = f"{type(e).__name__}: {e}"[:200]
85
+ if not verdict:
86
+ done(None, f"judge unavailable: {last}")
87
+ done(verdict["score"], verdict.get("reason", ""), dims=verdict["dims"], visual=verdict["visual"], screenshot_size=size,
88
+ console_errors=console_errors[:1500] if console_errors not in ("", "[]") else "")
tasks/dasyn_260630_00025/tests/test.sh ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ #!/bin/bash
2
+ # Webdev grading: a full-page render of dist/index.html, judged by a vision model against the brief.
3
+ mkdir -p /logs/verifier
4
+ cd /tests && python3 /tests/grade.py
tasks/dasyn_260630_00025/tests/webdev/__init__.py ADDED
File without changes
tasks/dasyn_260630_00025/tests/webdev/eval_rubric.py ADDED
@@ -0,0 +1,117 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright 2026 Bytedance Ltd. and/or its affiliates
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+ """The seven-dimension evaluation rubric. **The wording below is the ruler itself.**
15
+
16
+ One vision call returns seven dimensions, and the evaluation score is an equal-weight mean
17
+ of three of them::
18
+
19
+ score = (visual + query_fulfillment + premium_assets) / 3
20
+ visual = mean(layout_integrity, typography_hierarchy, color_harmony,
21
+ whitespace, content_richness)
22
+
23
+ ``BANDS`` and ``RICHNESS`` are kept **byte for byte** as the run that produced this arm's
24
+ published numbers used them, and they are in Chinese for the same reason. They are not
25
+ documentation of a scoring policy -- they ARE the scoring policy, handed to the judge model
26
+ verbatim. Translating or rewording them measures something else and makes every historical
27
+ result incomparable. To change the rubric, copy this file and change ``RUBRIC_ID``; a test
28
+ pins the rendered prompt's hash so an accidental edit fails loudly instead of silently
29
+ shifting the reward distribution.
30
+
31
+ Two deliberate differences from the earlier four-term formula:
32
+
33
+ * The fourth term (a static code check, weight 0.1) is gone. Its dominant component was an
34
+ INVERSE indicator: bucketing by ``premium_assets``, rows in [0, 0.2) averaged 0.900 on it
35
+ while rows in [0.8, 1.0] averaged only 0.425, with ``visual`` rising monotonically across
36
+ the same buckets. It was paying a bonus for not daring to reference external assets --
37
+ the highest-scoring arm on that term was the one that referenced the fewest (0.823,
38
+ against 0.638 and 0.648 for the RL arms).
39
+ * The remaining three are equal-weight rather than 0.6 / 0.1 / 0.2. ``premium_assets``
40
+ separates the arms most sharply (0.417 against 0.619, a gap of 0.20, where ``visual``
41
+ differs by 0.042 and ``query`` by 0.054), so equal weighting stops a 0.6-weighted
42
+ ``visual`` from drowning out the dimension that actually discriminates.
43
+ """
44
+
45
+ BANDS = """1. layout_integrity(布局完整性)
46
+ - [0.0, 0.2):布局严重损坏,核心内容大面积重叠、截断、溢出或无法阅读
47
+ - [0.2, 0.4):多处明显布局错误,显著影响主要内容使用
48
+ - [0.4, 0.6):主体可用,但有一处严重或多处明显的对齐、重叠、超框问题
49
+ - [0.6, 0.8):整体完整,仅有少量轻微对齐、间距或边界问题
50
+ - [0.8, 1.0]:布局完整稳定,未见可感知的重叠、错位、截断或溢出
51
+
52
+ 2. typography_hierarchy(排版层级)
53
+ - [0.0, 0.2):文字普遍不可读,字号/层级严重失控
54
+ - [0.2, 0.4):标题正文层级混乱,多处字号、行高或字重明显不当
55
+ - [0.4, 0.6):基本可读,但层级辨识或排版节奏存在明显缺陷
56
+ - [0.6, 0.8):层级清楚、阅读顺畅,仅有少量轻微排版问题
57
+ - [0.8, 1.0]:标题、正文、辅助文字层级鲜明且比例、行高、字重均成熟
58
+
59
+ 3. color_harmony(配色与对比)
60
+ - [0.0, 0.2):配色严重冲突或关键文字几乎无法辨认
61
+ - [0.2, 0.4):多处颜色不协调、对比不足,明显损害观感或可读性
62
+ - [0.4, 0.6):基本可用,但色彩体系、对比或一致性有明显问题
63
+ - [0.6, 0.8):配色协调且可读,仅有少量轻微不一致或对比问题
64
+ - [0.8, 1.0]:色彩体系统一成熟,对比清晰,无明显问题
65
+
66
+ 4. whitespace(留白与密度)
67
+ - [0.0, 0.2):页面极度拥挤或空洞,信息组织基本失效
68
+ - [0.2, 0.4):多处明显过密/过空,严重破坏浏览节奏
69
+ - [0.4, 0.6):整体可浏览,但局部密度、间距或区块节奏有明显问题
70
+ - [0.6, 0.8):留白与内容密度总体合理,仅有少量轻微问题
71
+ - [0.8, 1.0]:留白、间距和区块节奏自然一致,密度控制成熟
72
+
73
+ {richness}
74
+ {nq}. query_fulfillment(需求实现度)
75
+ - [0.0, 0.2):截图可见内容基本没有实现 query,或主题完全错误
76
+ - [0.2, 0.4):只实现少量表面元素,多数核心要求缺失
77
+ - [0.4, 0.6):实现主要方向,但多个关键板块、要素或功能界面明显缺失
78
+ - [0.6, 0.8):主体要求已实现,仅有少量次要缺失或偏差
79
+ - [0.8, 1.0]:截图可见范围内完整、准确地实现 query 的主题、板块、要素和功能界面
80
+
81
+ {na}. premium_assets(高级素材与质感)
82
+ - [0.0, 0.2):无有效视觉素材,或主要依赖简陋 emoji、裸占位、低质/模糊图像
83
+ - [0.2, 0.4):素材较普通或粗糙,缺乏统一设计感;少量装饰不能形成质感
84
+ - [0.4, 0.6):素材清晰且基本协调,但主要是普��图片或纯 CSS 视觉,没有高级素材
85
+ - [0.6, 0.8):使用了高品质真实图片、艺术化图像、成体系插画或精致 mockup,整体质感良好但仍有小缺陷
86
+ - [0.8, 1.0]:高级素材质量突出、体系完整,并与版式高度融合,达到成熟专业作品水准"""
87
+
88
+ RICHNESS = """5. content_richness(内容丰富度)
89
+ - [0.0, 0.2):近乎空壳,一屏都撑不满,只有标题、空架子或极少占位内容
90
+ - [0.2, 0.4):只有 1–2 个简单板块,内容高度重复、空泛或以占位为主
91
+ - [0.4, 0.6):已有若干实际板块,但数量或内容深度明显不足以支撑完整网站
92
+ - [0.6, 0.8):板块较完整、内容较具体,仅少数部分偏单薄
93
+ - [0.8, 1.0]:约 4 个及以上成形板块,内容具体充实,足以支撑完整网站体验"""
94
+
95
+
96
+ VISUAL_KEYS = ("layout_integrity", "typography_hierarchy", "color_harmony", "whitespace", "content_richness")
97
+ SCORE_KEYS = ("visual", "query_fulfillment", "premium_assets") # 等权平均的三项
98
+ ALL_KEYS = VISUAL_KEYS + ("query_fulfillment", "premium_assets")
99
+ RUBRIC_ID = "rva1:mean(visual,query,asset)"
100
+
101
+
102
+ def build_prompt() -> str:
103
+ """评测用的 7 维 prompt(含 content_richness)。`{query}` 占位符留给调用方 format。"""
104
+ dims = BANDS.format(richness=RICHNESS, nq=6, na=7)
105
+ return f"""你是网页 UI 评审。只依据 fullpage 截图可见证据评分。前 5 项构成 visual:前四项只评客观视觉问题,第五项评完整网站所需的信息量;第 6 项依据 query;第 7 项评素材品质。各维独立判断,不要因为某一维表现好或差而连带改变其它维。
106
+
107
+ query: {{query}}
108
+
109
+ 每个维度输出 0 到 1 的连续分数,可使用任意小数。先依据该维的五段描述确定分数所在区间,再根据问题严重程度、数量和影响在区间内连续取值;不要只输出区间端点或固定档位。五段边界统一为 [0.0,0.2)、[0.2,0.4)、[0.4,0.6)、[0.6,0.8)、[0.8,1.0]。临界情况选择与可见证据最匹配的相邻区间。premium_assets 没有高级素材时不得进入 [0.6,1.0]。
110
+
111
+ {dims}
112
+
113
+ 空白、严重加载失败或完全不可见时,所有维度输出 0。仅输出 JSON,不要 markdown:
114
+ {{{{"layout_integrity":0.0,"typography_hierarchy":0.0,"color_harmony":0.0,"whitespace":0.0,"content_richness":0.0,"query_fulfillment":0.0,"premium_assets":0.0,"reason":"核心依据"}}}}"""
115
+
116
+
117
+ __all__ = ["BANDS", "RICHNESS", "VISUAL_KEYS", "SCORE_KEYS", "ALL_KEYS", "RUBRIC_ID", "build_prompt"]
tasks/dasyn_260630_00025/tests/webdev/shot.py ADDED
@@ -0,0 +1,249 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright 2026 Bytedance Ltd. and/or its affiliates
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+ """In-pod full-page screenshot pipeline: playwright inside the agent's own sandbox.
15
+
16
+ Only the EVALUATION path uses this. Training ships the workspace to the grading service and
17
+ lets it render; evaluation renders here instead, so that it does not depend on that service
18
+ running -- evaluation is usually done in an environment that has no such long-lived service.
19
+
20
+ ``_SHOT_SCRIPT`` is kept **byte for byte**. Every non-obvious line in it encodes a failure
21
+ that was actually hit and diagnosed in a pod: proxy auth handed to the wrong playwright
22
+ field, a loopback bypass that the dict API silently drops, blank ``file://`` renders of
23
+ runtime-rendered pages, reveal-on-scroll content captured at opacity 0, sticky headers
24
+ painted at an in-flight scroll offset, parallax backgrounds going black below the fold. Read
25
+ the inline comments before changing any of it; none of these failures announce themselves --
26
+ they all arrive as a plausible-looking screenshot that scores badly.
27
+
28
+ The sandbox image must carry node, playwright and chromium. A missing chromium surfaces as
29
+ ``render_failed``, which the caller masks, rather than as a bad score.
30
+ """
31
+
32
+ from __future__ import annotations
33
+
34
+ import base64
35
+ import json
36
+ import os
37
+ import shlex
38
+
39
+ _SHOT_SCRIPT = r'''
40
+ import sys, json, base64, argparse
41
+ from playwright.sync_api import sync_playwright
42
+ ap = argparse.ArgumentParser()
43
+ ap.add_argument("--url", required=True)
44
+ ap.add_argument("--actions-b64", default="")
45
+ ap.add_argument("--proxy", default="") # comma-separated failover chain; empty entry = direct
46
+ ap.add_argument("--vw", type=int, default=1440)
47
+ ap.add_argument("--vh", type=int, default=900)
48
+ ap.add_argument("--serve-root", default="") # serve this dir over local http and rewrite --url onto it
49
+ a = ap.parse_args()
50
+ if a.serve_root:
51
+ import threading, functools
52
+ from http.server import ThreadingHTTPServer, SimpleHTTPRequestHandler
53
+ class _QuietHandler(SimpleHTTPRequestHandler):
54
+ def log_message(self, *args, **kw): # keep stdout clean for SHOT_B64 parsing
55
+ pass
56
+ _handler = functools.partial(_QuietHandler, directory=a.serve_root)
57
+ _srv = ThreadingHTTPServer(("127.0.0.1", 0), _handler)
58
+ threading.Thread(target=_srv.serve_forever, daemon=True).start()
59
+ _page = a.url.rsplit("/", 1)[-1] if a.url.rsplit("/", 1)[-1].endswith(".html") else "index.html"
60
+ a.url = "http://127.0.0.1:%d/%s" % (_srv.server_address[1], _page)
61
+ actions = json.loads(base64.b64decode(a.actions_b64).decode()) if a.actions_b64 else []
62
+ BASE_LAUNCH = {"headless": True, "args": ["--no-sandbox", "--disable-dev-shm-usage",
63
+ "--proxy-bypass-list=127.0.0.1;localhost"]}
64
+
65
+ def _proxy_cfg(purl):
66
+ from urllib.parse import urlparse as _up
67
+ _pu = _up(purl)
68
+ cfg = {"server": _pu.scheme + "://" + _pu.hostname + ":" + str(_pu.port)}
69
+ if _pu.username:
70
+ cfg["username"] = _pu.username
71
+ cfg["password"] = _pu.password or ""
72
+ return cfg
73
+
74
+ proxy_chain = [s.strip() for s in a.proxy.split(",")] if a.proxy else [""]
75
+ if a.proxy and "" not in proxy_chain:
76
+ proxy_chain.append("")
77
+ FATAL_NET = ("ERR_PROXY_CONNECTION_FAILED", "ERR_TUNNEL_CONNECTION_FAILED",
78
+ "ERR_SOCKS_CONNECTION_FAILED", "ERR_NAME_NOT_RESOLVED",
79
+ "ERR_INTERNET_DISCONNECTED", "ERR_CONNECTION_TIMED_OUT",
80
+ "ERR_CONNECTION_REFUSED", "ERR_CONNECTION_RESET", "ERR_TIMED_OUT",
81
+ "ERR_EMPTY_RESPONSE")
82
+ errs = []
83
+ fatal = [] # fatal external request failures of the CURRENT load attempt
84
+ render_env = {"proxy_failed": False, "recovered": None, "attempts": [], "fatal": []}
85
+
86
+ def _on_request_failed(req):
87
+ try:
88
+ u = req.url or ""
89
+ if not u.startswith("http") or u.startswith("http://127.0.0.1") or u.startswith("http://localhost"):
90
+ return # local server / file:// subresources are page defects, not env
91
+ f = req.failure or ""
92
+ if any(k in f for k in FATAL_NET):
93
+ fatal.append(f + " " + u[:120])
94
+ except Exception:
95
+ pass
96
+
97
+ SETTLE_JS = """async () => {
98
+ try {
99
+ document.documentElement.style.setProperty('scroll-behavior', 'auto', 'important');
100
+ if (document.body) document.body.style.setProperty('scroll-behavior', 'auto', 'important');
101
+ } catch (e) {}
102
+ if (document.fonts && document.fonts.ready) { try { await document.fonts.ready; } catch (e) {} }
103
+ const H = () => Math.max(document.body.scrollHeight, document.documentElement.scrollHeight);
104
+ const step = Math.max(400, Math.floor(window.innerHeight * 0.8));
105
+ for (let y = 0; y <= Math.min(H(), 30000); y += step) {
106
+ window.scrollTo(0, y);
107
+ await new Promise(r => setTimeout(r, 120));
108
+ }
109
+ window.scrollTo(0, H());
110
+ await new Promise(r => setTimeout(r, 400));
111
+ window.scrollTo(0, 0);
112
+ await new Promise(r => setTimeout(r, 300));
113
+ }"""
114
+ FREEZE_CSS = ("*,*::before,*::after{animation-delay:0s !important;animation-duration:.01s !important;"
115
+ "transition-delay:0s !important;transition-duration:.01s !important;"
116
+ "background-attachment:scroll !important;scroll-behavior:auto !important;}")
117
+
118
+ with sync_playwright() as p:
119
+ b = None
120
+ pg = None
121
+
122
+ def _open(purl):
123
+ global b, pg
124
+ if b is not None:
125
+ try:
126
+ b.close()
127
+ except Exception:
128
+ pass
129
+ kw = dict(BASE_LAUNCH)
130
+ if purl:
131
+ kw["proxy"] = _proxy_cfg(purl)
132
+ b = p.chromium.launch(**kw)
133
+ pg = b.new_context(viewport={"width": a.vw, "height": a.vh}).new_page()
134
+ pg.on("console", lambda m: errs.append(m.text) if m.type == "error" else None)
135
+ pg.on("pageerror", lambda e: errs.append("pageerror: " + str(e)))
136
+ pg.on("requestfailed", _on_request_failed)
137
+
138
+ def _load():
139
+ del fatal[:]
140
+ try:
141
+ resp = pg.goto(a.url, wait_until="load", timeout=25000)
142
+ if resp is not None and a.url.startswith("http") and resp.status >= 500:
143
+ fatal.append("PAGE_HTTP_%d %s" % (resp.status, a.url[:120]))
144
+ except Exception as e:
145
+ errs.append("goto failed: " + str(e))
146
+ pg.wait_for_timeout(2000)
147
+
148
+ for i, purl in enumerate(proxy_chain):
149
+ label = (purl.split("@")[-1] or "direct") if purl else "direct"
150
+ try:
151
+ _open(purl)
152
+ _load()
153
+ except Exception as e:
154
+ errs.append("launch failed via " + label + ": " + str(e))
155
+ del fatal[:]
156
+ fatal.append("LAUNCH_FAILED " + label)
157
+ if fatal:
158
+ render_env["attempts"].append({"via": label, "fatal": fatal[:3]})
159
+ if pg is not None and not fatal[0].startswith("LAUNCH_FAILED"):
160
+ _load()
161
+ if not fatal and pg is not None:
162
+ if render_env["attempts"]:
163
+ render_env["recovered"] = "via " + label
164
+ break
165
+ render_env["proxy_failed"] = bool(fatal) or pg is None
166
+ render_env["fatal"] = fatal[:5]
167
+ if pg is None: # every route failed to even open a browser: report env, no shot
168
+ sys.stdout.write("CONSOLE_ERRORS:" + json.dumps(errs[:15]) + "\n")
169
+ sys.stdout.write("RENDER_ENV:" + json.dumps(render_env) + "\n")
170
+ sys.exit(0)
171
+ try:
172
+ pg.evaluate(SETTLE_JS)
173
+ pg.add_style_tag(content=FREEZE_CSS)
174
+ pg.wait_for_timeout(300)
175
+ except Exception as e:
176
+ errs.append("settle failed: " + str(e))
177
+ for act in actions:
178
+ t = act.get("type")
179
+ try:
180
+ if t == "click":
181
+ pg.click(act["selector"], timeout=5000)
182
+ elif t == "fill":
183
+ pg.fill(act["selector"], act.get("value", ""), timeout=5000)
184
+ pg.wait_for_timeout(800)
185
+ except Exception as e:
186
+ errs.append("action " + json.dumps(act) + " failed: " + str(e))
187
+ try:
188
+ pg.evaluate("window.scrollTo(0, 0)")
189
+ pg.wait_for_timeout(250)
190
+ except Exception as e:
191
+ errs.append("scroll-top failed: " + str(e))
192
+ png = pg.screenshot(full_page=True, type="jpeg", quality=75)
193
+ b.close()
194
+ sys.stdout.write("SHOT_B64:" + base64.b64encode(png).decode() + "\n")
195
+ sys.stdout.write("CONSOLE_ERRORS:" + json.dumps(errs[:15]) + "\n")
196
+ sys.stdout.write("RENDER_ENV:" + json.dumps(render_env) + "\n")
197
+ '''
198
+
199
+
200
+ def _build_shot_cmd(url: str, *, actions_b64: str = "", proxy: str = "") -> str:
201
+ """Pod-side command that runs _SHOT_SCRIPT against `url`. Shared by ScreenshotTool
202
+ (feeds the multimodal grader) and capture_fullpage (lands the JPEG to disk).
203
+
204
+ ``WEBDEV_GRADE_HTTP=1`` switches ``file://`` rendering to a loopback http server inside
205
+ the shot script (see ``--serve-root``) so runtime-rendered pages actually execute. **The
206
+ launcher sets this on**, and it must stay on: browsers block module loading, fetch and
207
+ XHR on the file protocol, so a React, Vue or ES-module deliverable renders as an empty
208
+ body no matter how good it is -- measured at 44 of 182 shots blank, essentially all of
209
+ them runtime-rendered. Since React is named in 30% of the training briefs, the old
210
+ default was scoring a large share of the task pool as necessarily broken and teaching the
211
+ policy to avoid the very stack the brief asked for.
212
+
213
+ Scores across this boundary are NOT comparable: a React page goes from certainly-0 to
214
+ gradeable. Set it to 0 only to reproduce a pre-flip run.
215
+ """
216
+ script_b64 = base64.b64encode(_SHOT_SCRIPT.encode()).decode()
217
+ serve_root = ""
218
+ if os.environ.get("WEBDEV_GRADE_HTTP") == "1" and url.startswith("file://"):
219
+ serve_root = os.path.dirname(url[len("file://") :]) or "/"
220
+ return (
221
+ f"echo {script_b64} | base64 -d > /tmp/_webdev_shot.py && "
222
+ f"python3 /tmp/_webdev_shot.py --url {shlex.quote(url)} "
223
+ f"--actions-b64 {shlex.quote(actions_b64)} --proxy {shlex.quote(proxy)}"
224
+ + (f" --serve-root {shlex.quote(serve_root)}" if serve_root else "")
225
+ )
226
+
227
+
228
+ def _parse_shot_b64(r: dict) -> tuple[str, str]:
229
+ """Pull (SHOT_B64, CONSOLE_ERRORS) out of an env.execute result; empty b64 on miss."""
230
+ out = r.get("output") or ""
231
+ shot_b64, console_errors = "", "[]"
232
+ for line in out.splitlines():
233
+ if line.startswith("SHOT_B64:"):
234
+ shot_b64 = line[len("SHOT_B64:") :].strip()
235
+ elif line.startswith("CONSOLE_ERRORS:"):
236
+ console_errors = line[len("CONSOLE_ERRORS:") :].strip()
237
+ return shot_b64, console_errors
238
+
239
+
240
+ def _parse_render_env(r: dict) -> dict:
241
+ """Pull the RENDER_ENV json out of an env.execute result. {} when absent
242
+ (old pod script) or unparseable — callers treat that as env-healthy."""
243
+ for line in (r.get("output") or "").splitlines():
244
+ if line.startswith("RENDER_ENV:"):
245
+ try:
246
+ return json.loads(line[len("RENDER_ENV:") :].strip())
247
+ except Exception:
248
+ return {}
249
+ return {}
tasks/dasyn_260630_00025/tests/webdev/verdict.py ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright 2026 Xiaomi / the verl authors. Apache-2.0 (see ../LICENSE-verl.txt).
2
+ # `parse_verdict` copied unchanged from XiaomiMiMo/verl recipes/design/webdev/eval_mode.py.
3
+ import json
4
+ import re
5
+
6
+ from .eval_rubric import ALL_KEYS, VISUAL_KEYS
7
+
8
+ _JSON_RE = re.compile(r"\{.*\}", re.DOTALL)
9
+
10
+
11
+ def parse_verdict(raw_text: str) -> dict:
12
+ """Judge JSON -> per-dimension scores, ``visual``, ``score``, ``reason``.
13
+
14
+ Returns ``{"_failed": why}`` when it cannot be parsed. A missing dimension counts as a
15
+ parse failure rather than defaulting to 0: defaulting would turn "the judge forgot to
16
+ mention a dimension" into "the page scores 0 on it", inventing a low score out of
17
+ nothing.
18
+ """
19
+ m = _JSON_RE.search(raw_text or "")
20
+ if not m:
21
+ return {"_failed": f"no json in judge output: {(raw_text or '')[:160]}"}
22
+ try:
23
+ data = json.loads(m.group(0))
24
+ except Exception as e: # noqa: BLE001
25
+ return {"_failed": f"json error: {type(e).__name__}: {e}"}
26
+ dims: dict[str, float] = {}
27
+ for k in ALL_KEYS:
28
+ v = data.get(k)
29
+ if v is None:
30
+ return {"_failed": f"judge omitted dimension {k!r}"}
31
+ try:
32
+ dims[k] = max(0.0, min(1.0, float(v)))
33
+ except (TypeError, ValueError):
34
+ return {"_failed": f"dimension {k!r} is not a number: {v!r}"}
35
+ visual = sum(dims[k] for k in VISUAL_KEYS) / len(VISUAL_KEYS)
36
+ score = (visual + dims["query_fulfillment"] + dims["premium_assets"]) / 3.0
37
+ return {
38
+ "dims": dims,
39
+ "visual": round(visual, 4),
40
+ "score": round(score, 4),
41
+ "reason": str(data.get("reason", ""))[:500],
42
+ }
tasks/dasyn_260630_00040/environment/Dockerfile ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ # The task's image, pinned by digest (the same as [environment].docker_image).
2
+ # Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy.
3
+ FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:6e30e61bdbe1504470cd1f705b120d317da9e7f57df3ba04a906db6b2e95e14d
tasks/dasyn_260630_00040/environment/setup/setup.sh ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+ # Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into
3
+ # /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness.
4
+ M=/var/lib/mimo
5
+ [ -f "$M/ready" ] && exit 0
6
+ chmod 700 "$M"
7
+ fail() { echo "setup: $*" >&2; exit 1; }
8
+ # the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs
9
+ write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; }
10
+
11
+ # Webdev: verl recipes/design webdev-eval, as the explorer runs it. No blocklist: npm and CDNs are fair game.
12
+ mkdir -p /workspace/dist
13
+
14
+ touch "$M/ready"
15
+ echo "setup done"
tasks/dasyn_260630_00040/tests/grade.json ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ {
2
+ "cwd": "/workspace",
3
+ "query": "Create a playful static website in SvelteKit for a dental marketplace product showcase called ToothCart. It should feel like a bright Vercel-style landing page but more fun and friendly, with rounded cards, soft shadows, candy colors, clean spacing, responsive mobile layout, and smooth micro interactions. IMPORTANT: this is only a static front-end site, no backend, no database, no login, no checkout, no real payments, no external APIs. Use mock/sample product data inside the project.\n\nPages/sections needed:\n- Hero section: headline like “Find cute dental supplies in seconds”, short subtitle, 2 CTA buttons, playful tooth mascot illustration placeholder, trust badges\n- Featured marketplace grid: dental products such as toothbrush kits, whitening strips, floss packs, braces wax, kids dental care set, mouthwash tablets, tongue cleaner, travel hygiene kit\n- Drag-and-drop feature: user can drag product cards into a “Compare Basket” or “Smile Kit Builder” area on the page. Keep it simple: drag product cards into a tray, show selected item names/prices, allow removing items, and show a mock total. This must be client-side only with static data.\n- Category pills: Cleaning, Whitening, Kids, Orthodontic, Travel, Eco Friendly. Clicking can just filter the static product list in the UI.\n- Product card design: image placeholder or simple CSS illustration, name, tag, rating, mock price, short description, “Add to kit” button\n- How it works section: Browse, Drag to compare, Pick your smile kit\n- Promo banner: playful dental discount message, no real coupon validation\n- Testimonials: 3 fake customer reviews\n- FAQ: static accordion, questions about product quality, shipping mock text, returns mock text, dentist recommendations. Do not connect to anything real.\n- Footer: logo, simple links, social placeholders, disclaimer “Demo static marketplace showcase”.\n\nDesign requirements:\n- Style should be playful, clean, modern, like a polished Vercel landing page mixed with dental/toothpaste colors.\n- Use white background with mint, sky blue, lavender, peach accents.\n- Use cute icons/emojis or simple inline SVG/CSS shapes if needed, but no image generation required.\n- Add hover effects, card lift, small sparkle/tooth decorations, gentle gradients.\n- Fully responsive for desktop/tablet/mobile.\n- Make it feel like a real marketplace but it is just a static product showcase.\n\nTechnical requirements:\n- Use SvelteKit.\n- Static rendering only, suitable to deploy on Vercel as a static front-end.\n- Keep all product content local/mock, preferably in a simple array.\n- No auth, no cart checkout, no API routes, no server actions, no database.\n- Drag-and-drop should work with normal browser events or Svelte actions, simple and reliable.\n- Please create neat components like Hero, ProductGrid, ProductCard, CompareTray, CategoryFilter, Testimonials, FAQ, Footer.\n- Include basic accessibility: keyboard focus styles, alt text/placeholders, readable contrast, semantic sections.\n- Final result should look polished enough for a startup landing page demo."
4
+ }
tasks/dasyn_260630_00040/tests/grade.py ADDED
@@ -0,0 +1,88 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Grade a Webdev task as the explorer does (verl recipes/design webdev-eval): render, shrink, judge.
2
+
3
+ No index.html in dist/ scores 0. A render that fails, or a judge that never answers, writes no reward (not scored):
4
+ neither says anything about the page."""
5
+ import base64
6
+ import io
7
+ import json
8
+ import os
9
+ import random
10
+ import subprocess
11
+ import sys
12
+ import time
13
+ import urllib.request
14
+ from pathlib import Path
15
+
16
+ sys.path.insert(0, "/tests")
17
+ os.environ["WEBDEV_GRADE_HTTP"] = "1" # serve over loopback http so React/Vue/ES-module sites actually run
18
+ from webdev.eval_rubric import build_prompt # noqa: E402
19
+ from webdev.shot import _build_shot_cmd, _parse_render_env, _parse_shot_b64 # noqa: E402
20
+ from webdev.verdict import parse_verdict # noqa: E402
21
+
22
+ cfg = json.loads(Path("/tests/grade.json").read_text())
23
+ V = Path("/logs/verifier")
24
+ V.mkdir(parents=True, exist_ok=True)
25
+ dist = Path(cfg["cwd"]) / "dist"
26
+
27
+
28
+ def done(reward: float | None, why: str, **extra) -> None:
29
+ (V / "result.json").write_text(json.dumps({"reward": reward, "summary": why, **extra}, indent=1))
30
+ print(why)
31
+ if reward is None:
32
+ print("not scored", file=sys.stderr)
33
+ sys.exit(1)
34
+ (V / "reward.txt").write_text(f"{reward}\n")
35
+ sys.exit(0)
36
+
37
+
38
+ files = sorted(str(p.relative_to(dist)) for p in dist.rglob("*") if p.is_file())[:200] if dist.is_dir() else []
39
+ if "index.html" not in files:
40
+ done(0.0, "The agent delivered nothing to dist/." if not files else "dist/ has no index.html, so there is no page to open.",
41
+ delivered=files)
42
+ res = subprocess.run(["sh", "-c", _build_shot_cmd(f"file://{dist}/index.html")], capture_output=True, text=True,
43
+ timeout=150) # SHOT_TIMEOUT_S
44
+ shot = {"output": (res.stdout or "") + "\n" + (res.stderr or "")}
45
+ shot_b64, console_errors = _parse_shot_b64(shot)
46
+ render_env = _parse_render_env(shot)
47
+ if render_env.get("proxy_failed") or not shot_b64:
48
+ print(shot["output"][-2000:], file=sys.stderr)
49
+ done(None, "external assets were unreachable on every route" if render_env.get("proxy_failed")
50
+ else "the screenshot produced no image")
51
+ jpg = base64.b64decode(shot_b64)
52
+ try: # eval_mode._shrink: the judge refuses shots over 20 MP; proportional, quality 75
53
+ from PIL import Image
54
+ Image.MAX_IMAGE_PIXELS = None
55
+ im = Image.open(io.BytesIO(jpg))
56
+ size = im.size
57
+ if im.width * im.height > 20e6:
58
+ k = (20e6 / (im.width * im.height)) ** 0.5
59
+ im = im.convert("RGB").resize((max(1, int(im.width * k)), max(1, int(im.height * k))), Image.LANCZOS)
60
+ b = io.BytesIO(); im.save(b, "JPEG", quality=75); jpg = b.getvalue(); size = im.size
61
+ except ImportError:
62
+ size = None
63
+ (V / "screenshot.jpg").write_bytes(jpg)
64
+ content = [{"type": "image_url", "image_url": {"url": "data:image/jpeg;base64," + base64.b64encode(jpg).decode()}},
65
+ {"type": "text", "text": build_prompt().format(query=cfg["query"][:1500])}] # QUERY_CAP
66
+ url = os.environ.get("WEBDEV_JUDGE_URL", "https://router.huggingface.co/v1").rstrip("/") + "/chat/completions"
67
+ body = json.dumps({"model": os.environ["WEBDEV_JUDGE_MODEL"], "temperature": 1.0,
68
+ "messages": [{"role": "user", "content": content}]}).encode()
69
+ verdict, last = None, ""
70
+ for attempt in range(4): # JUDGE_RETRIES, with eval_mode's backoff
71
+ if attempt:
72
+ time.sleep(min(60.0, 3.0 * (3 ** (attempt - 1))) * (0.5 + random.random()))
73
+ try:
74
+ req = urllib.request.Request(url, data=body, method="POST", headers={
75
+ "Content-Type": "application/json", "Authorization": f"Bearer {os.environ.get('WEBDEV_JUDGE_KEY', '')}"})
76
+ with urllib.request.urlopen(req, timeout=180) as r: # JUDGE_TIMEOUT_S
77
+ msg = json.loads(r.read())["choices"][0]["message"]
78
+ v = parse_verdict(msg.get("content") or msg.get("reasoning_content") or "")
79
+ if "_failed" not in v:
80
+ verdict = v
81
+ break
82
+ last = v["_failed"]
83
+ except Exception as e: # noqa: BLE001
84
+ last = f"{type(e).__name__}: {e}"[:200]
85
+ if not verdict:
86
+ done(None, f"judge unavailable: {last}")
87
+ done(verdict["score"], verdict.get("reason", ""), dims=verdict["dims"], visual=verdict["visual"], screenshot_size=size,
88
+ console_errors=console_errors[:1500] if console_errors not in ("", "[]") else "")
tasks/dasyn_260630_00040/tests/test.sh ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ #!/bin/bash
2
+ # Webdev grading: a full-page render of dist/index.html, judged by a vision model against the brief.
3
+ mkdir -p /logs/verifier
4
+ cd /tests && python3 /tests/grade.py
tasks/dasyn_260630_00040/tests/webdev/__init__.py ADDED
File without changes
tasks/dasyn_260630_00040/tests/webdev/eval_rubric.py ADDED
@@ -0,0 +1,117 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright 2026 Bytedance Ltd. and/or its affiliates
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+ """The seven-dimension evaluation rubric. **The wording below is the ruler itself.**
15
+
16
+ One vision call returns seven dimensions, and the evaluation score is an equal-weight mean
17
+ of three of them::
18
+
19
+ score = (visual + query_fulfillment + premium_assets) / 3
20
+ visual = mean(layout_integrity, typography_hierarchy, color_harmony,
21
+ whitespace, content_richness)
22
+
23
+ ``BANDS`` and ``RICHNESS`` are kept **byte for byte** as the run that produced this arm's
24
+ published numbers used them, and they are in Chinese for the same reason. They are not
25
+ documentation of a scoring policy -- they ARE the scoring policy, handed to the judge model
26
+ verbatim. Translating or rewording them measures something else and makes every historical
27
+ result incomparable. To change the rubric, copy this file and change ``RUBRIC_ID``; a test
28
+ pins the rendered prompt's hash so an accidental edit fails loudly instead of silently
29
+ shifting the reward distribution.
30
+
31
+ Two deliberate differences from the earlier four-term formula:
32
+
33
+ * The fourth term (a static code check, weight 0.1) is gone. Its dominant component was an
34
+ INVERSE indicator: bucketing by ``premium_assets``, rows in [0, 0.2) averaged 0.900 on it
35
+ while rows in [0.8, 1.0] averaged only 0.425, with ``visual`` rising monotonically across
36
+ the same buckets. It was paying a bonus for not daring to reference external assets --
37
+ the highest-scoring arm on that term was the one that referenced the fewest (0.823,
38
+ against 0.638 and 0.648 for the RL arms).
39
+ * The remaining three are equal-weight rather than 0.6 / 0.1 / 0.2. ``premium_assets``
40
+ separates the arms most sharply (0.417 against 0.619, a gap of 0.20, where ``visual``
41
+ differs by 0.042 and ``query`` by 0.054), so equal weighting stops a 0.6-weighted
42
+ ``visual`` from drowning out the dimension that actually discriminates.
43
+ """
44
+
45
+ BANDS = """1. layout_integrity(布局完整性)
46
+ - [0.0, 0.2):布局严重损坏,核心内容大面积重叠、截断、溢出或无法阅读
47
+ - [0.2, 0.4):多处明显布局错误,显著影响主要内容使用
48
+ - [0.4, 0.6):主体可用,但有一处严重或多处明显的对齐、重叠、超框问题
49
+ - [0.6, 0.8):整体完整,仅有少量轻微对齐、间距或边界问题
50
+ - [0.8, 1.0]:布局完整稳定,未见可感知的重叠、错位、截断或溢出
51
+
52
+ 2. typography_hierarchy(排版层级)
53
+ - [0.0, 0.2):文字普遍不可读,字号/层级严重失控
54
+ - [0.2, 0.4):标题正文层级混乱,多处字号、行高或字重明显不当
55
+ - [0.4, 0.6):基本可读,但层级辨识或排版节奏存在明显缺陷
56
+ - [0.6, 0.8):层级清楚、阅读顺畅,仅有少量轻微排版问题
57
+ - [0.8, 1.0]:标题、正文、辅助文字层级鲜明且比例、行高、字重均成熟
58
+
59
+ 3. color_harmony(配色与对比)
60
+ - [0.0, 0.2):配色严重冲突或关键文字几乎无法辨认
61
+ - [0.2, 0.4):多处颜色不协调、对比不足,明显损害观感或可读性
62
+ - [0.4, 0.6):基本可用,但色彩体系、对比或一致性有明显问题
63
+ - [0.6, 0.8):配色协调且可读,仅有少量轻微不一致或对比问题
64
+ - [0.8, 1.0]:色彩体系统一成熟,对比清晰,无明显问题
65
+
66
+ 4. whitespace(留白与密度)
67
+ - [0.0, 0.2):页面极度拥挤或空洞,信息组织基本失效
68
+ - [0.2, 0.4):多处明显过密/过空,严重破坏浏览节奏
69
+ - [0.4, 0.6):整体可浏览,但局部密度、间距或区块节奏有明显问题
70
+ - [0.6, 0.8):留白与内容密度总体合理,仅有少量轻微问题
71
+ - [0.8, 1.0]:留白、间距和区块节奏自然一致,密度控制成熟
72
+
73
+ {richness}
74
+ {nq}. query_fulfillment(需求实现度)
75
+ - [0.0, 0.2):截图可见内容基本没有实现 query,或主题完全错误
76
+ - [0.2, 0.4):只实现少量表面元素,多数核心要求缺失
77
+ - [0.4, 0.6):实现主要方向,但多个关键板块、要素或功能界面明显缺失
78
+ - [0.6, 0.8):主体要求已实现,仅有少量次要缺失或偏差
79
+ - [0.8, 1.0]:截图可见范围内完整、准确地实现 query 的主题、板块、要素和功能界面
80
+
81
+ {na}. premium_assets(高级素材与质感)
82
+ - [0.0, 0.2):无有效视觉素材,或主要依赖简陋 emoji、裸占位、低质/模糊图像
83
+ - [0.2, 0.4):素材较普通或粗糙,缺乏统一设计感;少量装饰不能形成质感
84
+ - [0.4, 0.6):素材清晰且基本协调,但主要是普��图片或纯 CSS 视觉,没有高级素材
85
+ - [0.6, 0.8):使用了高品质真实图片、艺术化图像、成体系插画或精致 mockup,整体质感良好但仍有小缺陷
86
+ - [0.8, 1.0]:高级素材质量突出、体系完整,并与版式高度融合,达到成熟专业作品水准"""
87
+
88
+ RICHNESS = """5. content_richness(内容丰富度)
89
+ - [0.0, 0.2):近乎空壳,一屏都撑不满,只有标题、空架子或极少占位内容
90
+ - [0.2, 0.4):只有 1–2 个简单板块,内容高度重复、空泛或以占位为主
91
+ - [0.4, 0.6):已有若干实际板块,但数量或内容深度明显不足以支撑完整网站
92
+ - [0.6, 0.8):板块较完整、内容较具体,仅少数部分偏单薄
93
+ - [0.8, 1.0]:约 4 个及以上成形板块,内容具体充实,足以支撑完整网站体验"""
94
+
95
+
96
+ VISUAL_KEYS = ("layout_integrity", "typography_hierarchy", "color_harmony", "whitespace", "content_richness")
97
+ SCORE_KEYS = ("visual", "query_fulfillment", "premium_assets") # 等权平均的三项
98
+ ALL_KEYS = VISUAL_KEYS + ("query_fulfillment", "premium_assets")
99
+ RUBRIC_ID = "rva1:mean(visual,query,asset)"
100
+
101
+
102
+ def build_prompt() -> str:
103
+ """评测用的 7 维 prompt(含 content_richness)。`{query}` 占位符留给调用方 format。"""
104
+ dims = BANDS.format(richness=RICHNESS, nq=6, na=7)
105
+ return f"""你是网页 UI 评审。只依据 fullpage 截图可见证据评分。前 5 项构成 visual:前四项只评客观视觉问题,第五项评完整网站所需的信息量;第 6 项依据 query;第 7 项评素材品质。各维独立判断,不要因为某一维表现好或差而连带改变其它维。
106
+
107
+ query: {{query}}
108
+
109
+ 每个维度输出 0 到 1 的连续分数,可使用任意小数。先依据该维的五段描述确定分数所在区间,再根据问题严重程度、数量和影响在区间内连续取值;不要只输出区间端点或固定档位。五段边界统一为 [0.0,0.2)、[0.2,0.4)、[0.4,0.6)、[0.6,0.8)、[0.8,1.0]。临界情况选择与可见证据最匹配的相邻区间。premium_assets 没有高级素材时不得进入 [0.6,1.0]。
110
+
111
+ {dims}
112
+
113
+ 空白、严重加载失败或完全不可见时,所有维度输出 0。仅输出 JSON,不要 markdown:
114
+ {{{{"layout_integrity":0.0,"typography_hierarchy":0.0,"color_harmony":0.0,"whitespace":0.0,"content_richness":0.0,"query_fulfillment":0.0,"premium_assets":0.0,"reason":"核心依据"}}}}"""
115
+
116
+
117
+ __all__ = ["BANDS", "RICHNESS", "VISUAL_KEYS", "SCORE_KEYS", "ALL_KEYS", "RUBRIC_ID", "build_prompt"]
tasks/dasyn_260630_00040/tests/webdev/shot.py ADDED
@@ -0,0 +1,249 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright 2026 Bytedance Ltd. and/or its affiliates
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+ """In-pod full-page screenshot pipeline: playwright inside the agent's own sandbox.
15
+
16
+ Only the EVALUATION path uses this. Training ships the workspace to the grading service and
17
+ lets it render; evaluation renders here instead, so that it does not depend on that service
18
+ running -- evaluation is usually done in an environment that has no such long-lived service.
19
+
20
+ ``_SHOT_SCRIPT`` is kept **byte for byte**. Every non-obvious line in it encodes a failure
21
+ that was actually hit and diagnosed in a pod: proxy auth handed to the wrong playwright
22
+ field, a loopback bypass that the dict API silently drops, blank ``file://`` renders of
23
+ runtime-rendered pages, reveal-on-scroll content captured at opacity 0, sticky headers
24
+ painted at an in-flight scroll offset, parallax backgrounds going black below the fold. Read
25
+ the inline comments before changing any of it; none of these failures announce themselves --
26
+ they all arrive as a plausible-looking screenshot that scores badly.
27
+
28
+ The sandbox image must carry node, playwright and chromium. A missing chromium surfaces as
29
+ ``render_failed``, which the caller masks, rather than as a bad score.
30
+ """
31
+
32
+ from __future__ import annotations
33
+
34
+ import base64
35
+ import json
36
+ import os
37
+ import shlex
38
+
39
+ _SHOT_SCRIPT = r'''
40
+ import sys, json, base64, argparse
41
+ from playwright.sync_api import sync_playwright
42
+ ap = argparse.ArgumentParser()
43
+ ap.add_argument("--url", required=True)
44
+ ap.add_argument("--actions-b64", default="")
45
+ ap.add_argument("--proxy", default="") # comma-separated failover chain; empty entry = direct
46
+ ap.add_argument("--vw", type=int, default=1440)
47
+ ap.add_argument("--vh", type=int, default=900)
48
+ ap.add_argument("--serve-root", default="") # serve this dir over local http and rewrite --url onto it
49
+ a = ap.parse_args()
50
+ if a.serve_root:
51
+ import threading, functools
52
+ from http.server import ThreadingHTTPServer, SimpleHTTPRequestHandler
53
+ class _QuietHandler(SimpleHTTPRequestHandler):
54
+ def log_message(self, *args, **kw): # keep stdout clean for SHOT_B64 parsing
55
+ pass
56
+ _handler = functools.partial(_QuietHandler, directory=a.serve_root)
57
+ _srv = ThreadingHTTPServer(("127.0.0.1", 0), _handler)
58
+ threading.Thread(target=_srv.serve_forever, daemon=True).start()
59
+ _page = a.url.rsplit("/", 1)[-1] if a.url.rsplit("/", 1)[-1].endswith(".html") else "index.html"
60
+ a.url = "http://127.0.0.1:%d/%s" % (_srv.server_address[1], _page)
61
+ actions = json.loads(base64.b64decode(a.actions_b64).decode()) if a.actions_b64 else []
62
+ BASE_LAUNCH = {"headless": True, "args": ["--no-sandbox", "--disable-dev-shm-usage",
63
+ "--proxy-bypass-list=127.0.0.1;localhost"]}
64
+
65
+ def _proxy_cfg(purl):
66
+ from urllib.parse import urlparse as _up
67
+ _pu = _up(purl)
68
+ cfg = {"server": _pu.scheme + "://" + _pu.hostname + ":" + str(_pu.port)}
69
+ if _pu.username:
70
+ cfg["username"] = _pu.username
71
+ cfg["password"] = _pu.password or ""
72
+ return cfg
73
+
74
+ proxy_chain = [s.strip() for s in a.proxy.split(",")] if a.proxy else [""]
75
+ if a.proxy and "" not in proxy_chain:
76
+ proxy_chain.append("")
77
+ FATAL_NET = ("ERR_PROXY_CONNECTION_FAILED", "ERR_TUNNEL_CONNECTION_FAILED",
78
+ "ERR_SOCKS_CONNECTION_FAILED", "ERR_NAME_NOT_RESOLVED",
79
+ "ERR_INTERNET_DISCONNECTED", "ERR_CONNECTION_TIMED_OUT",
80
+ "ERR_CONNECTION_REFUSED", "ERR_CONNECTION_RESET", "ERR_TIMED_OUT",
81
+ "ERR_EMPTY_RESPONSE")
82
+ errs = []
83
+ fatal = [] # fatal external request failures of the CURRENT load attempt
84
+ render_env = {"proxy_failed": False, "recovered": None, "attempts": [], "fatal": []}
85
+
86
+ def _on_request_failed(req):
87
+ try:
88
+ u = req.url or ""
89
+ if not u.startswith("http") or u.startswith("http://127.0.0.1") or u.startswith("http://localhost"):
90
+ return # local server / file:// subresources are page defects, not env
91
+ f = req.failure or ""
92
+ if any(k in f for k in FATAL_NET):
93
+ fatal.append(f + " " + u[:120])
94
+ except Exception:
95
+ pass
96
+
97
+ SETTLE_JS = """async () => {
98
+ try {
99
+ document.documentElement.style.setProperty('scroll-behavior', 'auto', 'important');
100
+ if (document.body) document.body.style.setProperty('scroll-behavior', 'auto', 'important');
101
+ } catch (e) {}
102
+ if (document.fonts && document.fonts.ready) { try { await document.fonts.ready; } catch (e) {} }
103
+ const H = () => Math.max(document.body.scrollHeight, document.documentElement.scrollHeight);
104
+ const step = Math.max(400, Math.floor(window.innerHeight * 0.8));
105
+ for (let y = 0; y <= Math.min(H(), 30000); y += step) {
106
+ window.scrollTo(0, y);
107
+ await new Promise(r => setTimeout(r, 120));
108
+ }
109
+ window.scrollTo(0, H());
110
+ await new Promise(r => setTimeout(r, 400));
111
+ window.scrollTo(0, 0);
112
+ await new Promise(r => setTimeout(r, 300));
113
+ }"""
114
+ FREEZE_CSS = ("*,*::before,*::after{animation-delay:0s !important;animation-duration:.01s !important;"
115
+ "transition-delay:0s !important;transition-duration:.01s !important;"
116
+ "background-attachment:scroll !important;scroll-behavior:auto !important;}")
117
+
118
+ with sync_playwright() as p:
119
+ b = None
120
+ pg = None
121
+
122
+ def _open(purl):
123
+ global b, pg
124
+ if b is not None:
125
+ try:
126
+ b.close()
127
+ except Exception:
128
+ pass
129
+ kw = dict(BASE_LAUNCH)
130
+ if purl:
131
+ kw["proxy"] = _proxy_cfg(purl)
132
+ b = p.chromium.launch(**kw)
133
+ pg = b.new_context(viewport={"width": a.vw, "height": a.vh}).new_page()
134
+ pg.on("console", lambda m: errs.append(m.text) if m.type == "error" else None)
135
+ pg.on("pageerror", lambda e: errs.append("pageerror: " + str(e)))
136
+ pg.on("requestfailed", _on_request_failed)
137
+
138
+ def _load():
139
+ del fatal[:]
140
+ try:
141
+ resp = pg.goto(a.url, wait_until="load", timeout=25000)
142
+ if resp is not None and a.url.startswith("http") and resp.status >= 500:
143
+ fatal.append("PAGE_HTTP_%d %s" % (resp.status, a.url[:120]))
144
+ except Exception as e:
145
+ errs.append("goto failed: " + str(e))
146
+ pg.wait_for_timeout(2000)
147
+
148
+ for i, purl in enumerate(proxy_chain):
149
+ label = (purl.split("@")[-1] or "direct") if purl else "direct"
150
+ try:
151
+ _open(purl)
152
+ _load()
153
+ except Exception as e:
154
+ errs.append("launch failed via " + label + ": " + str(e))
155
+ del fatal[:]
156
+ fatal.append("LAUNCH_FAILED " + label)
157
+ if fatal:
158
+ render_env["attempts"].append({"via": label, "fatal": fatal[:3]})
159
+ if pg is not None and not fatal[0].startswith("LAUNCH_FAILED"):
160
+ _load()
161
+ if not fatal and pg is not None:
162
+ if render_env["attempts"]:
163
+ render_env["recovered"] = "via " + label
164
+ break
165
+ render_env["proxy_failed"] = bool(fatal) or pg is None
166
+ render_env["fatal"] = fatal[:5]
167
+ if pg is None: # every route failed to even open a browser: report env, no shot
168
+ sys.stdout.write("CONSOLE_ERRORS:" + json.dumps(errs[:15]) + "\n")
169
+ sys.stdout.write("RENDER_ENV:" + json.dumps(render_env) + "\n")
170
+ sys.exit(0)
171
+ try:
172
+ pg.evaluate(SETTLE_JS)
173
+ pg.add_style_tag(content=FREEZE_CSS)
174
+ pg.wait_for_timeout(300)
175
+ except Exception as e:
176
+ errs.append("settle failed: " + str(e))
177
+ for act in actions:
178
+ t = act.get("type")
179
+ try:
180
+ if t == "click":
181
+ pg.click(act["selector"], timeout=5000)
182
+ elif t == "fill":
183
+ pg.fill(act["selector"], act.get("value", ""), timeout=5000)
184
+ pg.wait_for_timeout(800)
185
+ except Exception as e:
186
+ errs.append("action " + json.dumps(act) + " failed: " + str(e))
187
+ try:
188
+ pg.evaluate("window.scrollTo(0, 0)")
189
+ pg.wait_for_timeout(250)
190
+ except Exception as e:
191
+ errs.append("scroll-top failed: " + str(e))
192
+ png = pg.screenshot(full_page=True, type="jpeg", quality=75)
193
+ b.close()
194
+ sys.stdout.write("SHOT_B64:" + base64.b64encode(png).decode() + "\n")
195
+ sys.stdout.write("CONSOLE_ERRORS:" + json.dumps(errs[:15]) + "\n")
196
+ sys.stdout.write("RENDER_ENV:" + json.dumps(render_env) + "\n")
197
+ '''
198
+
199
+
200
+ def _build_shot_cmd(url: str, *, actions_b64: str = "", proxy: str = "") -> str:
201
+ """Pod-side command that runs _SHOT_SCRIPT against `url`. Shared by ScreenshotTool
202
+ (feeds the multimodal grader) and capture_fullpage (lands the JPEG to disk).
203
+
204
+ ``WEBDEV_GRADE_HTTP=1`` switches ``file://`` rendering to a loopback http server inside
205
+ the shot script (see ``--serve-root``) so runtime-rendered pages actually execute. **The
206
+ launcher sets this on**, and it must stay on: browsers block module loading, fetch and
207
+ XHR on the file protocol, so a React, Vue or ES-module deliverable renders as an empty
208
+ body no matter how good it is -- measured at 44 of 182 shots blank, essentially all of
209
+ them runtime-rendered. Since React is named in 30% of the training briefs, the old
210
+ default was scoring a large share of the task pool as necessarily broken and teaching the
211
+ policy to avoid the very stack the brief asked for.
212
+
213
+ Scores across this boundary are NOT comparable: a React page goes from certainly-0 to
214
+ gradeable. Set it to 0 only to reproduce a pre-flip run.
215
+ """
216
+ script_b64 = base64.b64encode(_SHOT_SCRIPT.encode()).decode()
217
+ serve_root = ""
218
+ if os.environ.get("WEBDEV_GRADE_HTTP") == "1" and url.startswith("file://"):
219
+ serve_root = os.path.dirname(url[len("file://") :]) or "/"
220
+ return (
221
+ f"echo {script_b64} | base64 -d > /tmp/_webdev_shot.py && "
222
+ f"python3 /tmp/_webdev_shot.py --url {shlex.quote(url)} "
223
+ f"--actions-b64 {shlex.quote(actions_b64)} --proxy {shlex.quote(proxy)}"
224
+ + (f" --serve-root {shlex.quote(serve_root)}" if serve_root else "")
225
+ )
226
+
227
+
228
+ def _parse_shot_b64(r: dict) -> tuple[str, str]:
229
+ """Pull (SHOT_B64, CONSOLE_ERRORS) out of an env.execute result; empty b64 on miss."""
230
+ out = r.get("output") or ""
231
+ shot_b64, console_errors = "", "[]"
232
+ for line in out.splitlines():
233
+ if line.startswith("SHOT_B64:"):
234
+ shot_b64 = line[len("SHOT_B64:") :].strip()
235
+ elif line.startswith("CONSOLE_ERRORS:"):
236
+ console_errors = line[len("CONSOLE_ERRORS:") :].strip()
237
+ return shot_b64, console_errors
238
+
239
+
240
+ def _parse_render_env(r: dict) -> dict:
241
+ """Pull the RENDER_ENV json out of an env.execute result. {} when absent
242
+ (old pod script) or unparseable — callers treat that as env-healthy."""
243
+ for line in (r.get("output") or "").splitlines():
244
+ if line.startswith("RENDER_ENV:"):
245
+ try:
246
+ return json.loads(line[len("RENDER_ENV:") :].strip())
247
+ except Exception:
248
+ return {}
249
+ return {}
tasks/dasyn_260630_00040/tests/webdev/verdict.py ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright 2026 Xiaomi / the verl authors. Apache-2.0 (see ../LICENSE-verl.txt).
2
+ # `parse_verdict` copied unchanged from XiaomiMiMo/verl recipes/design/webdev/eval_mode.py.
3
+ import json
4
+ import re
5
+
6
+ from .eval_rubric import ALL_KEYS, VISUAL_KEYS
7
+
8
+ _JSON_RE = re.compile(r"\{.*\}", re.DOTALL)
9
+
10
+
11
+ def parse_verdict(raw_text: str) -> dict:
12
+ """Judge JSON -> per-dimension scores, ``visual``, ``score``, ``reason``.
13
+
14
+ Returns ``{"_failed": why}`` when it cannot be parsed. A missing dimension counts as a
15
+ parse failure rather than defaulting to 0: defaulting would turn "the judge forgot to
16
+ mention a dimension" into "the page scores 0 on it", inventing a low score out of
17
+ nothing.
18
+ """
19
+ m = _JSON_RE.search(raw_text or "")
20
+ if not m:
21
+ return {"_failed": f"no json in judge output: {(raw_text or '')[:160]}"}
22
+ try:
23
+ data = json.loads(m.group(0))
24
+ except Exception as e: # noqa: BLE001
25
+ return {"_failed": f"json error: {type(e).__name__}: {e}"}
26
+ dims: dict[str, float] = {}
27
+ for k in ALL_KEYS:
28
+ v = data.get(k)
29
+ if v is None:
30
+ return {"_failed": f"judge omitted dimension {k!r}"}
31
+ try:
32
+ dims[k] = max(0.0, min(1.0, float(v)))
33
+ except (TypeError, ValueError):
34
+ return {"_failed": f"dimension {k!r} is not a number: {v!r}"}
35
+ visual = sum(dims[k] for k in VISUAL_KEYS) / len(VISUAL_KEYS)
36
+ score = (visual + dims["query_fulfillment"] + dims["premium_assets"]) / 3.0
37
+ return {
38
+ "dims": dims,
39
+ "visual": round(visual, 4),
40
+ "score": round(score, 4),
41
+ "reason": str(data.get("reason", ""))[:500],
42
+ }
tasks/dasyn_260630_00047/environment/Dockerfile ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ # The task's image, pinned by digest (the same as [environment].docker_image).
2
+ # Setup runs at start from [environment.healthcheck]; environment/setup/ is its readable copy.
3
+ FROM docker.io/xiaomimimo/mimo-v2.6-rl-oss@sha256:6e30e61bdbe1504470cd1f705b120d317da9e7f57df3ba04a906db6b2e95e14d
tasks/dasyn_260630_00047/environment/setup/setup.sh ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+ # Runs once, as root, before the agent starts: Harbor's [environment.healthcheck] unpacks this folder into
3
+ # /var/lib/mimo and runs it. Generated by mimo_harbor; see its README for how each step maps to Xiaomi's harness.
4
+ M=/var/lib/mimo
5
+ [ -f "$M/ready" ] && exit 0
6
+ chmod 700 "$M"
7
+ fail() { echo "setup: $*" >&2; exit 1; }
8
+ # the answer-leak blocklist (mimoagent), applied to /etc/hosts by the agent right after it installs
9
+ write_blocklist() { cp "$M/files/blocklist" "$M/blocklist"; }
10
+
11
+ # Webdev: verl recipes/design webdev-eval, as the explorer runs it. No blocklist: npm and CDNs are fair game.
12
+ mkdir -p /workspace/dist
13
+
14
+ touch "$M/ready"
15
+ echo "setup done"
tasks/dasyn_260630_00047/tests/grade.json ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ {
2
+ "cwd": "/workspace",
3
+ "query": "Build a static React + Tailwind editorial website for a wedding at an elderly-care home, brutalist style, complex scroll-driven sections, YouTube-inspired video/story layout but use only mock thumbnails and static content, no backend."
4
+ }
tasks/dasyn_260630_00047/tests/grade.py ADDED
@@ -0,0 +1,88 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Grade a Webdev task as the explorer does (verl recipes/design webdev-eval): render, shrink, judge.
2
+
3
+ No index.html in dist/ scores 0. A render that fails, or a judge that never answers, writes no reward (not scored):
4
+ neither says anything about the page."""
5
+ import base64
6
+ import io
7
+ import json
8
+ import os
9
+ import random
10
+ import subprocess
11
+ import sys
12
+ import time
13
+ import urllib.request
14
+ from pathlib import Path
15
+
16
+ sys.path.insert(0, "/tests")
17
+ os.environ["WEBDEV_GRADE_HTTP"] = "1" # serve over loopback http so React/Vue/ES-module sites actually run
18
+ from webdev.eval_rubric import build_prompt # noqa: E402
19
+ from webdev.shot import _build_shot_cmd, _parse_render_env, _parse_shot_b64 # noqa: E402
20
+ from webdev.verdict import parse_verdict # noqa: E402
21
+
22
+ cfg = json.loads(Path("/tests/grade.json").read_text())
23
+ V = Path("/logs/verifier")
24
+ V.mkdir(parents=True, exist_ok=True)
25
+ dist = Path(cfg["cwd"]) / "dist"
26
+
27
+
28
+ def done(reward: float | None, why: str, **extra) -> None:
29
+ (V / "result.json").write_text(json.dumps({"reward": reward, "summary": why, **extra}, indent=1))
30
+ print(why)
31
+ if reward is None:
32
+ print("not scored", file=sys.stderr)
33
+ sys.exit(1)
34
+ (V / "reward.txt").write_text(f"{reward}\n")
35
+ sys.exit(0)
36
+
37
+
38
+ files = sorted(str(p.relative_to(dist)) for p in dist.rglob("*") if p.is_file())[:200] if dist.is_dir() else []
39
+ if "index.html" not in files:
40
+ done(0.0, "The agent delivered nothing to dist/." if not files else "dist/ has no index.html, so there is no page to open.",
41
+ delivered=files)
42
+ res = subprocess.run(["sh", "-c", _build_shot_cmd(f"file://{dist}/index.html")], capture_output=True, text=True,
43
+ timeout=150) # SHOT_TIMEOUT_S
44
+ shot = {"output": (res.stdout or "") + "\n" + (res.stderr or "")}
45
+ shot_b64, console_errors = _parse_shot_b64(shot)
46
+ render_env = _parse_render_env(shot)
47
+ if render_env.get("proxy_failed") or not shot_b64:
48
+ print(shot["output"][-2000:], file=sys.stderr)
49
+ done(None, "external assets were unreachable on every route" if render_env.get("proxy_failed")
50
+ else "the screenshot produced no image")
51
+ jpg = base64.b64decode(shot_b64)
52
+ try: # eval_mode._shrink: the judge refuses shots over 20 MP; proportional, quality 75
53
+ from PIL import Image
54
+ Image.MAX_IMAGE_PIXELS = None
55
+ im = Image.open(io.BytesIO(jpg))
56
+ size = im.size
57
+ if im.width * im.height > 20e6:
58
+ k = (20e6 / (im.width * im.height)) ** 0.5
59
+ im = im.convert("RGB").resize((max(1, int(im.width * k)), max(1, int(im.height * k))), Image.LANCZOS)
60
+ b = io.BytesIO(); im.save(b, "JPEG", quality=75); jpg = b.getvalue(); size = im.size
61
+ except ImportError:
62
+ size = None
63
+ (V / "screenshot.jpg").write_bytes(jpg)
64
+ content = [{"type": "image_url", "image_url": {"url": "data:image/jpeg;base64," + base64.b64encode(jpg).decode()}},
65
+ {"type": "text", "text": build_prompt().format(query=cfg["query"][:1500])}] # QUERY_CAP
66
+ url = os.environ.get("WEBDEV_JUDGE_URL", "https://router.huggingface.co/v1").rstrip("/") + "/chat/completions"
67
+ body = json.dumps({"model": os.environ["WEBDEV_JUDGE_MODEL"], "temperature": 1.0,
68
+ "messages": [{"role": "user", "content": content}]}).encode()
69
+ verdict, last = None, ""
70
+ for attempt in range(4): # JUDGE_RETRIES, with eval_mode's backoff
71
+ if attempt:
72
+ time.sleep(min(60.0, 3.0 * (3 ** (attempt - 1))) * (0.5 + random.random()))
73
+ try:
74
+ req = urllib.request.Request(url, data=body, method="POST", headers={
75
+ "Content-Type": "application/json", "Authorization": f"Bearer {os.environ.get('WEBDEV_JUDGE_KEY', '')}"})
76
+ with urllib.request.urlopen(req, timeout=180) as r: # JUDGE_TIMEOUT_S
77
+ msg = json.loads(r.read())["choices"][0]["message"]
78
+ v = parse_verdict(msg.get("content") or msg.get("reasoning_content") or "")
79
+ if "_failed" not in v:
80
+ verdict = v
81
+ break
82
+ last = v["_failed"]
83
+ except Exception as e: # noqa: BLE001
84
+ last = f"{type(e).__name__}: {e}"[:200]
85
+ if not verdict:
86
+ done(None, f"judge unavailable: {last}")
87
+ done(verdict["score"], verdict.get("reason", ""), dims=verdict["dims"], visual=verdict["visual"], screenshot_size=size,
88
+ console_errors=console_errors[:1500] if console_errors not in ("", "[]") else "")
tasks/dasyn_260630_00047/tests/test.sh ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ #!/bin/bash
2
+ # Webdev grading: a full-page render of dist/index.html, judged by a vision model against the brief.
3
+ mkdir -p /logs/verifier
4
+ cd /tests && python3 /tests/grade.py