{
    // 终末地电路拼图游戏的自动化 Pipeline
    "PuzzleSolverMain": {
        "desc": "主入口节点（终末地电路拼图游戏的自动化任务）",
        "recognition": "DirectHit",
        "next": [
            "PuzzleSolverOnScenePrepare",
            "PuzzleSolverOnSceneMain",
            "PuzzleSolverMaybeLoop"
        ]
    },
    "PuzzleSolverOnScenePrepare": {
        "desc": "解谜的准备界面（匹配屏幕左侧的特征性图案）",
        "recognition": "TemplateMatch",
        "roi": [
            167,
            199,
            354,
            296
        ],
        "template": "PuzzleSolver/ScenePrepare.png",
        "next": [
            "PuzzleSolverFindStartButton"
        ],
        "on_error": [
            "PuzzleSolverOnMiss"
        ],
        "focus": {
            "Node.Recognition.Succeeded": "💡 检测到拼图准备界面"
        }
    },
    "PuzzleSolverFindStartButton": {
        "desc": "查找并点击“修复”按钮以开始拼图解谜",
        "recognition": "TemplateMatch",
        "roi": [
            999,
            469,
            134,
            140
        ],
        "template": "PuzzleSolver/ButtonStart.png",
        "action": "Click",
        "post_wait_freezes": 100, // 点击后，等待界面加载
        "next": [
            "PuzzleSolverOnSceneMain"
        ],
        "on_error": [
            "PuzzleSolverOnMiss"
        ]
    },
    "PuzzleSolverOnSceneMain": {
        "desc": "解谜的主界面（匹配屏幕右上角的特征性图案）",
        "recognition": "TemplateMatch",
        "roi": [
            944,
            0,
            236,
            164
        ],
        "template": "PuzzleSolver/SceneMain.png",
        "rate_limit": 100, // 快速轮询
        "next": [
            "PuzzleSolverFindUnavailableTip",
            "PuzzleSolverFindCompleteTip",
            "PuzzleSolverSolvePuzzleReady"
        ]
    },
    "PuzzleSolverFindUnavailableTip": {
        "desc": "查找是否存在“有尚未了解的元件样式”的提示",
        "recognition": "TemplateMatch",
        "roi": [
            497,
            314,
            129,
            128
        ],
        "template": "PuzzleSolver/TipUnavailable.png",
        "post_delay": 5000,
        "next": [
            "PuzzleSolverOnPass"
        ],
        "focus": {
            "Node.Recognition.Succeeded": "❌ 检测到未满足拼图所需条件（请先去获取新元件）"
        }
    },
    "PuzzleSolverFindCompleteTip": {
        "desc": "查找是否存在“拼图已完成”的提示",
        "recognition": "TemplateMatch",
        "roi": [
            426,
            318,
            428,
            119
        ],
        "template": "PuzzleSolver/TipComplete.png",
        "post_delay": 5000,
        "next": [
            "PuzzleSolverOnPass"
        ]
    },
    "PuzzleSolverSolvePuzzleReady": {
        "desc": "准备执行拼图解决方案（守卫节点）",
        "recognition": "DirectHit",
        "pre_delay": 0, // 此节点为守卫节点，无需延迟
        "post_delay": 0, // 此节点为守卫节点，无需延迟
        "timeout": 10000, // 缩小超时阈值（默认 20000）
        "next": [
            "PuzzleSolverSolvePuzzle",
            "PuzzleSolverOnFail"
        ]
    },
    "PuzzleSolverSolvePuzzle": {
        "desc": "执行拼图解决方案（识别+计算+自动化操作）",
        "recognition": "Custom",
        "custom_recognition": "PuzzleRecognition",
        "action": "Custom",
        "custom_action": "PuzzleAction",
        "custom_action_param": {
            "dryRun": false
        },
        "next": [
            "PuzzleSolverOnSuccess"
        ],
        "focus": {
            "Node.Recognition.Starting": "👀 开始识别拼图题目",
            "Node.Recognition.Succeeded": "🧐 成功识别拼图题目，我寻思可以拼...",
            "Node.Recognition.Failed": "❌ 未能识别拼图题目",
            "Node.Action.Starting": "🫳 开始执行拼图操作",
            "Node.Action.Succeeded": "⭐ 结束执行拼图操作，哼哼，拼完了~",
            "Node.Action.Failed": "❌ 未能执行拼图操作"
        }
    },
    // 下面是一些回调节点的定义
    // 向回调节点的 next 列表中添加 "PuzzleSolverMain" 即可实现自动重试
    "PuzzleSolverMaybeLoop": {
        "desc": "回调：决定自循环（守卫节点）",
        "recognition": "DirectHit",
        "pre_delay": 0, // 此节点为守卫节点，无需延迟
        "post_delay": 0, // 此节点为守卫节点，无需延迟
        "next": [
            // 默认情况下不会自循环
        ],
        "focus": {
            "Node.Recognition.Succeeded": "❓ 未能按预期识别到拼图界面的UI元素"
        }
    },
    "PuzzleSolverOnSuccess": {
        "desc": "回调：解谜成功后触发，关闭拼图界面",
        "recognition": "DirectHit",
        "pre_wait_freezes": 500, // 等待结算动画结束
        "action": "LongPress",
        "target": [
            640,
            620
        ],
        "duration": 250,
        "post_delay": 2000,
        "next": [
            // 默认情况下，任务到这里就结束了
        ],
        "focus": {
            "Node.Recognition.Succeeded": "👌 已完成一轮拼图任务"
        }
    },
    "PuzzleSolverOnMiss": {
        "desc": "回调：未能按预期找到界面的UI元素时触发",
        "recognition": "DirectHit",
        "next": [
            // 默认情况下，任务到这里就结束了
        ],
        "focus": {
            "Node.Recognition.Succeeded": "❓ 未能按预期识别到拼图界面的UI元素"
        }
    },
    "PuzzleSolverOnPass": {
        "desc": "回调：无需执行下一步操作时触发",
        "recognition": "DirectHit",
        "next": [
            // 默认情况下，任务到这里就结束了
        ],
        "focus": {
            "Node.Recognition.Succeeded": "❔ 未检测到需要操作的拼图界面"
        }
    },
    "PuzzleSolverOnFail": {
        "desc": "回调：核心任务（PuzzleSolverSolvePuzzle）识别未命中时触发",
        "recognition": "DirectHit",
        "next": [
            // 默认情况下，任务到这里就结束了
        ],
        "focus": {
            "Node.Recognition.Succeeded": "❌ 未能处理拼图题目\n- 如果当前处于拼图界面，则表明拼图识别算法存在问题，请向我们提交反馈；\n- 如果当前没有处于拼图界面，则这是一次误识别，可以忽略。"
        }
    }
}
