feat(api): Add /api/gui/state endpoint and live_gui integration tests

This commit is contained in:
2026-03-05 10:06:47 -05:00
parent 52838bc500
commit a783ee5165
4 changed files with 65 additions and 1 deletions

View File

@@ -707,6 +707,13 @@ class AppController:
'manual_approve': 'ui_manual_approve'
}
self._gettable_fields = dict(self._settable_fields)
self._gettable_fields.update({
'ui_focus_agent': 'ui_focus_agent',
'active_discussion': 'active_discussion',
'_track_discussion_active': '_track_discussion_active'
})
self.hook_server = api_hooks.HookServer(app if app else self)
self.hook_server.start()
@@ -1004,6 +1011,15 @@ class AppController:
"""Returns the health status of the API."""
return {"status": "ok"}
@api.get("/api/gui/state", dependencies=[Depends(get_api_key)])
def get_gui_state() -> dict[str, Any]:
"""Returns the current GUI state for specific fields."""
gettable = getattr(self, "_gettable_fields", {})
state = {}
for key, attr in gettable.items():
state[key] = getattr(self, attr, None)
return state
@api.get("/status", dependencies=[Depends(get_api_key)])
def status() -> dict[str, Any]:
"""Returns the current status of the application."""