Task configuration:
{"task_id": "12", "task_name": "\u6dfb\u52a0\u4e00\u5f20\u5361\u7247\uff0c\u6b63\u9762\u4e3awhat is this? \u9644\u5e26\u4e00\u5f20\u72d7\u7684\u7167\u7247\uff0c\u80cc\u9762\u4e3adog", "description": "\u6dfb\u52a0\u4e00\u5f20\u5361\u7247\uff0c\u6b63\u9762\u4e3awhat is this? \u9644\u5e26\u4e00\u5f20\u72d7\u7684\u7167\u7247\uff0c\u80cc\u9762\u4e3adog", "application_info": {"name": "anki", "executable_path": "/home/agent/anki/out/pyenv/bin/python", "args": ["/home/agent/anki/tools/run.py"], "cwd": "/home/agent/anki"}, "task_parameters": {"path": "/home/agent/agent-demo/PC-Canary/tests/tasks/anki/task12/dog.jpg"}, "instruction_template": "\u6dfb\u52a0\u4e00\u5f20\u5361\u7247\uff0c\u6b63\u9762\u4e3awhat is this?\uff1f\u9644\u5e26\u4e00\u5f20\u72d7\u7684\u56fe\u7247\uff0c\u56fe\u7247\u8def\u5f84\u4e3a${path}\uff0c\u80cc\u9762\u4e3adog", "evaluation_setup": {"scripts": [{"role": "hook", "path": "hooker.js", "dependency": ["../common/hooker_common.js"]}, {"role": "handler", "path": "handler.py"}], "timeout": 60}, "events": {"card_added": {"description": "\u6dfb\u52a0\u4e86\u5361\u7247", "is_key_step": true, "key_step_index": 2, "key_step_name": "\u6dfb\u52a0\u4e86\u5361\u7247"}, "image_added": {"description": "\u6dfb\u52a0\u4e86\u56fe\u7247", "is_key_step": true, "key_step_index": 1, "key_step_name": "\u6dfb\u52a0\u4e86\u56fe\u7247"}, "card_format_correct": {"description": "\u5361\u7247\u683c\u5f0f\u5339\u914d", "is_key_step": true, "key_step_index": 3, "key_step_name": "\u5361\u7247\u683c\u5f0f\u5339\u914d"}}, "sql_path": "/home/agent/.local/share/Anki2/sam/collection.anki2", "total_key_steps": 3, "mcp_servers": [{"command": "/home/agent/anki-mcp-server/.venv/bin/python", "args": ["/home/agent/anki-mcp-server/run_server.py"]}]}

Hook script:
const TRACE_FUNCTION = [
    "service_add_media_file",
    "storage_add_card",
]
function initHooks() {
    // iterate function name and addr, init it.
    for (const function_name of TRACE_FUNCTION){
        initHook(function_name, TRACE_MAPS[function_name]);
    }
}
initHooks();
sendLog("info", "add hooks done");

Evaluation handler:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import sys
import os
sys.path.append(os.path.dirname(__file__))
from common import *

def handle_storage_add_card(context: Context,message) -> Status:
    context.update_database()
    latest_card : Card = sorted(AnkiObjMap().array_by_type("card"),key=lambda x: x.mod,reverse=True)[0]
    note = latest_card.get_note()
    status = Status()
    status.emit(EventCardAdded())
    if len(note.fields) == 2 and "What is this?" in note.fields[0] and \
        tp.path.split('/')[-1] in note.fields[0] and note.fields[1] == "dog":
        status.emit(EventCardFormatCorrect())
    else:
        status.mark_error()
    return status

def handle_add_media_file(context: Context,message) -> Status:
    status = Status()
    status.emit(EventImageAdded())
    status.mark_progress()
    return status

TRACE_HANDLERS = {
    "storage_add_card": handle_storage_add_card,
    "service_add_media_file" : handle_add_media_file,
}   

dependency_graph = {
    image_added_: [],
    card_added_ : [image_added_],
    card_format_correct_ : [card_added_]
}
finished_list = [
   card_added_ 
]

bind_handlers(TRACE_HANDLERS,dependency_graph,finished_list)