Fill the SCUM user and vehicle tables from the plugin-declared database read path

The SCUM 用户管理 list stayed empty because the typed scum_user and
scum_vehicle tables had no producer: the run ingest endpoint is signed-run
only, and the previously registered plugin templates asked for a Run
database capability the endpoint never advertises.

The plugin now declares bounded, read-only SQLite projections for players
and vehicles (sql/scum-db-v57/*.sql with query schemas), and the platform
dispatches those templates as durable remote.run.db.sqlite.query jobs on
run heartbeat and page open, then projects the returned rows into the typed
SCUM tables through the same shared ingest path used by signed run facts.
This commit is contained in:
npc0-hue
2026-09-16 18:01:33 +08:00
parent 0ce264836f
commit 300390dc4d
15 changed files with 1104 additions and 32 deletions
@@ -3,7 +3,7 @@
"id": "game.scum",
"name": "SCUM Server",
"description": "First-party SCUM game server operations plugin with platform-mediated lifecycle and plugin-owned RCON data flows.",
"version": "0.1.19",
"version": "0.1.22",
"kind": "game-plugin",
"tags": [
"scum",
@@ -75,6 +75,7 @@
"remote.run.logs.transfer",
"remote.run.rcon.command",
"remote.run.program.command",
"remote.run.db.sqlite.query",
"artifacts.read",
"artifacts.write",
"ai.invoke"
@@ -92,10 +93,13 @@
"remote.run.process.stop",
"remote.run.logs.transfer",
"remote.run.rcon.command",
"remote.run.program.command"
"remote.run.program.command",
"remote.run.db.sqlite.query"
],
"rcon": true,
"databaseEngines": [],
"databaseEngines": [
"sqlite"
],
"logTransfer": true
},
"bridge": {
@@ -324,6 +328,79 @@
"player.intelligence"
]
}
],
"queryTemplates": [
{
"key": "scum.database.players",
"title": "Read SCUM player, squad, economy, and position facts",
"permission": "server.game-client.read",
"engine": "sqlite",
"transportKey": "scum-database",
"targetKey": "scum-database",
"parameterSchemaRef": "schemas/bridge/queries/scum-database-players.parameters.schema.json",
"resultSchemaRef": "schemas/bridge/queries/scum-database-players.result.schema.json",
"sqlRef": "sql/scum-db-v57/players.sql",
"pollIntervalSeconds": 60,
"maxRows": 180,
"timeoutSeconds": 30,
"projections": [
{
"collection": "scum.users",
"rowPath": "rows",
"upsertKeys": [
"steamId"
],
"fieldMappings": {
"steamId": "steamId",
"displayName": "displayName",
"loginIp": "lastLoginIp",
"squadId": "squadId",
"online": "online",
"login": "freshLogin",
"loginObservedAt": "lastLoginTime",
"bankBalance": "normalBalance",
"goldBars": "goldBalance",
"riddenGameVehicleId": "riddenGameVehicleId",
"x": "x",
"y": "y",
"z": "z"
}
}
]
},
{
"key": "scum.database.vehicles",
"title": "Read SCUM vehicle positions and classes",
"permission": "server.game-client.read",
"engine": "sqlite",
"transportKey": "scum-database",
"targetKey": "scum-database",
"parameterSchemaRef": "schemas/bridge/queries/scum-database-vehicles.parameters.schema.json",
"resultSchemaRef": "schemas/bridge/queries/scum-database-vehicles.result.schema.json",
"sqlRef": "sql/scum-db-v57/vehicles.sql",
"pollIntervalSeconds": 120,
"maxRows": 220,
"timeoutSeconds": 30,
"projections": [
{
"collection": "scum.vehicles",
"rowPath": "rows",
"upsertKeys": [
"gameVehicleId"
],
"fieldMappings": {
"gameVehicleId": "gameVehicleId",
"vehicleClass": "vehicleClass",
"displayName": "displayName",
"exists": "existsInGame",
"x": "x",
"y": "y",
"z": "z",
"observedAt": "observedAt"
}
}
]
}
]
},
"permissions": [
@@ -857,6 +934,14 @@
{
"path": "data-packs/scum-config-v57/map-geometry.json",
"mode": 384
},
{
"path": "sql/scum-db-v57/players.sql",
"mode": 384
},
{
"path": "sql/scum-db-v57/vehicles.sql",
"mode": 384
}
],
"productionLifecycle": {
@@ -1148,7 +1233,21 @@
"retentionDays": 30
}
],
"dataTargets": [],
"dataTargets": [
{
"key": "scum-database",
"kind": "sqlite.snapshot",
"transportKey": "scum-database",
"sourceRootKey": "server-root",
"sourcePath": "SCUM/Saved/SaveFiles/SCUM.db",
"workspaceKey": "databases/scum/SCUM.db",
"refreshPolicy": "on-demand-snapshot",
"maxBytes": 1073741824,
"platforms": [
"windows"
]
}
],
"transportProfiles": [
{
"key": "server-files",
@@ -1177,6 +1276,14 @@
"remote.rsync.write"
]
},
{
"key": "scum-database",
"kind": "sqlite",
"targetKey": "scum-database",
"capabilities": [
"remote.run.db.sqlite.query"
]
},
{
"key": "scum-management",
"kind": "rcon",