feat(runtime): capture step evidence in console
Tests / Test passed: 862

This commit is contained in:
2026-07-15 10:12:09 +08:00
parent 8d5b02e37f
commit ccde30e378
20 changed files with 594 additions and 53 deletions
+15 -7
View File
@@ -105,7 +105,7 @@ class ConsoleService:
if self._metadata_store.get_task(task_id) is None:
raise KeyError("task not found")
return [
self._inline_screenshot(record) for record in self._timeline.read(task_id)
self._inline_screenshots(record) for record in self._timeline.read(task_id)
]
def get_runtime_config(self) -> dict[str, int]:
@@ -124,15 +124,23 @@ class ConsoleService:
)
@staticmethod
def _inline_screenshot(record: dict[str, Any]) -> dict[str, Any]:
def _inline_screenshots(record: dict[str, Any]) -> dict[str, Any]:
payload = dict(record)
screenshot_path = payload.get("screenshot_path")
if screenshot_path:
for path_key, image_key in (
("before_screenshot_path", "before_image_base64"),
("after_screenshot_path", "after_image_base64"),
("screenshot_path", "image_base64"),
):
screenshot_path = payload.get(path_key)
if not screenshot_path:
continue
path = Path(str(screenshot_path))
if path.exists():
payload["image_base64"] = base64.b64encode(path.read_bytes()).decode(
"ascii"
)
payload[image_key] = base64.b64encode(path.read_bytes()).decode("ascii")
if "after_image_base64" not in payload and "image_base64" in payload:
payload["after_image_base64"] = payload["image_base64"]
elif "after_image_base64" in payload:
payload["image_base64"] = payload["after_image_base64"]
return payload
def _runner_max_steps(self) -> int: