Integrate SCUM real ops workflows
This commit is contained in:
@@ -67,11 +67,12 @@ Autonomous lifecycle reports use `POST /api/v1/run/lifecycle/report` with the ac
|
||||
|
||||
## Log Ingest
|
||||
|
||||
SCUM-specific read/write execution requirements are defined in `platform/protocol/scum-run-integration.md`. The implementation still belongs to the independent run repository and uses the generic signed job/log channels described here.
|
||||
|
||||
Implemented HTTP JSON routes:
|
||||
|
||||
- `POST /api/v1/run/logs/batches`
|
||||
- `POST /api/v1/log-streams/query`
|
||||
- `GET /api/v1/server-instances/{id}/logs/events`
|
||||
|
||||
Named log DTOs:
|
||||
|
||||
|
||||
@@ -0,0 +1,67 @@
|
||||
# SCUM Run Integration Contract
|
||||
|
||||
This repository defines the platform/plugin side of SCUM real-data operations. The executable machine-side implementation belongs in the independent `git@git.npc0.com:admin343/run.git` repository and must not be added here.
|
||||
|
||||
## Ownership Boundary
|
||||
|
||||
- Platform owns server instances, authorization, audit, local projections, typed operation/workflow records, idempotency, approval state, and safe browser APIs.
|
||||
- The SCUM plugin owns query template keys, operation template keys, result schemas, safety rules, confirmation schemas, and lifecycle action assets.
|
||||
- Run owns local machine execution beside the current SCUM service: locating the declared logical SCUM.db/log/RCON targets from its scoped package, executing bounded jobs, and returning typed results through existing signed job channels.
|
||||
|
||||
Run must never send host paths, DSNs, sockets, credentials, raw SQL, raw RCON text, or protected request bodies to browser/product APIs. Platform persists only safe job metadata, projection rows, checksums, confirmation summaries, and audit references.
|
||||
|
||||
## Read Observation Jobs
|
||||
|
||||
Run must implement plugin-declared SQLite read templates for the current server binding and return rows matching the referenced schema files under `plugins/examples/scum-server-plugin/schemas/bridge/queries/`.
|
||||
|
||||
Required template keys:
|
||||
|
||||
| Key | Required behavior |
|
||||
| --- | --- |
|
||||
| `scum.player.profile` | Read player identity, profile ID, optional Steam/user ID, character/prisoner fields, economy balances, squad summary, and current coordinates where available. |
|
||||
| `scum.squads` | Read squad IDs, names, leader/profile references, and bounded member counts. |
|
||||
| `scum.squad-members` | Read roster membership, ranks, player/profile references, and unknown fields without fabricating missing identities. |
|
||||
| `scum.vehicles` | Read vehicle/entity rows and coordinates; unknown class/name mappings remain unknown. |
|
||||
| `scum.flags` | Read base flag/entity ownership, squad/player confidence, and coordinates where available. |
|
||||
| `scum.positions` | Read current player, vehicle, and flag coordinate projections. |
|
||||
|
||||
Each successful result must include the server binding, template key, observed time, monotonically comparable sequence, row count within manifest bounds, and `sha256:<hex>` checksum. Failures must return safe error codes such as missing database, locked database, schema mismatch, timeout, or row-bound exceeded; platform will mark affected projections stale while keeping last-known-good records.
|
||||
|
||||
Login/logout evidence comes from plugin-declared log sources. A login line can create/update a local player/session projection; `last_save_time` is only freshness evidence and must not be treated as online-state proof by itself.
|
||||
|
||||
## Controlled Write Jobs
|
||||
|
||||
Run must execute only typed operations declared by the SCUM plugin manifest.
|
||||
|
||||
| Operation key | Transport | Required behavior |
|
||||
| --- | --- | --- |
|
||||
| `player.fame.set` | RCON | Use the declared command template for fame and confirm through follow-up readback. |
|
||||
| `player.currency.normal.set` | RCON | Use the declared command template for normal currency and confirm through follow-up readback. |
|
||||
| `player.currency.gold.set` | RCON | Use the declared command template for gold and confirm through follow-up readback. |
|
||||
| `player.notify` | RCON/declared notification command | Deliver bounded player notification text and report unknown if delivery cannot be proven. |
|
||||
| `reward.deliver` | Declared reward transport | Deliver catalogued reward/notification only once per idempotency key and confirmation state. |
|
||||
| `player.attribute.855.set` | SQLite mutation | Execute the declared DB-only mutation with before-value guard, max affected rows = 1, maintenance/offline evidence, backup/snapshot reference, and confirmation query. |
|
||||
|
||||
RCON-supported fame/currency writes must not be converted to DB mutations. DB-only mutations must fail safely when the current value differs from the approved `before` value, the affected row bound is exceeded, backup evidence is missing, or the player safety state is online/unknown.
|
||||
|
||||
## Result And Confirmation Contract
|
||||
|
||||
Run job results for SCUM reads, RCON writes, and SQLite mutations must return:
|
||||
|
||||
- `kind` identifying the declared result type.
|
||||
- `checksum` as `sha256:<64 hex chars>`.
|
||||
- Bounded JSON content matching the plugin result/confirmation schema.
|
||||
- `affectedRows` for mutations and zero/one row confirmation details where applicable.
|
||||
- A safe audit summary that excludes raw SQL, raw RCON text, SCUM.db paths, host paths, tokens, sockets, and credentials.
|
||||
|
||||
If execution may have happened but confirmation is missing, run should report an unknown/pending-confirmation state rather than success. Platform will read back before retrying so gifts, currency, fame, and DB fields are not duplicated or overwritten.
|
||||
|
||||
## External Run Tasks
|
||||
|
||||
The independent run repository needs implementation work for:
|
||||
|
||||
1. Resolve package-scoped logical SCUM.db and log targets from the generated run plan without exposing resolved host paths to Platform Web.
|
||||
2. Execute the six declared SQLite read templates with row/time bounds and schema-compatible JSON rows.
|
||||
3. Execute typed RCON operation templates for fame, currency, notification, and reward delivery without accepting arbitrary browser command text.
|
||||
4. Execute `player.attribute.855.set` through a guarded SQLite mutation with backup, maintenance/offline checks, before-value match, affected-row bound, and confirmation read.
|
||||
5. Report observation failures and write unknown states with safe codes and checksums so platform projections and workflows can reconcile deterministically.
|
||||
@@ -51,15 +51,13 @@ A server instance is created from one installed game management plugin and is la
|
||||
- `POST /api/v1/server-instances/workflows/create` validates an installed plugin, server name, idempotency key, and plugin-declared create inputs when provided. It creates the instance without requiring a deployment target, run endpoint, or runtime profile. Generated Run packages carry the autonomous lifecycle plan that Run consumes on startup; registration confirms binding/auth and does not enqueue bootstrap lifecycle jobs.
|
||||
- `POST /api/v1/server-instances/{id}/start` validates the instance is `ready` or `stopped`, checks the expected config version, verifies the plugin start action and run endpoint `process.start` capability, and queues a start job.
|
||||
- `POST /api/v1/server-instances/{id}/stop` validates the instance is `running`, checks the expected config version, verifies the plugin stop action and run endpoint `process.stop` capability, and queues a stop job.
|
||||
- `GET /api/v1/server-instances/{id}/config` returns logical read-only config content for an authorized server instance with config version, format, key, source, and update timestamp metadata.
|
||||
- `POST /api/v1/server-instances/{id}/config/diff` validates an authorized proposed config write against the current config version and returns a bounded platform diff without queuing work.
|
||||
- `POST /api/v1/server-instances/{id}/config/approve` revalidates an explicitly reviewed config diff and queues a scoped `config.write` job using a logical config key and input ref.
|
||||
- Server-scoped raw config read/diff/approve routes are not product APIs. AI-assisted configuration uses reviewable AI config-diff approvals and typed dispatch metadata without returning raw config text to plugin pages.
|
||||
- `POST /api/v1/file-operations/dispatch` queues scoped `files.read` or `files.write` jobs for logical server/plugin file keys after role and permission checks.
|
||||
- `GET /api/v1/metrics/server-instances` returns bounded per-server metrics for instances visible to the authenticated user.
|
||||
|
||||
Workflow route responses include the accepted action, bounded server instance metadata, and bounded job metadata. They do not expose run session tokens, host paths, raw credentials, direct sockets, AI provider keys, or plugin action file contents.
|
||||
|
||||
Config read and server metrics responses are also bounded and platform-mediated. They do not expose host filesystem paths, run sockets, raw credentials, direct storage backends, or AI provider keys.
|
||||
Server metrics responses are bounded and platform-mediated. They do not expose host filesystem paths, run sockets, raw credentials, direct storage backends, or AI provider keys.
|
||||
|
||||
Config write approval and file dispatch are platform-mediated. They carry logical keys such as `server.properties` or `logs/latest.log`, scoped refs such as `input://...` or `artifact://...`, and bounded job metadata only. They do not mutate local files in the platform process and do not expose raw host paths, run credentials, direct sockets, AI provider keys, or inline large payloads.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user