# Patch Summary — Backoffice REST as Channel ## Goal Adapt the Backoffice project so legacy REST endpoints behave as framework channel entrypoints instead of directly invoking `BackofficeWorkflowExecutor` from FastAPI routes. ## Added - `app/channels/__init__.py` - `app/channels/backoffice_rest_adapter.py` - `app/workflows/backoffice_workflow_dispatcher.py` - `docs/BACKOFFICE_REST_AS_CHANNEL_ARCHITECTURE.md` ## Modified - `app/main.py` - Instantiates `BackofficeRestChannelAdapter` and `BackofficeWorkflowDispatcher`. - Updates `/agent/*` routes to create a `BackofficeChannelEnvelope` and dispatch through the channel path. - Updates response metadata with `framework_entrypoint=channel_gateway` and `source_channel=backoffice_rest`. - Updates readiness/debug metadata to show the channel gateway entrypoint. - `app/agents/backoffice_agent.py` - Removes guidance that operational checklist should be called through direct `BackofficeWorkflowExecutor` usage. - Documents that operational ticket/emulator flows enter through the channel adapter and dispatcher. - `app/workflows/backoffice_workflow_executor.py` - Repositioned as the workflow execution engine behind the dispatcher, not the REST entrypoint. - `src/api/LEGACY_ROUTES_DISABLED.md` - Updated to describe the new REST → ChannelGateway → dispatcher → workflow path. ## New execution chain ```text Legacy REST route → BackofficeRestChannelAdapter → ChannelGateway.normalize(...) → BackofficeWorkflowDispatcher → BackofficeWorkflowExecutor / LangGraph workflow → Response builder preserving legacy contract ``` ## Validation done Python syntax compilation succeeded for the changed Python files: ```text app/main.py app/agents/backoffice_agent.py app/channels/backoffice_rest_adapter.py app/workflows/backoffice_workflow_dispatcher.py app/workflows/backoffice_workflow_executor.py ```