Skip to content

memory.dashboard.backend.routes

memory.dashboard.backend.routes

Assembly point for the memory graph dashboard API routes.

The former flat routes.py (~39 endpoints on one APIRouter) is now a per-domain package: shared state + helpers live in :mod:._common, and each domain module (:mod:.tree, :mod:.entries, ...) defines its own APIRouter. This package module is the assembly point — it builds the single top-level router by including each sub-router, and it re-exports every symbol the sub-modules define so that from ...routes import router, dashboard_agent / from ...backend import routes and every routes.<name> access (handlers, helpers, caches, request models) keep resolving exactly as before.

Legacy monkeypatch compatibility: the pre-split tests patch module globals on THIS package (e.g. monkeypatch.setattr(routes, "loader", FakeLoader()) or routes.ACTIVE_SESSION_STALE_AFTER_SECONDS / routes.pid_alive). When everything lived in one module those patches were seen by every handler. Handlers now resolve those names in their own sub-module namespace, so this module object installs a __setattr__ that fans any post-import attribute assignment out to _common and every domain sub-module that already binds that name — reproducing the single-namespace patch semantics without changing any handler body.