Move SCUM lifecycle ownership to plugin

This commit is contained in:
npc0-hue
2026-08-01 09:36:12 +08:00
parent bca4f935ba
commit d1249fca85
49 changed files with 795 additions and 566 deletions
+9 -1
View File
@@ -77,20 +77,28 @@ func TestGamePluginManifestRegistrationToDomainCopiesSlices(t *testing.T) {
CreateFormSchema: "schemas/create-form.schema.json",
},
Actions: PluginLifecycleActionsBody{Install: "actions/install.json", Start: "actions/start.json", Stop: "actions/stop.json"},
AssetFiles: []PluginAssetFileBody{
{Path: "actions/install.json", Mode: 0o600},
},
Pages: []GamePluginPageBody{
{Key: "logs", Title: "Logs", Path: "/logs", Permissions: []string{"server.logs.read"}},
},
AI: GamePluginManifestAIBody{Purposes: []string{"logs.diagnose"}},
},
AssetFiles: []PluginAssetFileBody{
{Path: "actions/install.json", Content: "{}", Mode: 0o600},
},
}
domainRegistration := request.ToDomain()
domainRegistration.Manifest.Tags[0] = "mutated"
domainRegistration.Manifest.Server.SupportedOS[0] = "darwin"
domainRegistration.Manifest.AssetFiles[0].Path = "actions/mutated.json"
domainRegistration.AssetFiles[0].Content = "mutated"
domainRegistration.Manifest.Pages[0].Permissions[0] = "ai.invoke"
domainRegistration.Manifest.AI.Purposes[0] = "config.suggest"
if request.Manifest.Tags[0] != "example" || request.Manifest.Server.SupportedOS[0] != "linux" || request.Manifest.Pages[0].Permissions[0] != "server.logs.read" || request.Manifest.AI.Purposes[0] != "logs.diagnose" {
if request.Manifest.Tags[0] != "example" || request.Manifest.Server.SupportedOS[0] != "linux" || request.Manifest.AssetFiles[0].Path != "actions/install.json" || request.AssetFiles[0].Content != "{}" || request.Manifest.Pages[0].Permissions[0] != "server.logs.read" || request.Manifest.AI.Purposes[0] != "logs.diagnose" {
t.Fatalf("expected manifest request slices to be copied, got %+v", request)
}
}