Files
browser/plugins/manifests/game-plugin.manifest.schema.json
T
2026-07-11 14:56:10 +08:00

146 lines
4.4 KiB
JSON

{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://browser.local/schemas/game-plugin.manifest.schema.json",
"title": "GamePluginManifest",
"type": "object",
"required": ["id", "name", "version", "kind", "server", "capabilities", "permissions"],
"additionalProperties": false,
"properties": {
"$schema": { "type": "string" },
"id": { "type": "string", "pattern": "^game\\.[a-z0-9][a-z0-9._-]*$" },
"name": { "type": "string", "minLength": 1, "maxLength": 80 },
"description": { "type": "string", "minLength": 1, "maxLength": 240 },
"version": { "type": "string", "minLength": 1, "maxLength": 40 },
"kind": { "const": "game-plugin" },
"tags": {
"type": "array",
"items": { "type": "string", "pattern": "^[a-z0-9][a-z0-9._-]*$" },
"uniqueItems": true,
"maxItems": 8
},
"server": {
"type": "object",
"required": ["type", "displayName", "createFormSchema"],
"additionalProperties": false,
"properties": {
"type": { "type": "string", "pattern": "^[a-z0-9][a-z0-9._-]*$", "maxLength": 80 },
"displayName": { "type": "string", "minLength": 1, "maxLength": 80 },
"supportedOS": { "type": "array", "items": { "enum": ["windows", "linux", "darwin"] } },
"createFormSchema": { "$ref": "#/$defs/relativeJsonRef" }
}
},
"bridge": {
"type": "object",
"required": ["actions"],
"additionalProperties": false,
"properties": {
"actions": {
"type": "array",
"items": { "$ref": "#/$defs/bridgeAction" },
"uniqueItems": true,
"minItems": 1
}
}
},
"capabilities": {
"type": "array",
"items": { "$ref": "#/$defs/runCapability" },
"uniqueItems": true
},
"permissions": {
"type": "array",
"items": { "$ref": "#/$defs/pluginPermission" },
"uniqueItems": true
},
"actions": {
"type": "object",
"required": ["install", "start", "stop"],
"additionalProperties": false,
"properties": {
"install": { "$ref": "#/$defs/relativeJsonRef" },
"start": { "$ref": "#/$defs/relativeJsonRef" },
"stop": { "$ref": "#/$defs/relativeJsonRef" },
"restart": { "$ref": "#/$defs/relativeJsonRef" },
"status": { "$ref": "#/$defs/relativeJsonRef" }
}
},
"pages": {
"type": "array",
"items": {
"type": "object",
"required": ["key", "title", "path"],
"additionalProperties": false,
"properties": {
"key": { "type": "string", "pattern": "^[a-z0-9][a-z0-9-]*$" },
"title": { "type": "string", "minLength": 1, "maxLength": 40 },
"path": { "type": "string", "pattern": "^/[a-z0-9_./-]*$" },
"permissions": { "type": "array", "items": { "$ref": "#/$defs/pluginPermission" }, "uniqueItems": true },
"bridgeActions": { "type": "array", "items": { "$ref": "#/$defs/bridgeAction" }, "uniqueItems": true }
}
}
},
"ai": {
"type": "object",
"additionalProperties": false,
"properties": {
"purposes": { "type": "array", "items": { "$ref": "#/$defs/aiPurpose" }, "uniqueItems": true }
}
}
},
"$defs": {
"relativeJsonRef": {
"type": "string",
"pattern": "^(?!/)(?![A-Za-z]:)(?!.*://)(?!.*\\.\\.)[a-zA-Z0-9_./-]+\\.json$"
},
"runCapability": {
"enum": [
"process.install",
"process.start",
"process.stop",
"process.restart",
"process.status",
"files.list",
"files.read",
"files.write",
"files.patch",
"logs.read",
"artifacts.read",
"artifacts.write",
"ai.invoke"
]
},
"pluginPermission": {
"enum": [
"server.create",
"server.read",
"server.lifecycle",
"server.files.read",
"server.files.write",
"server.logs.read",
"server.artifacts.read",
"server.artifacts.write",
"ai.invoke"
]
},
"bridgeAction": {
"enum": [
"server.instances.read",
"jobs.dispatch",
"logs.query",
"artifacts.open",
"files.request",
"ai.invoke"
]
},
"aiPurpose": {
"enum": [
"config.read",
"config.generate",
"config.suggest",
"logs.diagnose",
"files.suggest"
]
}
}
}