main
md 46 lines 2.11 KB
Rendered Raw
1 # tunnel_proxy.py DOX
2
3 ## Purpose
4
5 - Own the `tunnel_proxy.py` API endpoint.
6 - This module proxies tunnel-related HTTP traffic through the configured tunnel provider.
7 - Keep this file-level DOX profile synchronized with `tunnel_proxy.py` because this directory is intentionally flat.
8
9 ## Ownership
10
11 - `tunnel_proxy.py` owns the runtime implementation.
12 - `tunnel_proxy.py.dox.md` owns durable notes about responsibilities, contracts, side effects, and verification for that implementation.
13 - Classes:
14 - `TunnelProxy` (`ApiHandler`)
15 - `async process(self, input: dict, request: Request) -> dict | Response`
16 - Top-level functions:
17 - `async process(input: dict) -> dict | Response`
18
19 ## Runtime Contracts
20
21 - HTTP handlers must derive from `helpers.api.ApiHandler`; WebSocket handlers must derive from `helpers.ws.WsHandler`.
22 - Update this file whenever request payloads, authentication or CSRF requirements, response shapes, route side effects, or WebSocket event contracts change.
23 - `TunnelProxy` is an `ApiHandler`.
24 - `TunnelProxy` defines `process(...)`.
25 - Observed side-effect areas: network calls, settings/state persistence, tunnel state.
26 - Imported dependency areas include: `helpers`, `helpers.api`, `helpers.tunnel_manager`, `requests`.
27
28 ## Key Concepts
29
30 - Important called helpers/classes observed in the source: `runtime.get_arg`, `requests.post`, `process`, `dotenv.get_dotenv_value`, `response.json`, `local_process`.
31 - Keep request/response, tool, or helper semantics documented here at the same time as source changes.
32
33 ## Work Guidance
34
35 - Preserve authentication, CSRF, loopback, and API-key checks unless the endpoint contract explicitly changes.
36 - Update frontend callers, plugin callers, and tests together when payload shape changes.
37 - Use `helpers.api.Response` for non-JSON responses, files, redirects, or status-specific replies.
38
39 ## Verification
40
41 - Run endpoint-specific or API/WebSocket tests for changed behavior; smoke-test browser callers when no focused test exists.
42 - No direct test reference was found by name search; choose the nearest behavioral test or perform a focused smoke check.
43
44 ## Child DOX Index
45
46 No child DOX files.