Fix run log ingest and terminal console layout

This commit is contained in:
npc0-hue
2026-08-03 12:49:46 +08:00
parent 1d5fb586d0
commit a1bf3aa86a
15 changed files with 390 additions and 34 deletions
@@ -9,6 +9,7 @@ Server cards and server detail headers already consume `GET /api/v1/metrics/serv
- Refresh server list and detail operational data automatically at bounded intervals.
- Keep `编辑部署` on the server list and remove deployment editing from the server detail page.
- Replace the low-value detail overview surface with direct operational sections and drawers for live logs and management terminal.
- Ensure Run job stdout/stderr batches have pre-registered platform log streams and can be accepted using the current Run spool checksum/sequence behavior.
- Keep logs and commands readable in the existing game-operations theme and shared console primitives.
**Non-Goals:**
@@ -32,11 +33,17 @@ Alternative considered: introduce WebSockets for true streaming. That is better
### Decision 3: Drawers for live operational windows
Server list actions open drawers/dialogs for `实时日志` and `管理终端`. These windows do not resize cards, cover metrics inside the card, or create a tall action stack. The log drawer supports source selection, pause/resume, manual refresh, clear visible buffer, and autoscroll. The terminal drawer provides command history-like output and uses the existing SCUM Source RCON dispatch for SCUM servers; unsupported plugins show a safe unsupported state.
Server list actions open drawers/dialogs for `实时日志` and `管理终端`. These windows do not resize cards, cover metrics inside the card, or create a tall action stack. The log drawer supports source selection, pause/resume, manual refresh, clear visible buffer, and autoscroll. The terminal drawer provides an opaque 100%-width, near-full-height command console with command history, bottom input, and quick command templates. It uses the existing SCUM Source RCON dispatch for SCUM servers; unsupported plugins show a safe unsupported state.
Alternative considered: route every action through the detail page. Operators asked for card-level fast access, so drawers preserve context without forcing navigation.
### Decision 4: Detail page starts as an operations workspace
### Decision 4: Platform owns job log stream metadata
Run currently spools process logs using deterministic job stream IDs such as `job.<jobID>.stdout` and uploads single-line batches with a line checksum. Platform job creation will pre-register the matching job stdout/stderr streams, management-program command jobs will also get mediated program stdout/stderr streams, and durable service startup will recover those stream records for legacy jobs persisted before this repair. Log ingest will accept the current Run single-line checksum and first sequence for a new stream while keeping strict continuation once a stream has acknowledged entries.
Alternative considered: require Run to create streams through a platform-admin route before upload. That would either grant Run broader metadata creation authority or continue to leave normal process logs invisible, so it is rejected for this repair.
### Decision 5: Detail page starts as an operations workspace
The detail page no longer exposes deployment editing and does not keep a default overview panel. Its navigation starts on live logs and keeps configuration, plugin controls, AI assistant, operation history, and runtime controls as explicit sections. Runtime binding and distribution controls remain available where they are operational controls, not the create/list deployment editor.
@@ -9,6 +9,7 @@ Server management currently presents live-looking server values that are not liv
- Update server cards to show CPU, memory, and disk with visible progress meters and replace the detail/deployment action cluster with direct `实时日志` and `管理终端` entry points while keeping `编辑部署` available only on the server list.
- Remove the low-value server detail overview surface; the detail page becomes an operations workspace focused on logs, management terminal, runtime controls, configuration, plugin controls, AI assistance, and history.
- Introduce a safe live log drawer that tails platform log streams through cursor polling rather than exposing host paths, sockets, or Run credentials.
- Register job log streams and accept the current Run spool checksum/sequence shape so stdout/stderr batches can appear in the live log drawer.
- Introduce a safe management terminal drawer that sends plugin/platform-mediated commands, starting with the existing SCUM Source RCON command path, and shows task submission/status without exposing raw shell access.
## Capabilities
@@ -21,6 +22,6 @@ Server management currently presents live-looking server values that are not liv
## Impact
- Affected roots: `platform/` for per-server metric projection, `platform_web/` for server list/detail interaction, polling, logs, terminal UI, and focused tests.
- Affected roots: `platform/` for per-server metric projection and job log stream compatibility, `platform_web/` for server list/detail interaction, polling, logs, terminal UI, and focused tests.
- Existing Run metric ingest, log stream cursor query, job tracking, and SCUM Source RCON command APIs are reused; no new run source tree or browser-direct shell is introduced.
- Verification: focused Go tests for metrics projection, frontend tests/typecheck/build as needed, `scripts/check-structure.sh`, and `openspec validate repair-server-live-operations-console --strict`.
@@ -48,6 +48,16 @@ The live log window SHALL read platform log streams and entries through authoriz
- **WHEN** an operator pauses, resumes, clears, filters, or manually refreshes live logs
- **THEN** the UI updates only the visible log window state and does not expose host paths, raw sockets, credentials, or Run endpoint addresses
#### Scenario: Run job logs are uploaded
- **WHEN** Platform creates a server-scoped job that Run may execute
- **THEN** Platform pre-registers the job stdout and stderr log streams that match Run's deterministic spool stream IDs
- **AND** Run log batches using the current single-line checksum and an initial global sequence number are accepted and visible through cursor queries
#### Scenario: Legacy persisted jobs have no log streams
- **WHEN** Platform starts with existing server-scoped jobs that were persisted before job log streams were auto-created
- **THEN** Platform recovers the missing job stdout and stderr stream metadata before log cursor recovery
- **AND** mediated management-program jobs recover their program stdout and stderr stream metadata as well
### Requirement: Management terminal is platform-mediated
The management terminal SHALL dispatch commands only through platform-authorized plugin or lifecycle command paths and SHALL NOT provide browser-direct shell access.
@@ -55,6 +65,10 @@ The management terminal SHALL dispatch commands only through platform-authorized
- **WHEN** an operator submits a SCUM management command from the terminal
- **THEN** the UI dispatches the command through the existing Source RCON command API and displays safe submission/job status
#### Scenario: Terminal window opens
- **WHEN** an operator opens `管理终端`
- **THEN** the UI presents an opaque near-full-height command console with bottom command input and quick command templates rather than a translucent narrow drawer
#### Scenario: Unsupported command target
- **WHEN** a server plugin has no supported management terminal command path
- **THEN** the terminal shows an unsupported state instead of exposing a raw shell or arbitrary command input
@@ -13,6 +13,9 @@
- [x] 3.1 Add a live log drawer that lists server log streams and tails selected entries with cursor polling plus pause, clear, filter, and manual refresh controls.
- [x] 3.2 Add a management terminal drawer that dispatches SCUM commands through the existing Source RCON API and shows safe unsupported state for other plugins.
- [x] 3.3 Wire server list card actions to `编辑部署`, `实时日志`, and `管理终端` without reflowing cards or moving deployment editing into detail.
- [x] 3.4 Register job stdout/stderr log streams and accept current Run spool checksum/sequence behavior so live logs can populate.
- [x] 3.5 Convert the management terminal to an opaque full-width command console with bottom input and quick command templates.
- [x] 3.6 Recover missing job log streams for legacy persisted jobs at durable service startup.
## 4. Server Detail Workspace