mirror of
https://github.com/jxxghp/MoviePilot.git
synced 2026-11-25 13:22:03 +08:00
Merge pull request #6666 from Aqr-K/feat/plugin-instance-target-enablement
feat(plugin): 插件实例默认调用目标与启停,未指定实例时不再兜底取第一个
This commit is contained in:
@@ -756,8 +756,8 @@ flowchart LR
|
||||
|
||||
| 指标 | 当前值 |
|
||||
|---|---:|
|
||||
| Python 模块 | 1014 |
|
||||
| 内部导入边 | 8,614 |
|
||||
| Python 模块 | 1016 |
|
||||
| 内部导入边 | 8,630 |
|
||||
| 非平凡 SCC | 1(精确 containment 的 TMDB 移植包环) |
|
||||
| Application / Chain 具体 Adapter 直连 | 0 / 0 |
|
||||
| Direct egress | 53(债务已清零,53 条精确 containment) |
|
||||
|
||||
@@ -57,6 +57,30 @@ MCP 当前不会主动发送工具列表变更通知(`listChanged=false`)。
|
||||
服务回调、插件自己声明的 HTTP 端点。插件自建的原生线程不继承这个绑定,其中的日志仍按
|
||||
全局等级过滤,不要据此断定覆盖没有写进去。
|
||||
|
||||
### 插件实例默认调用目标
|
||||
|
||||
`plugin.default_target.set` 与 `plugin.default_target.clear` 使用源插件 ID 加实例 ID
|
||||
指定「只给插件 ID、没给实例 ID 的调用应当落到哪个实例」。同一源插件至多一个默认调用
|
||||
目标,置新会自动清掉旧的;清除只在当前置位的正是该实例时才动作,重复调用保持幂等。
|
||||
|
||||
一个插件有分身而未设置默认调用目标时,未指定实例的调用会直接报错,**不会**随机挑一个、
|
||||
也不会按登记顺序取第一个:那会让同一次调用在不同时刻落到不同实例,既无法复现,也无从
|
||||
知道刚才是哪个实例执行的。默认目标被停用时同样报错,不静默改走另一个正在运行的实例。
|
||||
只有本体、没有任何分身的插件不受这套机制约束,不需要显式设置默认目标。
|
||||
|
||||
### 插件实例启停
|
||||
|
||||
`plugin.instance.set_enabled` 用实例 ID 启用或停用一个实例,本体与分身共用这一个入口
|
||||
(实例 ID 等于插件 ID 时指的是本体自身)。
|
||||
|
||||
停用不是删除:业务参数与展示信息原样留在那一行等待再次启用,因而「停掉一个实例」与
|
||||
「丢掉它的配置」终于是两件事——此前两者绑死,想保住配置就只能留着一个在跑的实例。
|
||||
只有删掉整行才是彻底清理。停用会同时清掉该实例的默认调用目标置位与日志等级覆盖:
|
||||
前者会把未指定实例的调用路由到一个不会被实例化的实例,后者本就是带失效时间的临时
|
||||
调试设置。
|
||||
|
||||
是否启用与此刻是否在运行是两回事:前者是落盘的装载判据,后者由运行时持有、不落盘。
|
||||
|
||||
## 3.1 结构化 Agent 工具与完整参数合同
|
||||
|
||||
`tools/list` 会为以下四个正式入口返回可直接校验的 JSON Schema。每个入口都按 operation/action 生成 `oneOf` 分支,分支中包含必填字段、类型、默认值、枚举、嵌套对象和互斥/至少一项等跨字段规则;外部 MCP 客户端可以在一次 `tools/call` 中完成参数构造,不需要猜测 URL、HTTP 方法或第三方 SDK 参数。
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
"disposition_counts": {
|
||||
"alternate-auth-duplicate": 11,
|
||||
"consolidated": 71,
|
||||
"gateway": 221,
|
||||
"gateway": 224,
|
||||
"provider-skill": 12,
|
||||
"stream_or_binary": 10,
|
||||
"transport_or_identity": 66,
|
||||
@@ -18,10 +18,10 @@
|
||||
"reason": "The executor validates and expands this bounded source placeholder to one of tmdb, douban, bangumi, or anilist before calling the corresponding concrete OpenAPI route."
|
||||
}
|
||||
],
|
||||
"gateway_http_route_count": 222,
|
||||
"gateway_operation_count": 224,
|
||||
"matched_gateway_http_route_count": 221,
|
||||
"openapi_operation_count": 404,
|
||||
"gateway_http_route_count": 225,
|
||||
"gateway_operation_count": 227,
|
||||
"matched_gateway_http_route_count": 224,
|
||||
"openapi_operation_count": 407,
|
||||
"operations": [
|
||||
{
|
||||
"disposition": "consolidated",
|
||||
@@ -2255,6 +2255,48 @@
|
||||
"plugin"
|
||||
]
|
||||
},
|
||||
{
|
||||
"disposition": "gateway",
|
||||
"method": "POST",
|
||||
"operation_ids": [
|
||||
"plugin.instance.set_enabled"
|
||||
],
|
||||
"owner": "moviepilot-api",
|
||||
"path": "/api/v1/plugin/instance/{instance_id}/enabled",
|
||||
"reason": "Executable through moviepilot_api; exact inputs are generated into MCP tools/list and SKILL.md.",
|
||||
"summary": "启用或停用插件实例",
|
||||
"tags": [
|
||||
"plugin"
|
||||
]
|
||||
},
|
||||
{
|
||||
"disposition": "gateway",
|
||||
"method": "DELETE",
|
||||
"operation_ids": [
|
||||
"plugin.default_target.clear"
|
||||
],
|
||||
"owner": "moviepilot-api",
|
||||
"path": "/api/v1/plugin/instances/{plugin_id}/{instance_id}/default_target",
|
||||
"reason": "Executable through moviepilot_api; exact inputs are generated into MCP tools/list and SKILL.md.",
|
||||
"summary": "清除插件实例的默认调用目标",
|
||||
"tags": [
|
||||
"plugin"
|
||||
]
|
||||
},
|
||||
{
|
||||
"disposition": "gateway",
|
||||
"method": "PUT",
|
||||
"operation_ids": [
|
||||
"plugin.default_target.set"
|
||||
],
|
||||
"owner": "moviepilot-api",
|
||||
"path": "/api/v1/plugin/instances/{plugin_id}/{instance_id}/default_target",
|
||||
"reason": "Executable through moviepilot_api; exact inputs are generated into MCP tools/list and SKILL.md.",
|
||||
"summary": "设置插件实例的默认调用目标",
|
||||
"tags": [
|
||||
"plugin"
|
||||
]
|
||||
},
|
||||
{
|
||||
"disposition": "gateway",
|
||||
"method": "GET",
|
||||
|
||||
@@ -5,10 +5,10 @@
|
||||
|
||||
## Result
|
||||
|
||||
- OpenAPI HTTP operations: **404**
|
||||
- Stable `moviepilot_api` operations: **224**
|
||||
- Exact HTTP routes used by the gateway: **222**
|
||||
- OpenAPI routes matched directly by the gateway: **221**
|
||||
- OpenAPI HTTP operations: **407**
|
||||
- Stable `moviepilot_api` operations: **227**
|
||||
- Exact HTTP routes used by the gateway: **225**
|
||||
- OpenAPI routes matched directly by the gateway: **224**
|
||||
- Bounded dynamic gateway routes: **1**
|
||||
- Every gateway operation has a generated English oneOf input contract in MCP `tools/list` and `skills/moviepilot-api/SKILL.md`.
|
||||
- Every non-gateway OpenAPI operation is listed below with an explicit ownership boundary; it is not silently callable through arbitrary URL/method input.
|
||||
@@ -19,7 +19,7 @@
|
||||
| :--- | ---: | :--- |
|
||||
| `alternate-auth-duplicate` | 11 | API-token compatibility duplicate of a bearer-authenticated capability. |
|
||||
| `consolidated` | 71 | Source/UI route represented by a stable aggregate Agent operation. |
|
||||
| `gateway` | 221 | Approved structured MoviePilot Agent operation. |
|
||||
| `gateway` | 224 | Approved structured MoviePilot Agent operation. |
|
||||
| `provider-skill` | 12 | Low-level downloader or media-server capability owned by a provider Skill. |
|
||||
| `stream_or_binary` | 10 | Streaming or binary response owned by a direct client transport. |
|
||||
| `transport_or_identity` | 66 | Authentication, protocol, callback, account, or conversation transport boundary. |
|
||||
@@ -209,6 +209,9 @@
|
||||
| `GET` | `/api/v1/plugin/history/{plugin_id}` | plugin | `gateway` | plugin.history | 获取插件更新说明 |
|
||||
| `GET` | `/api/v1/plugin/install/{plugin_id}` | plugin | `gateway` | plugin.install | 安装插件 |
|
||||
| `GET` | `/api/v1/plugin/installed` | plugin | `consolidated` | plugin.installed | 已安装插件 |
|
||||
| `POST` | `/api/v1/plugin/instance/{instance_id}/enabled` | plugin | `gateway` | plugin.instance.set_enabled | 启用或停用插件实例 |
|
||||
| `DELETE` | `/api/v1/plugin/instances/{plugin_id}/{instance_id}/default_target` | plugin | `gateway` | plugin.default_target.clear | 清除插件实例的默认调用目标 |
|
||||
| `PUT` | `/api/v1/plugin/instances/{plugin_id}/{instance_id}/default_target` | plugin | `gateway` | plugin.default_target.set | 设置插件实例的默认调用目标 |
|
||||
| `GET` | `/api/v1/plugin/loglevel/{plugin_id}` | plugin | `gateway` | plugin.loglevel.get | 查询插件全部实例的日志等级设置 |
|
||||
| `DELETE` | `/api/v1/plugin/loglevel/{plugin_id}/{instance_id}` | plugin | `gateway` | plugin.loglevel.clear | 清除插件实例的日志等级覆盖 |
|
||||
| `PUT` | `/api/v1/plugin/loglevel/{plugin_id}/{instance_id}` | plugin | `gateway` | plugin.loglevel.set | 设置插件实例的日志等级覆盖 |
|
||||
|
||||
@@ -94,7 +94,7 @@ ARCH-201 至 ARCH-204 均达到实现、验证、提交、推送和远端门禁
|
||||
|
||||
| 指标 | 当前值 | 解释 |
|
||||
|---|---:|---|
|
||||
| 宿主 Python 模块 / 内部依赖边 | 1014 / 8,614 | `dependency-baseline.json` 当前快照;分类、下载资源归类、订阅搜索、整理恢复、Agent 计划、工具视觉、终端生命周期与终端作用域模块的受控依赖 |
|
||||
| 宿主 Python 模块 / 内部依赖边 | 1016 / 8,630 | `dependency-baseline.json` 当前快照;分类、下载资源归类、订阅搜索、整理恢复、Agent 计划、工具视觉、终端生命周期与终端作用域模块的受控依赖 |
|
||||
| 非平凡 SCC | 1 | 仅保留精确 containment 的 29 模块 TMDB 移植包环 |
|
||||
| 跨层 DB 边界债务 | 0 | Application、Chain、API、Agent、Runtime、Workflow 到 DB 的受控债务均为零 |
|
||||
| Model/Oper 事务债务 | 0 | 自建 Session、自动事务装饰器、直接 commit/rollback 等基线均为零 |
|
||||
|
||||
@@ -453,4 +453,4 @@ can be accepted only once without Application knowing the configured backend.
|
||||
- `settings.API_TOKEN` and other secret fields must not be included in log output or API responses.
|
||||
- The `config list --show-secrets` flag exists specifically to gate secret visibility in the CLI.
|
||||
|
||||
*Last Updated: 2026-09-12*
|
||||
*Last Updated: 2026-09-13*
|
||||
|
||||
Reference in New Issue
Block a user