# Agent - Current State

This file records what is believed to be implemented now.

## Lifecycle / readiness
- readiness-aware server start is centralized.
- manual start/restart, autostart, and supervisor crash restart use the same readiness-aware path.
- duplicate/dead crash monitor path was removed.
- `/ready` exists and is the semantic readiness gate.
- `/status` includes operation and maintenance state fields.
- guarded operation locking exists for mutating/stateful flows.

## Control hardening
- `/start`, `/stop`, `/restart` are POST-only.
- `/console/command` is POST-only and JSON-based with validation/limits.

## Backup support
- local Minecraft backups exist for:
  - create
  - list
  - restore
  - delete
- backups are local under `/opt/zlh-agent/backups`.
- retention is currently simple local max-count pruning.
- pre-restore checkpoint hardening has been added so restore creates a safety checkpoint before destructive restore begins.
- restore exposes both restored backup metadata and checkpoint metadata.

## Runtime / dev environment base
- runtime installs are artifact-backed.
- dev user/workspace model exists.
- code-server install/start baseline exists.
- dev provisioning treats requested code-server as desired state when either `enable_code_server` is true or `addons` contains `codeserver`.
- dev `ensureProvisioned` installs code-server if missing, starts it if stopped, verifies it, and fails if it does not stay running.
- code-server install/config and service start are split:
  - `addons/codeserver/install.sh` installs the artifact and writes config only.
  - `addons/codeserver/start.sh` starts the already-installed service and validates it stays running.
- code-server config no longer writes an empty `proxy-domain`; start rewrites a valid config so existing dev servers recover from the bad config.
- code-server controls exist as POST endpoints:
  - `/dev/codeserver/start`
  - `/dev/codeserver/stop`
  - `/dev/codeserver/restart`
- `/status` reports code-server installed/running state for enabled dev containers.

## Important boundary
- agent does not own remote/offsite backup syncing.
- local app-aware backups are agent responsibility.
- PBS / platform backup strategy is separate from agent implementation.
