Adapters and the Application Layer

Adapters and the Application Layer An architecture diagram generated by Archify. Click Commands · cli/*_cmd.py · frontend adapters · parse · render · exit Click Commands cli/*_cmd.py parse · render · exit MCP Tools · mcp/tools/ · frontend adapters · confirm-gated MCP Tools mcp/tools/ confirm-gated REST Routes · server/routes/ · /v1 · frontend adapters · bearer + Host guard REST Routes server/routes/ · /v1 bearer + Host guard CLI Services · cli/services/ · frontend adapters · ADR-0008 CLI Services cli/services/ ADR-0008 Error Envelopes · exit code · CODE: msg · HTTP · frontend adapters Error Envelopes exit code · CODE: msg · HTTP Resolve · _app/resolve.py · partial ids · _app/ · imports no click, rich, fastmcp or fastapi Resolve _app/resolve.py · partial ids Feature Cores · _app/ notebooks · sources · chat · _app/ · imports no click, rich, fastmcp or fastapi · transport-neutral Feature Cores _app/ notebooks · sources · chat transport-neutral errors.classify · _app/errors.py · _app/ · imports no click, rich, fastmcp or fastapi · single category source errors.classify _app/errors.py single category source Client Namespaces · client.notebooks · .sources · Architecture component Client Namespaces client.notebooks · .sources Client Runtime · executor · transport · kernel · Architecture component Client Runtime executor · transport · kernel workflows typed plan tool args request model id lookup client call rpc_call raises category frontend adapters _app/ · imports no click, rich, fastmcp or fastapi Legend Frontend Backend

Adapter responsibilities

  • • *_cmd.py owns Click options, rendering and exit codes
  • • cli/services/ owns plans, retry and wait policy
  • • MCP mutations preview unless called with confirm=true

Neutral core

  • • _app/ raises only the public notebooklm.exceptions types
  • • Simple reads call client namespaces directly
  • • Generate, wait and download flows live in the cores

Enforced boundaries

  • • test_app_boundary.py bans click, rich, fastmcp and fastapi
  • • test_cli_boundary.py allows only two private imports
  • • MCP and REST boundaries are pinned by their own gates