{
    "$schema": "http://json-schema.org/draft-07/schema#",
    "$id": "https://focusany.com/sdk/config.schema.json",
    "title": "FocusAny 插件配置文件",
    "description": "FocusAny 插件配置文件，用于描述插件的基本信息，以及插件的入口文件。",
    "type": "object",
    "properties": {
        "name": {
            "type": "string",
            "description": "插件名称，此为必选项，且插件应用内不可重复。"
        },
        "version": {
            "type": "string",
            "description": "插件版本，此为必选项。"
        },
        "platform": {
            "type": "array",
            "description": "支持的平台，此为选填，留空表示支持所有平台。",
            "items": {
                "type": "string",
                "enum": [
                    "win",
                    "osx",
                    "linux"
                ]
            }
        },
        "versionRequire": {
            "type": "string",
            "description": "FocusAny 版本要求，如 * 或 >=1.0.0 或 <=1.0.0 或 >1.0.0 或 <1.0.0，此为选填，留空表示不限制 FocusAny 版本。"
        },
        "editionRequire": {
            "type": "array",
            "description": "FocusAny 类型要求，此为选填，留空表示不限制 FocusAny 类型（open社区版、pro专业版）。",
            "items": {
                "type": "string",
                "enum": [
                    "open",
                    "pro"
                ]
            }
        },
        "title": {
            "type": "string",
            "description": "插件标题，此为必选项。"
        },
        "logo": {
            "type": "string",
            "description": "插件图标，支持png,jpg,svg格式"
        },
        "description": {
            "type": "string",
            "description": "插件描述"
        },
        "main": {
            "type": "string",
            "description": "主入口文件"
        },
        "mainView": {
            "type": "string",
            "description": "快捷面板/智能视图 入口文件，当该配置为空时，使用主入口文件"
        },
        "preload": {
            "type": "string",
            "description": "插件预加载文件，相对于插件目录，需要是 cjs 文件"
        },
        "author": {
            "type": "string",
            "description": "插件作者"
        },
        "homepage": {
            "type": "string",
            "description": "插件主页"
        },
        "actions": {
            "type": "array",
            "description": "插件动作，描述了当 FocusAny 主输入框内容产生变化时，此插件应用是否显示在搜索结果列表中，一个插件应用可以有多个功能，一个功能可以提供多个命令供用户搜索。",
            "items": {
                "type": "object",
                "properties": {
                    "name": {
                        "type": "string",
                        "description": "插件应用提供的某个功能的唯一标示，此为必选项，且插件应用内不可重复。"
                    },
                    "title": {
                        "type": "string",
                        "description": "对此功能的说明，将在搜索列表对应位置中显示。"
                    },
                    "icon": {
                        "type": "string",
                        "description": "此功能的图标，支持png,jpg,svg格式。"
                    },
                    "trackHistory": {
                        "type": "boolean",
                        "description": "是否启用历史记录，默认为 true。启用后，FocusAny 会记录用户对该功能的使用历史，并在搜索结果中显示。"
                    },
                    "type": {
                        "type": "string",
                        "description": "此功能的类型",
                        "enum": [
                            "command",
                            "web",
                            "code",
                            "backend",
                            "view"
                        ]
                    },
                    "platform": {
                        "type": "array",
                        "description": "支持的平台，此为选填，留空表示支持所有平台。",
                        "items": {
                            "type": "string",
                            "enum": [
                                "win",
                                "osx",
                                "linux"
                            ]
                        }
                    },
                    "data": {
                        "type": "object",
                        "description": "其他补充数据。",
                        "properties": {
                            "command": {
                                "type": "string",
                                "description": "type=command时，此为必选项，表示此功能的命令。"
                            },
                            "showFastPanel": {
                                "type": "boolean",
                                "description": "type=view时，是否在快捷面板中显示，默认为 false"
                            },
                            "showMainPanel": {
                                "type": "boolean",
                                "description": "type=view时，是否在主面板中显示，默认为 true"
                            }
                        }
                    },
                    "matches": {
                        "type": "array",
                        "description": "该功能下可响应的命令集，支持 6 种类型，由 matches 的类型或 matches.type 决定。",
                        "items": {
                            "oneOf": [
                                {
                                    "type": "string",
                                    "description": "简单字符串匹配"
                                },
                                {
                                    "type": "object",
                                    "required": [
                                        "type"
                                    ],
                                    "properties": {
                                        "type": {
                                            "type": "string",
                                            "description": "类型",
                                            "enum": [
                                                "text",
                                                "key",
                                                "regex",
                                                "file",
                                                "image",
                                                "window",
                                                "editor"
                                            ]
                                        },
                                        "name": {
                                            "type": "string",
                                            "description": "匹配名称"
                                        },
                                        "regex": {
                                            "type": "string",
                                            "description": "匹配正则表达式"
                                        },
                                        "title": {
                                            "type": "string",
                                            "description": "匹配标题"
                                        },
                                        "text": {
                                            "type": "string",
                                            "description": "匹配文本"
                                        },
                                        "minLength": {
                                            "type": "number",
                                            "description": "最小匹配长度",
                                            "minimum": 1
                                        },
                                        "maxLength": {
                                            "type": "number",
                                            "description": "最大匹配长度",
                                            "minimum": 1,
                                            "maximum": 10000
                                        },
                                        "key": {
                                            "type": "string",
                                            "description": "匹配键值"
                                        },
                                        "minCount": {
                                            "type": "number",
                                            "description": "最小匹配数量",
                                            "minimum": 1
                                        },
                                        "maxCount": {
                                            "type": "number",
                                            "description": "最大匹配数量",
                                            "minimum": 1,
                                            "maximum": 10000
                                        },
                                        "filterFileType": {
                                            "type": "string",
                                            "description": "文件类型",
                                            "enum": [
                                                "file",
                                                "directory"
                                            ]
                                        },
                                        "filterExtensions": {
                                            "type": "array",
                                            "description": "文件扩展名",
                                            "items": {
                                                "type": "string"
                                            }
                                        },
                                        "nameRegex": {
                                            "type": "string",
                                            "description": "匹配名称正则"
                                        },
                                        "titleRegex": {
                                            "type": "string",
                                            "description": "匹配标题正则"
                                        },
                                        "attrRegex": {
                                            "type": "object",
                                            "description": "匹配属性正则",
                                            "properties": {
                                                "name": {
                                                    "type": "string",
                                                    "description": "属性名称"
                                                },
                                                "value": {
                                                    "type": "string",
                                                    "description": "属性值正则表达式"
                                                }
                                            }
                                        },
                                        "extensions": {
                                            "type": "array",
                                            "description": "文件扩展名",
                                            "items": {
                                                "type": "string"
                                            }
                                        },
                                        "fadTypes": {
                                            "type": "array",
                                            "description": "FocusAny 数据类型",
                                            "items": {
                                                "type": "string"
                                            }
                                        }
                                    },
                                    "additionalProperties": false
                                }
                            ]
                        }
                    }
                }
            }
        },
        "mcp": {
            "type": "object",
            "description": "MCP 配置，描述了插件应用在 MCP 中的相关信息。",
            "properties": {
                "tools": {
                    "type": "array",
                    "description": "插件应用提供的工具列表，一个插件应用可以提供多个工具。",
                    "items": {
                        "type": "object",
                        "properties": {
                            "name": {
                                "type": "string",
                                "description": "工具名称，此为必选项，且插件应用内不可重复。建议使用小写+点号分隔，例如 'list.plugins'。"
                            },
                            "description": {
                                "type": "string",
                                "description": "工具描述，简要说明工具的用途。"
                            },
                            "inputSchema": {
                                "type": "object",
                                "description": "工具输入参数的 JSON Schema。必须符合 JSON Schema Draft 7 标准。",
                                "properties": {
                                    "type": {
                                        "type": "string",
                                        "enum": [
                                            "object"
                                        ],
                                        "description": "输入参数必须是对象类型。"
                                    },
                                    "properties": {
                                        "type": "object",
                                        "description": "对象的属性定义。每个属性名对应一个参数。",
                                        "additionalProperties": {
                                            "type": "object",
                                            "description": "参数的 JSON Schema 定义。例如 {\"type\":\"string\",\"description\":\"...\"}",
                                            "properties": {
                                                "type": {
                                                    "type": "string",
                                                    "description": "参数类型，例如 string、number、boolean、array、object 等。",
                                                    "enum": [
                                                        "string",
                                                        "number",
                                                        "object",
                                                        "array",
                                                        "boolean"
                                                    ]
                                                },
                                                "description": {
                                                    "type": "string",
                                                    "description": "参数描述，简要说明参数的用途。"
                                                },
                                                "examples": {
                                                    "type": "array",
                                                    "description": "参数示例值。",
                                                    "items": {
                                                        "type": [
                                                            "string",
                                                            "number",
                                                            "object",
                                                            "array",
                                                            "boolean"
                                                        ]
                                                    }
                                                }
                                            }
                                        }
                                    },
                                    "required": {
                                        "type": "array",
                                        "description": "必填参数列表。",
                                        "items": {
                                            "type": "string"
                                        }
                                    }
                                },
                                "required": [
                                    "type",
                                    "properties"
                                ]
                            }
                        },
                        "required": [
                            "name",
                            "description",
                            "inputSchema"
                        ]
                    }
                }
            },
            "required": [
                "tools"
            ]
        },
        "development": {
            "type": "object",
            "properties": {
                "env": {
                    "type": "string",
                    "description": "开发环境，prod 表示生产环境，dev 表示开发环境，prod 环境会忽略 development 的所有配置。",
                    "enum": [
                        "prod",
                        "dev"
                    ]
                },
                "main": {
                    "type": "string",
                    "description": "dev环境 入口文件，通常为开发环境如 http://localhost:8080"
                },
                "mainView": {
                    "type": "string",
                    "description": "dev环境 快捷面板/智能视图快速面板入口文件，通常为开发环境如 http://localhost:8080"
                },
                "showDevTools": {
                    "type": "boolean",
                    "description": "dev环境 是否在插件加载完成后显示开发者窗口"
                },
                "showCodeDevTools": {
                    "type": "boolean",
                    "description": "dev环境 是否在code执行完成后显示开发者窗口"
                },
                "keepCodeDevTools": {
                    "type": "boolean",
                    "description": "dev环境 插件是否在code执行完成后保留开发者窗口"
                },
                "showViewDevTools": {
                    "type": "boolean",
                    "description": "dev环境 是否在快捷面板/智能视图渲染view时显示开发者窗口"
                },
                "releaseDoc": {
                    "type": "string",
                    "description": "更新日志文档，参照插件选择根目录，默认为 release.md，使用 markdown 格式，格式为【## x.x.x 功能特性[换行][换行]更新内容详情】使用 --- 分割多个。"
                },
                "contentDoc": {
                    "type": "string",
                    "description": "插件内容文档，参照插件选择根目录，默认为 content.md，使用 markdown 格式。"
                },
                "previewDoc": {
                    "type": "string",
                    "description": "插件预览文档，参照插件选择根目录，默认为 preview.md，使用 markdown 格式，每行一个图片链接。"
                }
            }
        },
        "permissions": {
            "type": "array",
            "description": "插件权限",
            "items": {
                "type": "string",
                "enum": [
                    "ClipboardManage",
                    "Api",
                    "File"
                ]
            }
        },
        "setting": {
            "type": "object",
            "properties": {
                "autoDetach": {
                    "type": "boolean",
                    "description": "是否默认分离模式打开，默认为 false"
                },
                "detachPosition": {
                    "type": "string",
                    "description": "分离模式默认位置，默认为 center",
                    "enum": [
                        "center",
                        "left-top",
                        "right-top",
                        "left-bottom",
                        "right-bottom"
                    ]
                },
                "detachAlwaysOnTop": {
                    "type": "boolean",
                    "description": "分离模式默认是否置顶，默认为 false"
                },
                "height": {
                    "type": "string",
                    "description": "窗口高度，支持 数字 或 百分比，设置后窗口大小将默认为分离模式，默认为 600"
                },
                "width": {
                    "type": "string",
                    "description": "窗口宽度，支持 数字 或 百分比，设置后窗口大小将默认为分离模式，默认为 800"
                },
                "heightView": {
                    "type": "integer",
                    "description": "快速面板高度，单位为像素，默认为 100"
                },
                "singleton": {
                    "type": "boolean",
                    "description": "是否只允许打开一个窗口，默认为 true"
                },
                "zoom": {
                    "type": "number",
                    "description": "窗口缩放比例，100表示原始大小，默认为 100"
                },
                "darkModeSupport": {
                    "type": "boolean",
                    "description": "是否支持暗黑模式，默认为 false"
                },
                "httpEntry": {
                    "type": "boolean",
                    "description": "是否使用 http 协议入口，默认为 false"
                },
                "remoteWebCacheEnable": {
                    "type": "boolean",
                    "description": "是否启用远程Web缓存，默认为 false"
                },
                "moreMenu": {
                    "type": "array",
                    "description": "分离模式更多菜单，默认为空",
                    "items": {
                        "type": "object",
                        "properties": {
                            "name": {
                                "type": "string",
                                "description": "菜单标识"
                            },
                            "title": {
                                "type": "string",
                                "description": "菜单标题"
                            }
                        },
                        "required": [
                            "name",
                            "title"
                        ]
                    }
                },
                "preloadBase": {
                    "type": "string",
                    "description": "基础预加载文件，普通插件应用不需要设置"
                },
                "nodeIntegration": {
                    "type": "boolean",
                    "description": "是否启用 nodejs，普通应用不需要设置"
                }
            }
        }
    }
}
