Task configuration:
{"task_id": "11", "task_name": "add_new_video_source", "description": "Add a new looped video source in obs-studio", "application_info": {"name": "obs-studio", "executable_path": "/workspace/PC-Canary/apps/obs-studio/build_ubuntu/rundir/Debug/bin/obs", "args": []}, "task_parameters": {"new_scene_name": "Scene3", "source_name": "test", "source_type": "ffmpeg_source"}, "instruction_template": "Please create a new scene ${new_scene_name} in obs-studio, and add a new looped video source in the new scene, with name ${source_name} and type ${source_type}", "evaluation_setup": {"scripts": [{"role": "hook", "path": "hooker.js"}, {"role": "handler", "path": "handler.py"}], "timeout": 180}, "preconditions": {"obs_studio_running": true}, "total_key_steps": 4, "events": {"scene_name_matched": {"description": "Scene name matched successfully", "is_key_step": true, "key_step_index": 1, "key_step_name": "Scene name matched successfully"}, "source_name_matched": {"description": "Source name matched successfully", "is_key_step": true, "key_step_index": 2, "key_step_name": "Source name matched successfully"}, "source_type_matched": {"description": "Source type matched successfully", "is_key_step": true, "key_step_index": 3, "key_step_name": "Source type matched successfully"}, "loop": {"description": "Looped video source properties updated successfully", "is_key_step": true, "key_step_index": 4, "key_step_name": "Set as looped video source"}}, "mcp_servers": [{"command": "node", "args": ["/home/agent/obs-mcp/build/index.js"]}]}

Hook script:
(function () {
    // Script settings
    const FUNCTION_NAME = "obs_source_create";
    const FUNCTION_SYMBOL = "obs_source_create";
    const FUNCTION = "obs_data_get_bool";

    const EVENT_ON_ENTER = "function called";
    const EVENT_ON_LEAVE = "function returned";
    const EVENT_SUCCESS = "create_success";

    const MESSAGE_called = "Intercepted function call";
    const MESSAGE_returned = "Function returned";
    const MESSAGE_ON_SUCCESS = "Create new source 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 hook() {
        const funcAddr = getFunctionAddress(FUNCTION_NAME);
        if (!funcAddr) {
            return;
        }

        Interceptor.attach(funcAddr, {
            onEnter(args) {
                sendEvent(EVENT_ON_ENTER, {
                    message: MESSAGE_called,
                    function: FUNCTION_NAME,
                    symbol: FUNCTION_SYMBOL
                });
                this.name = args[1].readCString(-1);
                this.type = args[0].readCString(-1);
                console.log(this.name);
                console.log(this.type);
            },

            onLeave(retval) {
                sendEvent(EVENT_ON_LEAVE, {
                    message: MESSAGE_returned,
                    function: FUNCTION_NAME,
                    symbol: FUNCTION_SYMBOL
                });
                sendEvent(EVENT_SUCCESS, {
                    message: MESSAGE_ON_SUCCESS,
                    name: this.name,
                    type: this.type
                });
            }
        });

        Interceptor.attach(getFunctionAddress(FUNCTION), {
            onEnter(args) {
                this.name = args[1].readCString(-1);
                if (this.name != "looping") {
                    return;
                }
                sendEvent(EVENT_ON_ENTER, {
                    message: MESSAGE_called,
                    function: FUNCTION,
                    symbol: FUNCTION
                });
            },

            onLeave(retval) {
                if (this.name != "looping") {
                    return;
                }
                console.log(retval);
                if (this.name == "looping") {
                    sendEvent(EVENT_ON_LEAVE, {
                        message: MESSAGE_returned,
                        function: FUNCTION,
                        symbol: FUNCTION
                    });
                    sendEvent("updated_source", {
                        message: "Update source completed",
                        looping: retval == 1 ? "true" : "false"
                    });
                }
            }
        });

        Interceptor.attach(getFunctionAddress("obs_scene_create"), {
            onEnter(args) {
                this.name = args[0].readCString(-1);
                console.log(this.name);
            },

            onLeave(retval) {
            }
        });
    }

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

        // Initialize individual hooks
        hook();
        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_SUCCESS = "updated_source"


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"Received event: {event_type}")
    if event_type == "create_success":
        expected_scene_name = task_parameter.get("new_scene_name", "")
        expected_name = task_parameter.get("source_name", "")
        expected_type = task_parameter.get("source_type", "")
        source_name = payload.get("name", "")
        source_type = payload.get("type", "")
        if source_name == expected_scene_name:
            return [{"status": "key_step", "index": 1}]
        if source_name == expected_name and source_type == expected_type:
            return [
                {"status": "key_step", "index": 2},
                {"status": "key_step", "index": 3},
            ]

    elif event_type == _EVENT_SUCCESS:
        logger.info(payload.get("message", ""))

        if payload.get("looping", "") == "true":
            return [
                {"status": "key_step", "index": 4},
                {
                    "status": "success",
                    "reason": "Successfully added looping media source",
                },
            ]

    return None