feat: 将插件 stdin 协议定为 v1,并按声明注入凭据
进程外插件改为只读环境变量和自身配置,避免读宿主 appsettings;宿主按 plugin.json 声明注入 LLM / OpenWeather 等凭据。
This commit is contained in:
@@ -0,0 +1,47 @@
|
||||
{
|
||||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||
"$id": "https://maf1.local/plugin-protocol-v1.schema.json",
|
||||
"title": "MAF1 plugin protocol v1",
|
||||
"description": "宿主写入插件 stdin 的 PluginRequest。stdout 必须是与 plugin.json outputs 字段对应的单个 JSON 对象。",
|
||||
"type": "object",
|
||||
"required": ["protocolVersion", "inputs"],
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"protocolVersion": {
|
||||
"type": "integer",
|
||||
"const": 1
|
||||
},
|
||||
"inputs": {
|
||||
"type": "object",
|
||||
"description": "键名与 plugin.json inputs[].name 一致。",
|
||||
"additionalProperties": true
|
||||
},
|
||||
"credentials": {
|
||||
"type": "object",
|
||||
"description": "键名与 plugin.json credentials[].name 一致。未声明的凭据不会出现。",
|
||||
"additionalProperties": {
|
||||
"$ref": "#/$defs/credentialPayload"
|
||||
}
|
||||
}
|
||||
},
|
||||
"$defs": {
|
||||
"credentialPayload": {
|
||||
"type": "object",
|
||||
"required": ["id", "type"],
|
||||
"properties": {
|
||||
"id": { "type": "string" },
|
||||
"type": {
|
||||
"type": "string",
|
||||
"description": "openai-compatible | llm | openweather | 其它自定义类型"
|
||||
},
|
||||
"endpoint": { "type": ["string", "null"] },
|
||||
"apiKey": { "type": ["string", "null"] },
|
||||
"model": { "type": ["string", "null"] },
|
||||
"extra": {
|
||||
"type": "object",
|
||||
"additionalProperties": { "type": "string" }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user