Skip to main content

Config Web Management API

Config Web is the config-web subcommand of the Go Agent binary. Config Web and the Agent runtime listen on ports 80 and 8080 respectively, and each owns its own PID and service lifecycle. Config Web calls the Agent's loopback-only reload endpoint after configuration is saved, while the Agent reads Config Web's storage-state mirror for archive lookup. Config Web does not proxy Agent chat, session, or Phone Bridge traffic.

Resource Endpoints

All public endpoints use the /api root without an additional version prefix:

ResourceMethod and pathDescription
ConfigurationGET /api/configRead the resolved agent.toml configuration
ConfigurationPATCH /api/configApply the merge patch { "config": { ... } }
ConfigurationGET /api/config/schemaRead field types, defaults, choices, secret markers, and restart hints
ConfigurationPUT /api/config/localeUpdate the page language
ConfigurationPOST /api/config/testValidate configuration and the device environment without saving
ModelsGET /api/models?provider=...&locale=...Return the localized model catalog
STT testPOST /api/config-test/stt/startStart a microphone recording test using the submitted unsaved settings
STT testPOST /api/config-test/stt/stopStop recording and return the transcription result
StorageGET /api/storage/statusRead SD/eMMC state and formatting tasks
StoragePOST /api/storage/formatFormat the SD card asynchronously
StoragePOST /api/storage/ejectSync and safely eject the SD card
DeviceGET /api/device/snapshotRead the aggregated initial-page model: configuration, Wi-Fi, device, firmware, and storage summaries
DeviceGET /api/device/statusRead the device, firmware, Agent process, USB/HID, and capability summary
DevicePOST /api/device/rebootReboot the device
DevicePOST /api/device/usb/reenumerateRe-enumerate USB HID/ECM
NetworkPOST /api/network/wifi/scanScan for nearby Wi-Fi networks
NetworkPUT /api/network/wifi/connectionStart a bounded asynchronous connect-and-save task
NetworkGET /api/network/wifi/connection?task_id=...Poll connection, persistence, and rollback status
NetworkDELETE /api/network/wifi/connection?ssid=...Forget a network without relying on a DELETE request body
SystemGET/PUT /api/system/environmentRead or atomically replace system environment variables
OTAGET /api/ota/statusRead the current state, progress, and log summary
OTAPOST /api/ota/updatesCreate an OTA task and return its task_id
LogsGET /api/logs/agentRead the Agent log summary
LogsGET /api/logs/llmList available LLM HTTP log files
LogsGET/PUT /api/logs/llm/{name}Export a raw LLM HTTP log or import one with the same name
LogsGET /api/logs/supportExport a diagnostic support-log archive

All endpoints above are served by Config Web on port 80. The page uses only same-origin management requests. Agent port mappings therefore do not affect the configuration portal, and the Agent does not expose duplicate models, STT test, or storage-management handlers on port 8080.

GET /api/storage/status and the storage field of GET /api/device/snapshot share the following response shape:

{
"effective_mode": 1,
"card": {
"present": false,
"mounted": false,
"device": "",
"total_bytes": 0,
"free_bytes": 0,
"reason": ""
},
"mount_point": "/mnt/sdcard",
"format_job": {"status": "idle"},
"migration": {"status": "idle"}
}

format_job is asynchronous and its status can be idle, running, success, or failed. migration represents the background migration from eMMC to SD and uses the same status values. A card can be present without being mounted, so clients must use card.present and card.mounted independently when enabling the format and eject actions.

Configuration Save Response

A successful PATCH /api/config response includes:

{
"ok": true,
"persisted": true,
"applied": true,
"revision": 123,
"changed_paths": ["model.model"],
"reboot_required": false,
"restart_required": false,
"restart_reasons": [],
"agent_restart_scheduled": false
}

persisted means the configuration file was written atomically. applied means the Agent accepted and loaded that revision. Clients must present these states separately. If reload fails, the endpoint returns HTTP 503 while retaining persisted=true, applied=false, and the error details. Config Web then schedules an Agent restart and reports agent_restart_scheduled=true; a restart launch failure is reported instead of leaving the saved revision with no recovery path. On a successful response, restart_required mirrors reboot_required: HID changes that need a clean USB session set both fields and the page offers to reboot the board. restart_reasons explains why that reboot is required. agent_restart_scheduled instead describes the fallback process restart used when the running Agent rejects an in-place reload.

Agent Restart Lifecycle

Updating /api/system/environment persists the environment file and schedules an Agent restart. A rejected hot reload follows the same restart lifecycle. STT configuration tests are owned by Config Web and remain available while the Agent restarts. Restart launch failures are returned to the caller instead of being reported as a successfully scheduled restart.

Storage Ownership

Config Web is the sole owner of StorageManager: it detects and mounts the SD card, runs format/eject operations, migrates governed data, and writes /run/aiden/storage.state. The Agent runtime never performs those hardware operations. It uses a read-only state view to include the SD archive root when serving previously migrated audio.

Wi-Fi Task Lifecycle

PUT /api/network/wifi/connection returns HTTP 202 with a task_id immediately. The task has a 120-second total deadline covering candidate application, verification, persistence, and rollback. Clients poll the GET form until the status is succeeded or failed; failure responses distinguish the candidate apply result from the rollback result.

API Boundary

Retired routes such as /api/wifi/*, /api/system/env, /api/ota/update, /api/reboot, /api/agent/*, and /api/llm-logs/* have been removed and return 404 Not Found; no compatibility adapters are provided. Clients must use the canonical resources in the table above. GET /api/config has only configuration semantics; use /api/device/snapshot for the aggregated initial page load.

Internal Agent Reload

POST /api/internal/config/reload accepts loopback requests only and may carry a revision. The Agent validates that revision and reports applied=true only after every affected runtime dependency has been rebuilt successfully. A stale revision returns HTTP 409. This endpoint is not part of the public management API.