{
  "type": "object",
  "properties": {
    "apiVersion": {
      "const": 1
    },
    "id": {
      "type": "string",
      "minLength": 1,
      "maxLength": 128,
      "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._-]{0,127}$"
    },
    "name": {
      "type": "string",
      "minLength": 1,
      "maxLength": 128
    },
    "version": {
      "type": "string",
      "minLength": 1,
      "maxLength": 128,
      "pattern": "^(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)(-[0-9A-Za-z.-]+)?(\\+[0-9A-Za-z.-]+)?$"
    },
    "description": {
      "type": "string",
      "maxLength": 2000
    },
    "author": {
      "type": "string",
      "maxLength": 160
    },
    "main": {
      "type": "string",
      "minLength": 1,
      "maxLength": 512
    },
    "icon": {
      "type": "string",
      "minLength": 1,
      "maxLength": 512,
      "pattern": "^(?!.*[\\\\:\\u0000-\\u001f\\u007f?#%])(?!.*[. ]/)(?!(?:.*/)?\\.\\.?(?:/|$))[^/]+(?:/[^/]+)*\\.(?:[pP][nN][gG]|[jJ][pP][eE]?[gG]|[wW][eE][bB][pP])$"
    },
    "category": {
      "type": "string"
    },
    "tags": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "minItems": 0,
      "maxItems": 256
    },
    "dependencies": {
      "type": "object",
      "maxProperties": 64,
      "description": "Required FlyonDeck plugin IDs mapped to SemVer package ranges; service providers in uses must also be declared here. The host validates ranges and resolves the dependency graph.",
      "propertyNames": {
        "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._-]{0,127}$",
        "not": {
          "enum": [
            "__proto__",
            "constructor",
            "prototype"
          ]
        }
      },
      "additionalProperties": {
        "type": "string",
        "minLength": 1,
        "maxLength": 256
      }
    },
    "permissions": {
      "type": "array",
      "items": {
        "type": "string",
        "minLength": 1,
        "maxLength": 128,
        "pattern": "^[a-zA-Z][a-zA-Z0-9._:-]{0,127}$"
      },
      "minItems": 0,
      "maxItems": 64,
      "uniqueItems": true
    },
    "hostPlatforms": {
      "type": "array",
      "items": {
        "enum": [
          "windows",
          "macos",
          "linux",
          "harmonyos"
        ]
      },
      "minItems": 1,
      "maxItems": 4,
      "uniqueItems": true
    },
    "networkOrigins": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "minItems": 0,
      "maxItems": 8,
      "uniqueItems": true
    },
    "widgetConnectOrigins": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "minItems": 0,
      "maxItems": 8,
      "uniqueItems": true
    },
    "uses": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "pluginId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128,
            "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._-]{0,127}$"
          },
          "serviceId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128,
            "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._-]{0,127}$"
          },
          "version": {
            "type": "integer",
            "minimum": 1
          }
        },
        "required": [
          "pluginId",
          "serviceId",
          "version"
        ],
        "additionalProperties": false
      },
      "minItems": 0,
      "maxItems": 64
    },
    "contributes": {
      "type": "object",
      "properties": {
        "actions": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "minLength": 1,
                "maxLength": 128,
                "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._-]{0,127}$"
              },
              "title": {
                "type": "string",
                "minLength": 1,
                "maxLength": 128
              },
              "description": {
                "type": "string",
                "maxLength": 240
              },
              "icon": {
                "type": "string",
                "minLength": 1,
                "maxLength": 512,
                "anyOf": [
                  {
                    "pattern": "^(host:[A-Za-z][A-Za-z0-9._-]{0,63}/[A-Za-z][A-Za-z0-9._-]{0,63}|plugin:[a-zA-Z0-9][a-zA-Z0-9._-]{0,127}/[A-Za-z][A-Za-z0-9._-]{0,63}/[A-Za-z][A-Za-z0-9._-]{0,63})$"
                  },
                  {
                    "pattern": "^(?!/)(?!.*(?:^|/)\\.{1,2}(?:/|$))(?!.*\\.(?:/|$))(?!.*[\\\\:\\u0000-\\u0020\\u007f?#%])[^/]+(?:/[^/]+)*\\.[sS][vV][gG]$"
                  }
                ]
              },
              "category": {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "pattern": "^[a-z][a-z0-9-]{0,63}$"
              },
              "argsSchema": {
                "allOf": [
                  {
                    "$ref": "action-schema.schema.json"
                  },
                  {
                    "properties": {
                      "type": {
                        "const": "object"
                      }
                    }
                  }
                ]
              },
              "outputSchema": {
                "$ref": "action-schema.schema.json"
              },
              "execution": {
                "type": "object",
                "properties": {
                  "timeoutMs": {
                    "type": "integer",
                    "minimum": 100,
                    "maximum": 300000
                  },
                  "concurrency": {
                    "enum": [
                      "serial",
                      "parallel"
                    ]
                  },
                  "resource": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 80,
                    "pattern": "^[a-zA-Z0-9._-]+$"
                  },
                  "hostResource": {
                    "enum": [
                      "desktop",
                      "audio"
                    ]
                  }
                },
                "required": [],
                "additionalProperties": false
              },
              "hostPlatforms": {
                "type": "array",
                "items": {
                  "enum": [
                    "windows",
                    "macos",
                    "linux",
                    "harmonyos"
                  ]
                },
                "minItems": 1,
                "maxItems": 4,
                "uniqueItems": true,
                "description": "动作支持的宿主系统，必须是顶层 hostPlatforms 的子集；省略时继承顶层声明。"
              },
              "valueControl": {
                "type": "object",
                "properties": {
                  "parameter": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 128
                  },
                  "state": {
                    "type": "object",
                    "properties": {
                      "sourceId": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 128
                      },
                      "path": {
                        "type": "array",
                        "maxItems": 8,
                        "items": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 128
                        }
                      },
                      "availabilityPath": {
                        "type": "array",
                        "maxItems": 8,
                        "items": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 128
                        }
                      }
                    },
                    "required": [
                      "sourceId"
                    ],
                    "additionalProperties": false
                  }
                },
                "required": [
                  "parameter"
                ],
                "additionalProperties": false
              },
              "titleKey": {
                "type": "string",
                "minLength": 1,
                "maxLength": 2000
              },
              "descriptionKey": {
                "type": "string",
                "minLength": 1,
                "maxLength": 2000
              }
            },
            "required": [
              "id",
              "title"
            ],
            "additionalProperties": false
          },
          "minItems": 0,
          "maxItems": 256
        },
        "buttonPresets": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "pattern": "^[a-z][a-z0-9_-]{0,63}$"
              },
              "title": {
                "type": "string",
                "minLength": 1,
                "maxLength": 80
              },
              "description": {
                "type": "string",
                "maxLength": 240
              },
              "category": {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "pattern": "^[a-z][a-z0-9-]{0,63}$"
              },
              "icon": {
                "type": "string",
                "minLength": 1,
                "maxLength": 512,
                "anyOf": [
                  {
                    "pattern": "^(host:[A-Za-z][A-Za-z0-9._-]{0,63}/[A-Za-z][A-Za-z0-9._-]{0,63}|plugin:[a-zA-Z0-9][a-zA-Z0-9._-]{0,127}/[A-Za-z][A-Za-z0-9._-]{0,63}/[A-Za-z][A-Za-z0-9._-]{0,63})$"
                  },
                  {
                    "pattern": "^(?!/)(?!.*(?:^|/)\\.{1,2}(?:/|$))(?!.*\\.(?:/|$))(?!.*[\\\\:\\u0000-\\u0020\\u007f?#%])[^/]+(?:/[^/]+)*\\.[sS][vV][gG]$"
                  }
                ]
              },
              "actionId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 128,
                "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._-]{0,127}$"
              },
              "button": {
                "type": "object",
                "properties": {
                  "title": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 50
                  },
                  "titleFrom": {
                    "type": "object",
                    "properties": {
                      "arg": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 128,
                        "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._-]{0,127}$"
                      },
                      "transform": {
                        "enum": [
                          "application-name",
                          "basename",
                          "hostname",
                          "hotkey",
                          "screen-name"
                        ]
                      }
                    },
                    "required": [
                      "arg",
                      "transform"
                    ],
                    "additionalProperties": false
                  },
                  "icon": {
                    "oneOf": [
                      {
                        "type": "object",
                        "properties": {
                          "kind": {
                            "const": "none"
                          }
                        },
                        "required": [
                          "kind"
                        ],
                        "additionalProperties": false
                      },
                      {
                        "type": "object",
                        "properties": {
                          "kind": {
                            "const": "emoji"
                          },
                          "text": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 12
                          }
                        },
                        "required": [
                          "kind",
                          "text"
                        ],
                        "additionalProperties": false
                      },
                      {
                        "type": "object",
                        "properties": {
                          "kind": {
                            "const": "application"
                          },
                          "arg": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 128,
                            "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._-]{0,127}$"
                          }
                        },
                        "required": [
                          "kind",
                          "arg"
                        ],
                        "additionalProperties": false
                      },
                      {
                        "type": "object",
                        "properties": {
                          "kind": {
                            "const": "icon-pack"
                          },
                          "id": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 80,
                            "pattern": "^(host:[A-Za-z][A-Za-z0-9._-]{0,63}/[A-Za-z][A-Za-z0-9._-]{0,63}|plugin:[a-zA-Z0-9][a-zA-Z0-9._-]{0,127}/[A-Za-z][A-Za-z0-9._-]{0,63}/[A-Za-z][A-Za-z0-9._-]{0,63})$"
                          }
                        },
                        "required": [
                          "kind",
                          "id"
                        ],
                        "additionalProperties": false
                      }
                    ]
                  },
                  "backgroundColor": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 9,
                    "pattern": "^#[0-9a-fA-F]{6}([0-9a-fA-F]{2})?$"
                  },
                  "foregroundColor": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 9,
                    "pattern": "^#[0-9a-fA-F]{6}([0-9a-fA-F]{2})?$"
                  },
                  "showTitle": {
                    "type": "boolean"
                  },
                  "size": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 3,
                    "pattern": "^[1-8]x[1-8]$"
                  },
                  "titleKey": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 2000
                  }
                },
                "required": [
                  "title",
                  "icon"
                ],
                "additionalProperties": false
              },
              "multiState": {
                "type": "object",
                "properties": {
                  "sourceId": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 128,
                    "pattern": "^[a-z][a-z0-9._:-]{0,127}$"
                  },
                  "sourceKind": {
                    "const": "local"
                  },
                  "initialState": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 128,
                    "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._-]{0,127}$"
                  },
                  "persistent": {
                    "type": "boolean"
                  },
                  "states": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 128,
                          "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._-]{0,127}$"
                        },
                        "actionId": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 128,
                          "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._-]{0,127}$"
                        },
                        "nextState": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 128,
                          "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._-]{0,127}$"
                        },
                        "button": {
                          "type": "object",
                          "properties": {
                            "title": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 50
                            },
                            "titleFrom": {
                              "type": "object",
                              "properties": {
                                "arg": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 128,
                                  "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._-]{0,127}$"
                                },
                                "transform": {
                                  "enum": [
                                    "application-name",
                                    "basename",
                                    "hostname",
                                    "hotkey",
                                    "screen-name"
                                  ]
                                }
                              },
                              "required": [
                                "arg",
                                "transform"
                              ],
                              "additionalProperties": false
                            },
                            "icon": {
                              "oneOf": [
                                {
                                  "type": "object",
                                  "properties": {
                                    "kind": {
                                      "const": "none"
                                    }
                                  },
                                  "required": [
                                    "kind"
                                  ],
                                  "additionalProperties": false
                                },
                                {
                                  "type": "object",
                                  "properties": {
                                    "kind": {
                                      "const": "emoji"
                                    },
                                    "text": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 12
                                    }
                                  },
                                  "required": [
                                    "kind",
                                    "text"
                                  ],
                                  "additionalProperties": false
                                },
                                {
                                  "type": "object",
                                  "properties": {
                                    "kind": {
                                      "const": "application"
                                    },
                                    "arg": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 128,
                                      "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._-]{0,127}$"
                                    }
                                  },
                                  "required": [
                                    "kind",
                                    "arg"
                                  ],
                                  "additionalProperties": false
                                },
                                {
                                  "type": "object",
                                  "properties": {
                                    "kind": {
                                      "const": "icon-pack"
                                    },
                                    "id": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 80,
                                      "pattern": "^(host:[A-Za-z][A-Za-z0-9._-]{0,63}/[A-Za-z][A-Za-z0-9._-]{0,63}|plugin:[a-zA-Z0-9][a-zA-Z0-9._-]{0,127}/[A-Za-z][A-Za-z0-9._-]{0,63}/[A-Za-z][A-Za-z0-9._-]{0,63})$"
                                    }
                                  },
                                  "required": [
                                    "kind",
                                    "id"
                                  ],
                                  "additionalProperties": false
                                }
                              ]
                            },
                            "backgroundColor": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 9,
                              "pattern": "^#[0-9a-fA-F]{6}([0-9a-fA-F]{2})?$"
                            },
                            "foregroundColor": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 9,
                              "pattern": "^#[0-9a-fA-F]{6}([0-9a-fA-F]{2})?$"
                            },
                            "showTitle": {
                              "type": "boolean"
                            },
                            "size": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 3,
                              "pattern": "^[1-8]x[1-8]$"
                            },
                            "titleKey": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 2000
                            }
                          },
                          "required": [
                            "title",
                            "icon"
                          ],
                          "additionalProperties": false
                        }
                      },
                      "required": [
                        "id",
                        "button"
                      ],
                      "additionalProperties": false
                    },
                    "minItems": 2,
                    "maxItems": 257
                  }
                },
                "required": [
                  "states"
                ],
                "additionalProperties": false
              },
              "titleKey": {
                "type": "string",
                "minLength": 1,
                "maxLength": 2000
              },
              "descriptionKey": {
                "type": "string",
                "minLength": 1,
                "maxLength": 2000
              }
            },
            "required": [
              "id",
              "title",
              "actionId",
              "button"
            ],
            "additionalProperties": false
          },
          "minItems": 0,
          "maxItems": 32
        },
        "stateSources": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "minLength": 1,
                "maxLength": 128,
                "pattern": "^[a-z][a-z0-9._:-]{0,127}$"
              },
              "title": {
                "type": "string",
                "minLength": 1,
                "maxLength": 80
              },
              "description": {
                "type": "string",
                "maxLength": 240
              },
              "scope": {
                "enum": [
                  "global",
                  "device",
                  "screen",
                  "widget-shared",
                  "widget-instance"
                ]
              },
              "visibility": {
                "enum": [
                  "block",
                  "screen",
                  "device",
                  "global"
                ]
              },
              "widgetId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 128,
                "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._-]{0,127}$"
              },
              "schema": {
                "$ref": "action-schema.schema.json"
              },
              "readAccess": {
                "type": "object",
                "properties": {
                  "workflows": {
                    "type": "boolean"
                  },
                  "widgets": {
                    "type": "boolean"
                  }
                },
                "required": [
                  "workflows",
                  "widgets"
                ],
                "additionalProperties": false
              },
              "writeAccess": {
                "const": "owner-plugin"
              },
              "lifetime": {
                "enum": [
                  "plugin",
                  "layout",
                  "placement"
                ]
              },
              "maxBytes": {
                "type": "integer",
                "minimum": 1024,
                "maximum": 65536
              },
              "titleKey": {
                "type": "string",
                "minLength": 1,
                "maxLength": 2000
              },
              "descriptionKey": {
                "type": "string",
                "minLength": 1,
                "maxLength": 2000
              }
            },
            "required": [
              "id",
              "title",
              "scope",
              "visibility",
              "schema",
              "readAccess",
              "writeAccess",
              "lifetime"
            ],
            "additionalProperties": false
          },
          "minItems": 0,
          "maxItems": 128
        },
        "widgets": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "minLength": 1,
                "maxLength": 128,
                "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._-]{0,127}$"
              },
              "title": {
                "type": "string",
                "minLength": 1,
                "maxLength": 128
              },
              "description": {
                "type": "string",
                "maxLength": 240
              },
              "category": {
                "type": "string",
                "minLength": 1,
                "maxLength": 48
              },
              "page": {
                "type": "string",
                "minLength": 1,
                "maxLength": 512
              },
              "configPage": {
                "type": "string",
                "minLength": 1,
                "maxLength": 128
              },
              "defaultSize": {
                "type": "object",
                "properties": {
                  "cols": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 16
                  },
                  "rows": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 16
                  }
                },
                "required": [
                  "cols",
                  "rows"
                ],
                "additionalProperties": false
              },
              "allowedSizes": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "cols": {
                      "type": "integer",
                      "minimum": 1,
                      "maximum": 16
                    },
                    "rows": {
                      "type": "integer",
                      "minimum": 1,
                      "maximum": 16
                    }
                  },
                  "required": [
                    "cols",
                    "rows"
                  ],
                  "additionalProperties": false
                },
                "minItems": 1,
                "maxItems": 16,
                "uniqueItems": true
              },
              "stateSource": {
                "type": "string",
                "minLength": 1,
                "maxLength": 128,
                "pattern": "^[a-z][a-z0-9._:-]{0,127}$"
              },
              "customizableGestures": {
                "type": "array",
                "items": {
                  "enum": [
                    "click",
                    "doubleClick",
                    "swipeLeft",
                    "swipeRight",
                    "longPress"
                  ]
                },
                "minItems": 1,
                "maxItems": 5,
                "uniqueItems": true
              },
              "instanceActions": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 32,
                      "pattern": "^[a-z][a-z0-9-]{0,31}$"
                    },
                    "title": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 64
                    },
                    "argsSchema": {
                      "allOf": [
                        {
                          "$ref": "action-schema.schema.json"
                        },
                        {
                          "properties": {
                            "type": {
                              "const": "object"
                            }
                          }
                        }
                      ]
                    },
                    "execution": {
                      "type": "object",
                      "properties": {
                        "timeoutMs": {
                          "type": "integer",
                          "minimum": 100,
                          "maximum": 300000
                        },
                        "concurrency": {
                          "enum": [
                            "serial",
                            "parallel"
                          ]
                        },
                        "resource": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 80,
                          "pattern": "^[a-zA-Z0-9._-]+$"
                        },
                        "hostResource": {
                          "enum": [
                            "desktop",
                            "audio"
                          ]
                        }
                      },
                      "required": [],
                      "additionalProperties": false
                    },
                    "titleKey": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 2000
                    }
                  },
                  "required": [
                    "id"
                  ],
                  "additionalProperties": false
                },
                "minItems": 0,
                "maxItems": 16
              },
              "settingsSchema": {
                "type": "object",
                "properties": {
                  "properties": {
                    "type": "object",
                    "maxProperties": 16,
                    "propertyNames": {
                      "pattern": "^[a-z][a-zA-Z0-9_]{0,63}$"
                    },
                    "additionalProperties": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "enum": [
                            "string",
                            "integer",
                            "boolean"
                          ]
                        },
                        "title": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 80
                        },
                        "description": {
                          "type": "string",
                          "maxLength": 240
                        },
                        "control": {
                          "enum": [
                            "search-select",
                            "password",
                            "icon"
                          ]
                        },
                        "visibility": {
                          "enum": [
                            "public",
                            "private"
                          ]
                        },
                        "options": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "label": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 80
                              },
                              "value": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 256
                              },
                              "labelKey": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 2000
                              }
                            },
                            "required": [
                              "label",
                              "value"
                            ],
                            "additionalProperties": false
                          },
                          "minItems": 1,
                          "maxItems": 512
                        },
                        "dynamicOptions": {
                          "const": true
                        },
                        "default": {
                          "type": [
                            "string",
                            "number",
                            "boolean"
                          ]
                        },
                        "minimum": {
                          "type": "integer"
                        },
                        "maximum": {
                          "type": "integer"
                        },
                        "titleKey": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 2000
                        },
                        "descriptionKey": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 2000
                        }
                      },
                      "required": [
                        "type",
                        "title"
                      ],
                      "additionalProperties": false
                    }
                  }
                },
                "required": [
                  "properties"
                ],
                "additionalProperties": false
              },
              "valueControl": {
                "const": true
              },
              "titleKey": {
                "type": "string",
                "minLength": 1,
                "maxLength": 2000
              },
              "descriptionKey": {
                "type": "string",
                "minLength": 1,
                "maxLength": 2000
              },
              "categoryKey": {
                "type": "string",
                "minLength": 1,
                "maxLength": 2000
              }
            },
            "required": [
              "id",
              "title",
              "page",
              "defaultSize"
            ],
            "additionalProperties": false
          },
          "minItems": 0,
          "maxItems": 256
        },
        "dataProviders": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "minLength": 1,
                "maxLength": 128,
                "pattern": "^[a-z][a-z0-9._-]{0,127}$"
              },
              "widget": {
                "type": "string",
                "minLength": 1,
                "maxLength": 128,
                "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._-]{0,127}$"
              },
              "lifetime": {
                "const": "request"
              },
              "visibility": {
                "const": "instance"
              },
              "requestSchema": {
                "allOf": [
                  {
                    "$ref": "action-schema.schema.json"
                  },
                  {
                    "properties": {
                      "type": {
                        "const": "object"
                      }
                    }
                  }
                ]
              },
              "responseSchema": {
                "$ref": "action-schema.schema.json"
              },
              "timeoutMs": {
                "type": "integer",
                "minimum": 100,
                "maximum": 30000
              },
              "maxBytes": {
                "type": "integer",
                "minimum": 1024,
                "maximum": 65536
              }
            },
            "required": [
              "id",
              "widget",
              "lifetime",
              "visibility",
              "responseSchema"
            ],
            "additionalProperties": false
          },
          "minItems": 0,
          "maxItems": 128
        },
        "events": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "minLength": 1,
                "maxLength": 128,
                "pattern": "^[a-z][a-z0-9._-]{0,127}$"
              },
              "title": {
                "type": "string",
                "minLength": 1,
                "maxLength": 80
              },
              "delivery": {
                "const": "ephemeral"
              },
              "consumers": {
                "type": "array",
                "items": {
                  "enum": [
                    "host",
                    "plugins"
                  ]
                },
                "minItems": 1,
                "maxItems": 2,
                "uniqueItems": true
              },
              "payloadSchema": {
                "allOf": [
                  {
                    "$ref": "action-schema.schema.json"
                  },
                  {
                    "properties": {
                      "type": {
                        "const": "object"
                      }
                    }
                  }
                ]
              },
              "maxBytes": {
                "type": "integer",
                "minimum": 1024,
                "maximum": 65536
              },
              "titleKey": {
                "type": "string",
                "minLength": 1,
                "maxLength": 2000
              },
              "version": {
                "type": "integer",
                "minimum": 1
              }
            },
            "required": [
              "id",
              "title",
              "delivery",
              "consumers",
              "payloadSchema",
              "version"
            ],
            "additionalProperties": false
          },
          "minItems": 0,
          "maxItems": 128
        },
        "services": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "minLength": 1,
                "maxLength": 128,
                "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._-]{0,127}$"
              },
              "title": {
                "type": "string",
                "minLength": 1,
                "maxLength": 128
              },
              "version": {
                "type": "integer",
                "minimum": 1
              },
              "methods": {
                "type": "array",
                "items": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 128,
                  "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._-]{0,127}$"
                },
                "minItems": 1,
                "maxItems": 32,
                "uniqueItems": true
              },
              "maxBytes": {
                "type": "integer",
                "minimum": 1024,
                "maximum": 65536
              },
              "methodSchemas": {
                "type": "object",
                "maxProperties": 32,
                "additionalProperties": {
                  "type": "object",
                  "properties": {
                    "argsSchema": {
                      "allOf": [
                        {
                          "$ref": "action-schema.schema.json"
                        },
                        {
                          "properties": {
                            "type": {
                              "const": "object"
                            }
                          }
                        }
                      ]
                    },
                    "outputSchema": {
                      "$ref": "action-schema.schema.json"
                    }
                  },
                  "required": [
                    "argsSchema",
                    "outputSchema"
                  ],
                  "additionalProperties": false
                }
              },
              "titleKey": {
                "type": "string",
                "minLength": 1,
                "maxLength": 2000
              }
            },
            "required": [
              "id",
              "title",
              "version",
              "methods",
              "methodSchemas"
            ],
            "additionalProperties": false
          },
          "minItems": 0,
          "maxItems": 32
        },
        "categories": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "pattern": "^[a-z][a-z0-9-]{0,63}$"
              },
              "title": {
                "type": "string",
                "minLength": 1,
                "maxLength": 80
              },
              "icon": {
                "type": "string",
                "minLength": 1,
                "maxLength": 512,
                "anyOf": [
                  {
                    "pattern": "^(host:[A-Za-z][A-Za-z0-9._-]{0,63}/[A-Za-z][A-Za-z0-9._-]{0,63}|plugin:[a-zA-Z0-9][a-zA-Z0-9._-]{0,127}/[A-Za-z][A-Za-z0-9._-]{0,63}/[A-Za-z][A-Za-z0-9._-]{0,63})$"
                  },
                  {
                    "pattern": "^(?!/)(?!.*(?:^|/)\\.{1,2}(?:/|$))(?!.*\\.(?:/|$))(?!.*[\\\\:\\u0000-\\u0020\\u007f?#%])[^/]+(?:/[^/]+)*\\.[sS][vV][gG]$"
                  }
                ]
              },
              "group": {
                "type": "string",
                "enum": [
                  "system",
                  "display",
                  "audio",
                  "media",
                  "network",
                  "tools",
                  "other"
                ]
              },
              "titleKey": {
                "type": "string",
                "minLength": 1,
                "maxLength": 2000
              }
            },
            "required": [
              "id",
              "title"
            ],
            "additionalProperties": false
          },
          "minItems": 0,
          "maxItems": 64
        },
        "iconPacks": {
          "type": "array",
          "minItems": 1,
          "maxItems": 8,
          "items": {
            "type": "object",
            "required": [
              "id",
              "title",
              "paint",
              "index"
            ],
            "additionalProperties": false,
            "properties": {
              "id": {
                "type": "string",
                "pattern": "^[a-zA-Z][a-zA-Z0-9._-]{0,63}$"
              },
              "title": {
                "type": "string",
                "minLength": 1,
                "maxLength": 80
              },
              "titleKey": {
                "type": "string"
              },
              "description": {
                "type": "string",
                "maxLength": 240
              },
              "descriptionKey": {
                "type": "string"
              },
              "paint": {
                "enum": [
                  "monochrome",
                  "original"
                ]
              },
              "index": {
                "type": "string",
                "maxLength": 512
              },
              "license": {
                "type": "string",
                "maxLength": 160
              }
            }
          }
        }
      },
      "required": [],
      "additionalProperties": false,
      "not": {
        "anyOf": [
          {
            "required": [
              "actionCategories"
            ]
          },
          {
            "required": [
              "buttonPresetCategories"
            ]
          }
        ]
      }
    },
    "hostCapabilities": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "required": {
          "type": "object",
          "maxProperties": 64,
          "propertyNames": {
            "type": "string",
            "maxLength": 128,
            "pattern": "^[a-zA-Z][a-zA-Z0-9]*(\\.[a-zA-Z][a-zA-Z0-9]*)+$"
          },
          "additionalProperties": {
            "type": "integer",
            "minimum": 1,
            "maximum": 9007199254740991
          }
        },
        "optional": {
          "type": "object",
          "maxProperties": 64,
          "propertyNames": {
            "type": "string",
            "maxLength": 128,
            "pattern": "^[a-zA-Z][a-zA-Z0-9]*(\\.[a-zA-Z][a-zA-Z0-9]*)+$"
          },
          "additionalProperties": {
            "type": "integer",
            "minimum": 1,
            "maximum": 9007199254740991
          }
        }
      }
    },
    "i18n": {
      "type": "object",
      "required": [
        "defaultLocale"
      ],
      "additionalProperties": false,
      "properties": {
        "defaultLocale": {
          "type": "string",
          "minLength": 1,
          "maxLength": 100
        },
        "resources": {
          "type": "object",
          "minProperties": 1,
          "maxProperties": 100,
          "additionalProperties": {
            "type": "string",
            "minLength": 1,
            "maxLength": 512,
            "pattern": "\\.json$"
          }
        },
        "messages": {
          "type": "object",
          "minProperties": 1,
          "maxProperties": 100,
          "additionalProperties": {
            "type": "object",
            "maxProperties": 5000,
            "additionalProperties": {
              "type": "string",
              "maxLength": 4000
            }
          }
        }
      },
      "oneOf": [
        {
          "required": [
            "resources"
          ]
        },
        {
          "required": [
            "messages"
          ]
        }
      ]
    },
    "target": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "platform",
        "arch"
      ],
      "properties": {
        "platform": {
          "enum": [
            "windows",
            "macos",
            "linux",
            "harmonyos"
          ]
        },
        "arch": {
          "enum": [
            "x64",
            "arm64",
            "ia32",
            "arm"
          ]
        },
        "libc": {
          "enum": [
            "glibc",
            "musl"
          ]
        }
      }
    },
    "runtime": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "node": {
          "type": "string",
          "minLength": 1,
          "maxLength": 128
        },
        "electron": {
          "type": "string",
          "minLength": 1,
          "maxLength": 128
        },
        "modules": {
          "type": "string",
          "pattern": "^[1-9][0-9]{0,5}$"
        },
        "napi": {
          "type": "integer",
          "minimum": 1,
          "maximum": 100
        }
      }
    },
    "nativeModules": {
      "type": "array",
      "uniqueItems": true,
      "maxItems": 256,
      "items": {
        "type": "string",
        "maxLength": 512,
        "pattern": "\\.node$"
      }
    },
    "nameKey": {
      "type": "string",
      "minLength": 1,
      "maxLength": 2000
    },
    "descriptionKey": {
      "type": "string",
      "minLength": 1,
      "maxLength": 2000
    },
    "settingsSchema": {
      "type": "object",
      "properties": {
        "properties": {
          "type": "object",
          "maxProperties": 32,
          "propertyNames": {
            "pattern": "^[a-z][a-zA-Z0-9_]{0,63}$"
          },
          "additionalProperties": {
            "type": "object",
            "properties": {
              "type": {
                "enum": [
                  "string",
                  "integer",
                  "boolean"
                ]
              },
              "title": {
                "type": "string",
                "minLength": 1,
                "maxLength": 80
              },
              "description": {
                "type": "string",
                "maxLength": 240
              },
              "control": {
                "enum": [
                  "password",
                  "search-select"
                ]
              },
              "visibility": {
                "enum": [
                  "public",
                  "private"
                ]
              },
              "options": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "label": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 80
                    },
                    "value": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 4096
                    },
                    "labelKey": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 2000
                    }
                  },
                  "required": [
                    "label",
                    "value"
                  ],
                  "additionalProperties": false
                },
                "minItems": 1,
                "maxItems": 512
              },
              "default": {
                "type": [
                  "string",
                  "number",
                  "boolean"
                ]
              },
              "minimum": {
                "type": "integer"
              },
              "maximum": {
                "type": "integer"
              },
              "titleKey": {
                "type": "string",
                "minLength": 1,
                "maxLength": 2000
              },
              "descriptionKey": {
                "type": "string",
                "minLength": 1,
                "maxLength": 2000
              },
              "maxLength": {
                "type": "integer",
                "minimum": 1,
                "maximum": 4096
              }
            },
            "required": [
              "type",
              "title"
            ],
            "additionalProperties": false
          }
        }
      },
      "required": [
        "properties"
      ],
      "additionalProperties": false
    },
    "configPage": {
      "type": "string",
      "maxLength": 256,
      "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._/-]*/[a-zA-Z0-9][a-zA-Z0-9._-]*\\.html$"
    },
    "eventSubscriptions": {
      "type": "array",
      "maxItems": 128,
      "items": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "pluginId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          },
          "eventId": {
            "type": "string",
            "pattern": "^[a-z][a-z0-9._-]{0,127}$"
          },
          "version": {
            "type": "integer",
            "minimum": 1
          }
        },
        "required": [
          "pluginId",
          "eventId",
          "version"
        ]
      }
    },
    "configurationVersion": {
      "type": "integer",
      "minimum": 1,
      "maximum": 1000000,
      "default": 1
    },
    "configurationMigrations": {
      "type": "array",
      "maxItems": 128,
      "uniqueItems": true,
      "items": {
        "type": "integer",
        "minimum": 2,
        "maximum": 1000000
      }
    }
  },
  "required": [
    "apiVersion",
    "id",
    "name",
    "version",
    "permissions",
    "hostPlatforms",
    "contributes"
  ],
  "additionalProperties": false,
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "https://docs.flyon-deck.example/manifest-v1.schema.json",
  "title": "飞块 Plugin API v1 清单编辑辅助",
  "description": "共同可移植的结构提示，不替代实际宿主与商店关联、路径、权限和执行策略检查。域名仅为 schema 标识，不是在线服务。",
  "allOf": [
    {
      "if": {
        "not": {
          "required": [
            "main"
          ]
        }
      },
      "then": {
        "properties": {
          "permissions": {
            "maxItems": 0
          },
          "uses": {
            "maxItems": 0
          },
          "networkOrigins": {
            "maxItems": 0
          },
          "widgetConnectOrigins": {
            "maxItems": 0
          },
          "contributes": {
            "required": [
              "iconPacks"
            ],
            "propertyNames": {
              "enum": [
                "iconPacks"
              ]
            }
          },
          "dependencies": {
            "maxProperties": 0
          },
          "nativeModules": {
            "maxItems": 0
          }
        },
        "not": {
          "anyOf": [
            {
              "required": [
                "runtime"
              ]
            },
            {
              "required": [
                "target"
              ]
            }
          ]
        }
      }
    }
  ]
}
