Task configuration:
{"task_id": "10", "task_name": "set_source_visibility", "description": "obs-studio set source visibility", "application_info": {"name": "obs-studio", "executable_path": "/workspace/PC-Canary/apps/obs-studio/build_ubuntu/rundir/Debug/bin/obs", "args": []}, "task_parameters": {"source_name": "Display Capture (XSHM)", "source_visible": false}, "instruction_template": "Please set the visibility of ${source_name} to ${source_visible} in obs-studio", "evaluation_setup": {"scripts": [{"role": "hook", "path": "hooker.js"}, {"role": "handler", "path": "handler.py"}], "timeout": 180}, "preconditions": {"obs_studio_running": true}, "total_key_steps": 1, "events": {"source_invisible": {"description": "Source visibility matched", "is_key_step": true, "key_step_index": 1, "key_step_name": "Current source visibility matched successfully"}}, "mcp_servers": [{"command": "node", "args": ["/home/agent/obs-mcp/build/index.js"]}]}

Hook script:
(function () {
    // Script settings
    const FUNCTION_SET_VISIBLE_NAME = "obs_sceneitem_set_visible";
    const FUNCTION_SET_VISIBLE_SYMBOL = "obs_sceneitem_set_visible";

    const EVENT_ON_ENTER = "function called";
    const EVENT_ON_LEAVE = "function returned";
    const EVENT_SET_VISIBLE_SUCCESS = "set_visible_success";

    const MESSAGE_called = "Intercepted function call";
    const MESSAGE_returned = "Function returned";
    const MESSAGE_ON_SUCCESS = "Modify source visibility operation completed";
    const MESSAGE_script_initialized = "Monitoring script has started";
    const MESSAGE_hook_installed = "Monitoring hook installed, waiting for operation...";

    // Send events to the evaluation system
    function sendEvent(eventType, data = {}) {
        const payload = {
            event: eventType,
            ...data,
            timestamp: new Date().getTime()
        };
        send(payload);
    }

    // Get function address
    function getFunctionAddress(functionName) {
        const funcAddr = DebugSymbol.getFunctionByName(functionName);
        if (!funcAddr) {
            sendEvent("error", {
                error_type: "function_not_found",
                message: `Cannot find function ${functionName}`
            });
            return null;
        }

        sendEvent("function_found", {
            address: funcAddr.toString(),
            message: `Found the actual address of function ${functionName}`
        });
        return funcAddr;
    }

    // Initialize recording update hooks
    function initHook_set_visible() {
        const funcAddr = getFunctionAddress(FUNCTION_SET_VISIBLE_NAME);
        if (!funcAddr) {
            return;
        }

        Interceptor.attach(funcAddr, {
            onEnter(args) {
                sendEvent(EVENT_ON_ENTER, {
                    message: MESSAGE_called,
                    function: FUNCTION_SET_VISIBLE_NAME,
                    symbol: FUNCTION_SET_VISIBLE_SYMBOL
                });
                this.visible = args[1].toInt32();
                const item_pointer = new NativePointer(args[0]);
                console.log(item_pointer);
                this.source_name = item_pointer.add(32).readPointer().readPointer().readCString(-1);
                console.log(this.source_name);
            },

            onLeave(retval) {
                sendEvent(EVENT_ON_LEAVE, {
                    message: MESSAGE_returned,
                    function: FUNCTION_SET_VISIBLE_NAME,
                    symbol: FUNCTION_SET_VISIBLE_SYMBOL
                });
                sendEvent(EVENT_SET_VISIBLE_SUCCESS, {
                    message: MESSAGE_ON_SUCCESS,
                    flag: retval.toInt32(),
                    visible: this.visible,
                    source_name: this.source_name,
                });
            }
        });
    }

    // Initialize hooks
    function initHook() {
        sendEvent("script_initialized", {
            message: MESSAGE_script_initialized
        });

        // Initialize individual hooks
        initHook_set_visible();
        sendEvent("hook_installed", {
            message: MESSAGE_hook_installed
        });
    }

    // Start script
    initHook();
})();

Evaluation handler:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

from typing import Dict, Any, Optional, List

_EVENT_SET_VISIBLE_SUCCESS = "set_visible_success"
_PAYLOAD_SUCCESS = "flag"


def message_handler(
    message: Dict[str, Any], logger, task_parameter: Dict[str, Any]
) -> Optional[List[Dict[str, Any]]]:
    payload = message["payload"]
    event_type = payload["event"]
    logger.debug(f"receive: {event_type}")
    if event_type == _EVENT_SET_VISIBLE_SUCCESS:
        logger.info(payload.get("message", ""))
        expected = task_parameter.get("source_name", "")
        expected_visible = task_parameter.get("source_visible")
        flag = payload.get(_PAYLOAD_SUCCESS)
        current = payload.get("source_name", "")
        visible = True if payload.get("visible") == 1 else False
        if flag and (current == expected) and (visible == expected_visible):
            return [
                {"status": "key_step", "index": 1},
                {"status": "success", "reason": "successfully set source visibility"},
            ]
    return None