| 1 | # microsoft_tunnel.py DOX |
| 2 | |
| 3 | ## Purpose |
| 4 | |
| 5 | - Own the `microsoft_tunnel.py` helper module. |
| 6 | - This module implements Microsoft Dev Tunnel provider behavior. |
| 7 | - Keep this file-level DOX profile synchronized with `microsoft_tunnel.py` because this directory is intentionally flat. |
| 8 | |
| 9 | ## Ownership |
| 10 | |
| 11 | - `microsoft_tunnel.py` owns the runtime implementation. |
| 12 | - `microsoft_tunnel.py.dox.md` owns durable notes about responsibilities, contracts, side effects, and verification for that implementation. |
| 13 | - Classes: |
| 14 | - `AgentZeroMicrosoftTunnel` (`MicrosoftTunnel`) |
| 15 | - `notify(self, event, message, data=...)` |
| 16 | - `agent_zero_notifications(self)` |
| 17 | - `MicrosoftDevTunnel` (`FlaredanticTunnelHelper`) |
| 18 | - `build_tunnel(self)` |
| 19 | - `start(self)` |
| 20 | - Top-level functions: |
| 21 | - `default_microsoft_tunnel_id()` |
| 22 | - Notable constants/configuration names: `MICROSOFT_TUNNEL_ID_ENV_KEYS`, `MICROSOFT_TUNNEL_TIMEOUT`. |
| 23 | |
| 24 | ## Runtime Contracts |
| 25 | |
| 26 | - Helper modules own reusable framework APIs and must preserve public callers unless all callers, tests, and docs are updated together. |
| 27 | - Update this file whenever public functions, classes, persistence behavior, path/security assumptions, side effects, or cross-module contracts change. |
| 28 | - Observed side-effect areas: filesystem reads, network calls, settings/state persistence, tunnel state. |
| 29 | - Imported dependency areas include: `flaredantic`, `getpass`, `hashlib`, `helpers`, `helpers.tunnel_common`, `os`, `socket`. |
| 30 | |
| 31 | ## Key Concepts |
| 32 | |
| 33 | - Important called helpers/classes observed in the source: `join`, `strip`, `hashlib.sha256.hexdigest`, `self.notify`, `callable`, `self._notify_progress`, `self._run_cmd`, `MicrosoftConfig`, `AgentZeroMicrosoftTunnel`, `getpass.getuser`, `socket.gethostname`, `files.get_abs_path`, `super.notify`, `parent`, `super.start`, `hashlib.sha256`, `MicrosoftTunnelError`, `default_microsoft_tunnel_id`, `RuntimeError`, `seed.encode`. |
| 34 | - Keep request/response, tool, or helper semantics documented here at the same time as source changes. |
| 35 | |
| 36 | ## Work Guidance |
| 37 | |
| 38 | - Preserve public helper APIs used by core code and plugins unless every caller is updated. |
| 39 | - Keep path, auth, secret, persistence, network, and subprocess behavior explicit and bounded. |
| 40 | - Prefer adding cohesive helper functions here only when behavior is reused across modules. |
| 41 | |
| 42 | ## Verification |
| 43 | |
| 44 | - Run targeted tests for changed helper behavior; run security regressions for auth, filesystem, WebSocket, tunnel, upload, or secret-handling helpers. |
| 45 | - Related tests observed by source search: |
| 46 | - `tests/test_tunnel_remote_link.py` |
| 47 | |
| 48 | ## Child DOX Index |
| 49 | |
| 50 | No child DOX files. |