ai: system endpoints — aggregate status, services, logs, disks

Proxy the Controller under /api/ai so the model sees one API: an
aggregate /status to start every diagnosis, lean service list, recent
service logs (lines clamped), and disks + SMART.  One controller_client
helper resolves the Controller base URL (docker service name vs
localhost).  Every proxy degrades to an `errors` entry when the
Controller is unreachable — never a 500.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Roland 2026-08-25 21:08:39 -06:00
parent 9872c5e840
commit 60bc1ea1b9
No known key found for this signature in database
GPG key ID: 1BA620CE6C9A4680
4 changed files with 309 additions and 1 deletions

9
modules/ai/errors.py Normal file
View file

@ -0,0 +1,9 @@
from http import HTTPStatus
from wrolpi.errors import APIError
class ControllerUnavailable(APIError):
code = 'CONTROLLER_UNAVAILABLE'
summary = 'The Controller did not answer, or answered with an error.'
status_code = HTTPStatus.BAD_GATEWAY