事件流与生命周期
任务协同与接管
AI 思考状态推送、长任务心跳与验证码人机接管
1. 向手机推送 AI 思考状态 (hermes.send_ai_thought)
在 Agent 规划或多步操作时,向手机屏幕常驻悬浮窗推送自然语言状态:
curl -X POST "http://localhost:58166/gateway/skill/execute" \
-H "Content-Type: application/json" \
-H "X-AppKey: <your-key>" \
-d '{
"device_id": "848bd13e2f9",
"skill_id": "hermes.send_ai_thought",
"params": {
"thought": "正在识别当前对话窗口中的客户提问...",
"next_step": "提取联系方式并生成回复草稿",
"task_id": "task-reply-001"
}
}'
2. 上报任务进度心跳 (POST /gateway/task/progress)
长任务建议每 15~30 秒调用一次,兼作设备租约续期:
curl -X POST "http://localhost:58166/gateway/task/progress" \
-H "Content-Type: application/json" \
-H "X-AppKey: <your-key>" \
-d '{
"task_id": "task-reply-001",
"device_id": "848bd13e2f9",
"step": 3,
"desc": "正在导航至好友聊天页面..."
}'
3. 强行终止任务 (POST /robot/ai-task/stop/{device_id})
立即强制打断手机端当前执行的全部自动化动作,并收起 AI 悬浮窗:
curl -X POST "http://localhost:58166/robot/ai-task/stop/848bd13e2f9" \
-H "X-AppKey: <your-key>"
4. 安全验证人机协同接管 (/gateway/ai/takeover)
遇到敏感操作安全验证(如滑块验证、短信确认、人脸识别)时触发人机协同接管:
curl -X POST "http://localhost:58166/gateway/ai/takeover" \
-H "Content-Type: application/json" \
-H "X-AppKey: <your-key>" \
-d '{
"device_id": "848bd13e2f9",
"title": "遇到滑动验证码",
"message": "请人工完成拼图滑动后点击【已完成放行】。"
}'
轮询用户接管结果:GET /gateway/ai/takeover-result/{device_id},返回 {"action": "resume" | "stop" | "waiting"}。