优化后端

This commit is contained in:
Miayui
2026-09-11 17:56:56 +08:00
parent 7eed11b774
commit 812e67422d
7299 changed files with 1744959 additions and 112 deletions
+23 -1
View File
@@ -51,6 +51,7 @@ from cognitive_agent.application.mode_profile_intent import ( # noqa: E402
from cognitive_agent.application.seat_service import ( # noqa: E402
LOCAL_CONTROL_BUDGET_MS,
SeatDemoService,
WIRELESS_MQTT_TRANSPORT,
)
from cognitive_agent.application.self_extension import ( # noqa: E402
ExtensionIntegrationError,
@@ -341,7 +342,11 @@ class SeatDemoHandler(BaseHTTPRequestHandler):
vehicle_id,
control_transport=control_transport,
hardware_client_id=hardware_client_id,
hardware_access_bypass=self._hardware_access_bypass_allowed(),
hardware_access_bypass=(
self._passive_state_access_bypass_allowed(
control_transport
)
),
)
)
except HardwareAccessRequiredError as exc:
@@ -3645,6 +3650,23 @@ class SeatDemoHandler(BaseHTTPRequestHandler):
and self._session_username() is not None
)
def _passive_state_access_bypass_allowed(
self,
control_transport: str,
) -> bool:
"""Keep cached MQTT telemetry readable without widening control access.
The wireless state endpoints only consume the process-local snapshot
populated by the persistent MQTT subscription; they never publish a
frame or reserve the local CAN bench. Mutating control handlers must
continue to call ``_hardware_access_bypass_allowed`` directly.
"""
return (
control_transport == WIRELESS_MQTT_TRANSPORT
or self._hardware_access_bypass_allowed()
)
def _require_local_decision_point(self) -> bool:
if self._is_unproxied_loopback_request():
return True