{
  "name": "呼叫 Miharu",
  "format": "manual-shortcut-blueprint-v1",
  "installable": false,
  "inputTypes": [
    "image"
  ],
  "noInput": "continue",
  "menu": [
    "文字对话",
    "发送图片"
  ],
  "replyDestination": "shortcut",
  "context": "weixin:owner",
  "configuration": {
    "server": "https://miharu.linerrofak.men",
    "token": "<每台设备的私有令牌>"
  },
  "variables": [
    "服务器",
    "令牌",
    "待发图片",
    "图片编码",
    "问题",
    "请求编号",
    "任务编号",
    "已经完成",
    "任务状态",
    "回答"
  ],
  "flow": [
    {
      "if": "share input has image",
      "then": [
        "reject more than one image",
        "ask question",
        "convert JPEG without metadata",
        "encode base64 without newlines"
      ],
      "else": [
        "choose text or single photo",
        "ask question"
      ]
    },
    {
      "repeat": "conversation turns, maximum 100",
      "actions": [
        "generate request UUID",
        "POST JSON to /api/requests",
        "get task id",
        "poll GET /api/requests/{id} every 2 seconds",
        "after 30 polls offer continue waiting or end",
        "show completed reply",
        "offer followup text or end",
        "clear image for followup"
      ]
    }
  ],
  "api": {
    "submit": {
      "method": "POST",
      "path": "/api/requests",
      "headers": {
        "Authorization": "Bearer ${令牌}"
      },
      "json": {
        "requestId": "${请求编号}",
        "text": "${问题}",
        "imageBase64": "${图片编码}"
      }
    },
    "poll": {
      "method": "GET",
      "path": "/api/requests/${任务编号}",
      "headers": {
        "Authorization": "Bearer ${令牌}"
      }
    }
  },
  "fullInstructions": "https://miharu.linerrofak.men/guide",
  "signedPackageUrl": "https://miharu.linerrofak.men/call-miharu.shortcut"
}
