"""Robot helper: verify WrappedToolExecutor delegates to wrapped tool.""" from cleveragents.domain.models.core.tool import ( Tool, ToolCapability, ToolSource, ToolType, Validation, ValidationMode, ) from cleveragents.tool.wrapping import WrappedToolExecutor tool = Tool( name="local/run", description="run", source=ToolSource.BUILTIN, capability=ToolCapability(read_only=True), ) val = Validation( name="local/check", description="check", source=ToolSource.WRAPPED, tool_type=ToolType.VALIDATION, mode=ValidationMode.REQUIRED, wraps="local/run", transform='def transform(x):\n return {"passed": True, "data": x}\n', ) lookup = lambda n: tool if n == "local/run" else None # noqa: E731 called: list[str] = [] def executor_fn(n: str, a: dict) -> dict: # type: ignore[type-arg] """Record tool call and return output.""" called.append(n) return {"result": "ok"} ex = WrappedToolExecutor(lookup, executor_fn) r = ex.execute(val, {"a": 1}) assert r["passed"] is True assert "local/run" in called print("OK")