Make generated run lifecycle autonomous

This commit is contained in:
npc0-hue
2026-08-06 18:57:42 +08:00
parent acec5e4367
commit 4e78957a60
22 changed files with 583 additions and 236 deletions
+9 -9
View File
@@ -15,12 +15,12 @@ The plugin marketplace API is a platform-facing projection over this installed r
## Server Instance
A server instance is created from one installed game management plugin and bound to one run endpoint.
A server instance is created from one installed game management plugin and is later bound to the generated Run endpoint when that Run registers. Platform stores the instance and projections; Run owns observed lifecycle execution on the machine.
### States
- `draft`: instance record exists but the first bootstrap job has not completed.
- `installing`: the first plugin-owned bootstrap job is active.
- `draft`: instance record exists and is awaiting Run-owned lifecycle bootstrap or reports.
- `installing`: Run reports that plugin-owned install/bootstrap work is active.
- `ready`: install/bootstrap succeeded without starting a supervised process, and the server can start.
- `running`: server process is running.
- `stopped`: server process is stopped.
@@ -36,9 +36,9 @@ A server instance is created from one installed game management plugin and bound
## Lifecycle Actions
- `create`: validate plugin, create instance record, dispatch the plugin-owned bootstrap job.
- `start`: dispatch process start job through the bound run endpoint.
- `stop`: dispatch process stop job through the bound run endpoint.
- `create`: validate plugin and create the instance record without requiring a run endpoint, deployment target, or runtime profile.
- `start`: record/authorize operator intent and route bounded control to the bound Run when applicable; generated Run startup is driven by its package-local autonomous lifecycle plan.
- `stop`: record/authorize operator intent and route bounded control to the bound Run when applicable.
- `restart`: dispatch stop/start or plugin-defined restart job.
- `update`: dispatch server update job and record version/result.
- `delete`: stop server when needed, preserve or remove artifacts according to policy, mark deleted.
@@ -48,7 +48,7 @@ A server instance is created from one installed game management plugin and bound
- `GET /api/v1/plugin-marketplace/plugins` lists plugin marketplace summaries from registry metadata with status, server type, capability, and keyword filters.
- `GET /api/v1/plugin-marketplace/plugins/{id}` returns one registry-backed marketplace detail.
- `POST /api/v1/plugin-marketplace/plugins/{id}/state` applies metadata-only `install`, `enable`, or `disable` state changes.
- `POST /api/v1/server-instances/workflows/create` validates an installed plugin, a compatible run endpoint, a non-empty idempotency key, and required lifecycle action references. It creates the instance in `installing` state and queues either `process.install` or, for guided deployments whose selected lifecycle profile supports supervised start, `process.start` so the plugin start script can install-if-missing and stream process logs.
- `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.
@@ -65,9 +65,9 @@ Config write approval and file dispatch are platform-mediated. They carry logica
Marketplace state actions update only registry install state. They do not download packages, dispatch run jobs, execute plugin bridge code, write server files, expose package bytes, or contact external services. Package acquisition and runtime execution remain deferred to explicit future changes.
## Lifecycle Job Projection
## Lifecycle Projection
Terminal run job results update the associated server instance when the job capability is a lifecycle capability:
Platform-visible lifecycle state is a projection from Run-reported facts. Terminal run job results update the associated server instance when the job capability is a lifecycle capability for explicit Platform-authorized operations:
- `process.install` + `succeeded` marks the instance `ready`.
- `process.start` + `succeeded` marks the instance `running`.