feat: 完整游戏运维功能

This commit is contained in:
npc0-hue
2026-07-18 09:04:01 +08:00
parent f3b14b7945
commit 48b8ad8d6c
187 changed files with 16607 additions and 1140 deletions
@@ -182,6 +182,11 @@
"remote.run.db.sqlite.query",
"remote.run.logs.transfer",
"remote.run.rcon.command",
"client-manager.deploy",
"client-manager.control",
"client-manager.update",
"client-manager.rollback",
"client-manager.uninstall",
"artifacts.read",
"artifacts.write",
"ai.invoke"
@@ -307,7 +312,30 @@
"version": { "type": "string", "maxLength": 80 },
"downloadRef": { "type": "string", "pattern": "^https://[a-zA-Z0-9._~:/?#\\[\\]@!$&'()*+,;=%-]+$", "maxLength": 240 },
"checksum": { "type": "string", "pattern": "^sha256:[a-fA-F0-9]{64}$" }
}
},
"allOf": [
{
"if": { "properties": { "type": { "const": "package" } }, "required": ["type"] },
"then": {
"required": ["packageManager", "packageName"],
"properties": { "packageManager": { "enum": ["winget", "choco", "scoop", "apt", "yum", "dnf", "pacman", "zypper", "brew"] } }
}
},
{
"if": { "properties": { "type": { "const": "verified-download" } }, "required": ["type"] },
"then": { "required": ["downloadRef", "checksum"] }
},
{
"if": { "properties": { "type": { "const": "steamcmd-app" } }, "required": ["type"] },
"then": {
"required": ["packageName"],
"properties": {
"packageManager": { "const": "steamcmd" },
"packageName": { "type": "string", "pattern": "^[0-9]{1,12}$" }
}
}
}
]
},
"runtimeInstallPlan": {
"type": "object",
@@ -317,7 +345,7 @@
"key": { "$ref": "#/$defs/logicalKey" },
"title": { "type": "string", "minLength": 1, "maxLength": 80 },
"platforms": { "type": "array", "items": { "$ref": "#/$defs/runtimePlatform" }, "uniqueItems": true },
"steps": { "type": "array", "items": { "$ref": "#/$defs/runtimeInstallStep" }, "minItems": 1 }
"steps": { "type": "array", "items": { "$ref": "#/$defs/runtimeInstallStep" }, "minItems": 1, "maxItems": 64 }
}
},
"runtimeLogSource": {
@@ -349,6 +377,24 @@
"pattern": "^(?!/)(?![A-Za-z]:)(?!.*://)(?!.*\\.\\.)[a-zA-Z0-9_./-]+$",
"maxLength": 160
},
"clientManagerComponentCapability": {
"enum": [
"component.register",
"component.heartbeat",
"component.health",
"component.control",
"game-client.bridge",
"logs.stream"
]
},
"clientManagerLifecycleAction": {
"enum": ["start", "stop", "restart", "status", "update", "rollback", "uninstall"]
},
"clientManagerArgument": {
"type": "string",
"pattern": "^[a-zA-Z0-9_./:=@+-]+$",
"maxLength": 120
},
"runtimeClientManagerProfile": {
"type": "object",
"required": ["key", "repository", "supportedTargets", "build", "outputArtifacts"],
@@ -356,6 +402,7 @@
"properties": {
"key": { "$ref": "#/$defs/logicalKey" },
"displayName": { "type": "string", "minLength": 1, "maxLength": 80 },
"version": { "type": "string", "pattern": "^[0-9]+\\.[0-9]+\\.[0-9]+(?:-[0-9A-Za-z.-]+)?$", "maxLength": 40 },
"repository": {
"type": "object",
"required": ["url", "revisionPolicy"],
@@ -393,8 +440,74 @@
},
"uniqueItems": true
},
"outputArtifacts": { "type": "array", "items": { "$ref": "#/$defs/relativePathRef" }, "minItems": 1, "uniqueItems": true }
}
"outputArtifacts": { "type": "array", "items": { "$ref": "#/$defs/relativePathRef" }, "minItems": 1, "uniqueItems": true },
"deployment": {
"type": "object",
"required": ["mode", "executableRef", "requiredRunCapabilities"],
"additionalProperties": false,
"properties": {
"mode": { "const": "run-supervised" },
"executableRef": { "$ref": "#/$defs/relativePathRef" },
"arguments": { "type": "array", "items": { "$ref": "#/$defs/clientManagerArgument" }, "maxItems": 32 },
"autoStart": { "type": "boolean" },
"requiredRunCapabilities": {
"type": "array",
"items": { "enum": ["client-manager.deploy", "client-manager.control", "client-manager.update", "client-manager.rollback", "client-manager.uninstall"] },
"uniqueItems": true,
"minItems": 1
}
}
},
"lifecycle": {
"type": "object",
"required": ["actions", "startupTimeoutSeconds", "stopTimeoutSeconds"],
"additionalProperties": false,
"properties": {
"actions": { "type": "array", "items": { "$ref": "#/$defs/clientManagerLifecycleAction" }, "uniqueItems": true, "minItems": 1 },
"startupTimeoutSeconds": { "type": "integer", "minimum": 1, "maximum": 300 },
"stopTimeoutSeconds": { "type": "integer", "minimum": 1, "maximum": 120 }
}
},
"health": {
"type": "object",
"required": ["mode", "intervalSeconds", "degradedAfterSeconds", "offlineAfterSeconds", "requiredCapabilities"],
"additionalProperties": false,
"properties": {
"mode": { "enum": ["component-heartbeat", "process"] },
"intervalSeconds": { "type": "integer", "minimum": 5, "maximum": 300 },
"degradedAfterSeconds": { "type": "integer", "minimum": 10, "maximum": 1800 },
"offlineAfterSeconds": { "type": "integer", "minimum": 15, "maximum": 3600 },
"requiredCapabilities": { "type": "array", "items": { "$ref": "#/$defs/clientManagerComponentCapability" }, "uniqueItems": true, "minItems": 1 }
}
},
"compatibility": {
"type": "object",
"required": ["allowDowngrade"],
"additionalProperties": false,
"properties": {
"minimumVersion": { "type": "string", "pattern": "^[0-9]+\\.[0-9]+\\.[0-9]+(?:-[0-9A-Za-z.-]+)?$", "maxLength": 40 },
"maximumVersion": { "type": "string", "pattern": "^[0-9]+\\.[0-9]+\\.[0-9]+(?:-[0-9A-Za-z.-]+)?$", "maxLength": 40 },
"allowDowngrade": { "type": "boolean" }
}
},
"updatePolicy": {
"type": "object",
"required": ["strategy", "requireApproval", "healthConfirmationSeconds", "retainPrevious"],
"additionalProperties": false,
"properties": {
"strategy": { "const": "manual-staged" },
"requireApproval": { "const": true },
"healthConfirmationSeconds": { "type": "integer", "minimum": 5, "maximum": 600 },
"retainPrevious": { "const": true }
}
}
},
"allOf": [
{
"if": { "required": ["deployment"] },
"then": { "required": ["version", "lifecycle", "health", "compatibility", "updatePolicy"] }
}
]
},
"aiPurpose": {
"enum": [