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
+24 -2
View File
@@ -635,9 +635,18 @@ printf 'validating plugin manifests\n'
node - "$ROOT_DIR/plugins/examples/dev-game-plugin/manifest.json" "$WORK_DIR/register-plugin.request.json" <<'NODE'
const fs = require("fs");
const path = require("path");
const manifestPath = process.argv[2];
const outputPath = process.argv[3];
const source = JSON.parse(fs.readFileSync(manifestPath, "utf8"));
const manifestDir = path.dirname(manifestPath);
function readAssetFiles(manifest) {
return (manifest.assetFiles ?? []).map((file) => ({
path: file.path,
mode: file.mode,
content: fs.readFileSync(path.join(manifestDir, file.path), "utf8")
}));
}
const manifest = {
id: source.id,
name: source.name,
@@ -659,6 +668,7 @@ const manifest = {
stop: source.actions.stop,
restart: source.actions.restart
},
assetFiles: source.assetFiles,
pages: [
{
key: "logs",
@@ -686,7 +696,8 @@ const manifest = {
};
fs.writeFileSync(outputPath, JSON.stringify({
manifestRef: "artifact://manifests/game.example/0.1.0",
manifest
manifest,
assetFiles: readAssetFiles(source)
}, null, 2));
NODE
@@ -696,9 +707,18 @@ reject_forbidden_fragments "$WORK_DIR/register-plugin.response.json"
node - "$ROOT_DIR/plugins/examples/scum-server-plugin/manifest.json" "$WORK_DIR/register-scum-plugin.request.json" <<'NODE'
const fs = require("fs");
const path = require("path");
const manifestPath = process.argv[2];
const outputPath = process.argv[3];
const source = JSON.parse(fs.readFileSync(manifestPath, "utf8"));
const manifestDir = path.dirname(manifestPath);
function readAssetFiles(manifest) {
return (manifest.assetFiles ?? []).map((file) => ({
path: file.path,
mode: file.mode,
content: fs.readFileSync(path.join(manifestDir, file.path), "utf8")
}));
}
const localRunCapabilities = [
"process.install",
"process.start",
@@ -742,6 +762,7 @@ const manifest = {
capabilities: localRunCapabilities,
permissions: source.permissions,
actions: source.actions,
assetFiles: source.assetFiles,
pages: source.pages,
bridge: source.bridge,
ai: source.ai,
@@ -752,7 +773,8 @@ const manifest = {
};
fs.writeFileSync(outputPath, JSON.stringify({
manifestRef: "artifact://manifests/game.scum/0.1.0",
manifest
manifest,
assetFiles: readAssetFiles(source)
}, null, 2));
NODE