opsairlock 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. opsairlock-0.1.0/LICENSE +91 -0
  2. opsairlock-0.1.0/NOTICE +13 -0
  3. opsairlock-0.1.0/PKG-INFO +54 -0
  4. opsairlock-0.1.0/README.md +40 -0
  5. opsairlock-0.1.0/opsairlock/__init__.py +8 -0
  6. opsairlock-0.1.0/opsairlock/approval.py +213 -0
  7. opsairlock-0.1.0/opsairlock/audit_engine.py +319 -0
  8. opsairlock-0.1.0/opsairlock/cli.py +705 -0
  9. opsairlock-0.1.0/opsairlock/config.py +262 -0
  10. opsairlock-0.1.0/opsairlock/daemon.py +190 -0
  11. opsairlock-0.1.0/opsairlock/doctor.py +197 -0
  12. opsairlock-0.1.0/opsairlock/handover.py +90 -0
  13. opsairlock-0.1.0/opsairlock/mcp_server.py +296 -0
  14. opsairlock-0.1.0/opsairlock/sandbox.py +165 -0
  15. opsairlock-0.1.0/opsairlock/ttl.py +189 -0
  16. opsairlock-0.1.0/opsairlock/tunnel.py +83 -0
  17. opsairlock-0.1.0/opsairlock/warpgate_api.py +191 -0
  18. opsairlock-0.1.0/opsairlock/ws_codec.py +168 -0
  19. opsairlock-0.1.0/opsairlock.egg-info/PKG-INFO +54 -0
  20. opsairlock-0.1.0/opsairlock.egg-info/SOURCES.txt +33 -0
  21. opsairlock-0.1.0/opsairlock.egg-info/dependency_links.txt +1 -0
  22. opsairlock-0.1.0/opsairlock.egg-info/entry_points.txt +3 -0
  23. opsairlock-0.1.0/opsairlock.egg-info/top_level.txt +1 -0
  24. opsairlock-0.1.0/pyproject.toml +24 -0
  25. opsairlock-0.1.0/setup.cfg +4 -0
  26. opsairlock-0.1.0/tests/test_approval_client.py +107 -0
  27. opsairlock-0.1.0/tests/test_audit_engine.py +103 -0
  28. opsairlock-0.1.0/tests/test_cli_flow.py +91 -0
  29. opsairlock-0.1.0/tests/test_config_and_api.py +148 -0
  30. opsairlock-0.1.0/tests/test_daemon_and_tunnel.py +82 -0
  31. opsairlock-0.1.0/tests/test_doctor.py +46 -0
  32. opsairlock-0.1.0/tests/test_install_and_packaging.py +85 -0
  33. opsairlock-0.1.0/tests/test_mcp_server.py +69 -0
  34. opsairlock-0.1.0/tests/test_sandbox.py +34 -0
  35. opsairlock-0.1.0/tests/test_ttl.py +59 -0
@@ -0,0 +1,91 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity.
18
+
19
+ "You" (or "Your") shall mean an individual or Legal Entity
20
+ exercising permissions granted by this License.
21
+
22
+ "Source" form shall mean the preferred form for making modifications,
23
+ including but not limited to software source code, documentation
24
+ source, and configuration files.
25
+
26
+ "Object" form shall mean any form resulting from mechanical
27
+ transformation or translation of a Source form.
28
+
29
+ "Work" shall mean the work of authorship made available under the
30
+ License.
31
+
32
+ "Derivative Works" shall mean any work based on (or derived from)
33
+ the Work.
34
+
35
+ "Contribution" shall mean any work of authorship submitted to the
36
+ Licensor for inclusion in the Work.
37
+
38
+ "Contributor" shall mean Licensor and any individual or Legal Entity
39
+ on behalf of whom a Contribution has been received by Licensor.
40
+
41
+ 2. Grant of Copyright License. Subject to the terms and conditions of
42
+ this License, each Contributor hereby grants to You a perpetual,
43
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
44
+ copyright license to reproduce, prepare Derivative Works of,
45
+ publicly display, publicly perform, sublicense, and distribute the
46
+ Work and such Derivative Works in Source or Object form.
47
+
48
+ 3. Grant of Patent License. Subject to the terms and conditions of
49
+ this License, each Contributor hereby grants to You a perpetual,
50
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
51
+ patent license to make, have made, use, offer to sell, sell, import,
52
+ and otherwise transfer the Work.
53
+
54
+ 4. Redistribution. You may reproduce and distribute copies of the
55
+ Work or Derivative Works thereof in any medium, with or without
56
+ modifications, and in Source or Object form, provided that You
57
+ meet the following conditions:
58
+ (a) You must give any other recipients of the Work or Derivative
59
+ Works a copy of this License; and
60
+ (b) You must cause any modified files to carry prominent notices
61
+ stating that You changed the files; and
62
+ (c) You must retain, in the Source form of any Derivative Works
63
+ that You distribute, all copyright, patent, trademark, and
64
+ attribution notices from the Source form of the Work; and
65
+ (d) If the Work includes a "NOTICE" text file as part of its
66
+ distribution, then any Derivative Works that You distribute must
67
+ include a readable copy of the attribution notices contained
68
+ within such NOTICE file.
69
+
70
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
71
+ any Contribution intentionally submitted for inclusion in the Work
72
+ by You to the Licensor shall be under the terms and conditions of
73
+ this License, without any additional terms or conditions.
74
+
75
+ 6. Trademarks. This License does not grant permission to use the trade
76
+ names, trademarks, service marks, or product names of the Licensor.
77
+
78
+ 7. Disclaimer of Warranty. Unless required by applicable law or
79
+ agreed to in writing, Licensor provides the Work on an "AS IS" BASIS,
80
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
81
+ implied.
82
+
83
+ 8. Limitation of Liability. In no event and under no legal theory shall
84
+ any Contributor be liable to You for damages arising out of this
85
+ License or out of the use or inability to use the Work.
86
+
87
+ 9. Accepting Warranty or Additional Liability. While redistributing
88
+ the Work or Derivative Works thereof, You may choose to offer
89
+ support, warranty, or indemnity obligations on Your own behalf.
90
+
91
+ Copyright 2026 OpsAirlock Contributors
@@ -0,0 +1,13 @@
1
+ OpsAirlock
2
+ Copyright 2026 OpsAirlock Contributors
3
+
4
+ This product includes orchestration, CLI tooling, sandbox profiles, MCP bridge,
5
+ and audit workflows designed to operate with the unmodified upstream Warpgate
6
+ bastion engine:
7
+
8
+ Warpgate (https://github.com/warp-tech/warpgate)
9
+ Licensed under the Apache License, Version 2.0.
10
+ Copyright (c) Warpgate contributors.
11
+
12
+ OpsAirlock is an independent open-source project and is not affiliated with or
13
+ endorsed by the Warpgate maintainers.
@@ -0,0 +1,54 @@
1
+ Metadata-Version: 2.4
2
+ Name: opsairlock
3
+ Version: 0.1.0
4
+ Summary: 60-second zero-trust access airlock, OS sandbox, and Slack-first control plane for AI Agents and freelancers.
5
+ License: Apache-2.0
6
+ Project-URL: Homepage, https://opsairlock.com
7
+ Project-URL: Repository, https://github.com/opsairlock/opsairlock
8
+ Keywords: ssh,bastion,ai-agent,mcp,zero-trust,security,devops,slack
9
+ Requires-Python: >=3.9
10
+ Description-Content-Type: text/markdown
11
+ License-File: LICENSE
12
+ License-File: NOTICE
13
+ Dynamic: license-file
14
+
15
+ # OpsAirlock
16
+
17
+ **Run one command on your VPS (`opsairlock install`), close SSH forever, and manage AI Agents & freelancers from Slack — OS sandboxing, 1-tap approvals, TTL auto-revoke, and video replay.**
18
+
19
+ > **100% Glass-Box Trust**: Pure Python 3 standard library (`dependencies = []`), zero hidden telemetry, and 100% unmodified official Apache-2.0 bastion engine ([Warpgate](https://github.com/warp-tech/warpgate) `0.30.0`). Copy any file in this repo into your favorite AI and audit it line by line.
20
+
21
+ ## 1-Step VPS Install (The Only Command You Run on Your Server)
22
+
23
+ ```bash
24
+ # Option 1: Install via pipx / uv (PEP-668 safe)
25
+ pipx install opsairlock && opsairlock install
26
+
27
+ # Option 2: Zero-dependency shell installer (from cloned repo)
28
+ ./install.sh && opsairlock install
29
+ ```
30
+
31
+ In 60 seconds, `opsairlock install` initializes the single-port bastion, pairs your **Slack** (or Telegram) via 1-click link / QR code, and registers the background `opsairlock-daemon.service`. **Close your SSH terminal — manage everything from Slack:**
32
+
33
+ - `/airlock grant human --profile deploy --workdir /srv/n8n --ttl 4h` → Slack outputs a ready-to-share Web SSH pass.
34
+ - `/airlock grant agent --profile readonly --ttl 2h` → Slack outputs a ready-to-paste `uvx --from opsairlock opsairlock-mcp` snippet for Claude Code / Cursor.
35
+ - High-risk commands pause and pop **`[Approve] / [Deny]`** directly in Slack (or fail closed offline).
36
+ - `/airlock audit` & `/airlock revoke` → 3-second Red/Yellow/Green risk summary + video replay link + instant kill switch.
37
+
38
+ ## Free Direct HTTPS vs. Pro Zero-Port Tunnel
39
+
40
+ - **Free (Default)**: Management control plane converges 100% over outbound HTTPS to Slack (Admin UI stays local-only); open 1 HTTPS port on your VPS/firewall for third-party Web SSH.
41
+ - **Pro Zero-Port Mode (`opsairlock tunnel`)**: Zero inbound ports on your VPS—end-to-end encrypted TLS/SSH passthrough via the hosted OpsAirlock Approval Router (zero decryption, GDPR-friendly).
42
+
43
+ ## How OpsAirlock Compares
44
+
45
+ | Solution | Best For | Why Teams Pick OpsAirlock Instead |
46
+ | :--- | :--- | :--- |
47
+ | **[Teleport](https://goteleport.com/use-cases/agentic-ai/) / [Hoop.dev](https://github.com/hoophq/hoop)** | Enterprise platform teams | Heavy multi-component clusters; OpsAirlock deploys on a single VPS in 60 seconds |
48
+ | **[ssh-mcp](https://github.com/tufantunc/ssh-mcp) / MCP plugins** | Local MCP clients only | No server-side OS sandbox, no contractor browser Web SSH, no video replay |
49
+ | **Raw SSH / Root Keys** | Solo hobby servers | Standing root keys, no sandbox isolation, no kill switch, no audit trail |
50
+ | **OpsAirlock** | **1–50 person SMBs, AI agencies, indie founders** | **1-Step `install` • Slack Control Plane • 3 OS Sandbox Profiles • TTL Kill Switch** |
51
+
52
+ ## Attribution & License
53
+
54
+ Licensed under the Apache-2.0 License. Powered by the unmodified upstream [Warpgate](https://github.com/warp-tech/warpgate) (Apache-2.0) bastion engine. See [`LICENSE`](./LICENSE), [`NOTICE`](./NOTICE).
@@ -0,0 +1,40 @@
1
+ # OpsAirlock
2
+
3
+ **Run one command on your VPS (`opsairlock install`), close SSH forever, and manage AI Agents & freelancers from Slack — OS sandboxing, 1-tap approvals, TTL auto-revoke, and video replay.**
4
+
5
+ > **100% Glass-Box Trust**: Pure Python 3 standard library (`dependencies = []`), zero hidden telemetry, and 100% unmodified official Apache-2.0 bastion engine ([Warpgate](https://github.com/warp-tech/warpgate) `0.30.0`). Copy any file in this repo into your favorite AI and audit it line by line.
6
+
7
+ ## 1-Step VPS Install (The Only Command You Run on Your Server)
8
+
9
+ ```bash
10
+ # Option 1: Install via pipx / uv (PEP-668 safe)
11
+ pipx install opsairlock && opsairlock install
12
+
13
+ # Option 2: Zero-dependency shell installer (from cloned repo)
14
+ ./install.sh && opsairlock install
15
+ ```
16
+
17
+ In 60 seconds, `opsairlock install` initializes the single-port bastion, pairs your **Slack** (or Telegram) via 1-click link / QR code, and registers the background `opsairlock-daemon.service`. **Close your SSH terminal — manage everything from Slack:**
18
+
19
+ - `/airlock grant human --profile deploy --workdir /srv/n8n --ttl 4h` → Slack outputs a ready-to-share Web SSH pass.
20
+ - `/airlock grant agent --profile readonly --ttl 2h` → Slack outputs a ready-to-paste `uvx --from opsairlock opsairlock-mcp` snippet for Claude Code / Cursor.
21
+ - High-risk commands pause and pop **`[Approve] / [Deny]`** directly in Slack (or fail closed offline).
22
+ - `/airlock audit` & `/airlock revoke` → 3-second Red/Yellow/Green risk summary + video replay link + instant kill switch.
23
+
24
+ ## Free Direct HTTPS vs. Pro Zero-Port Tunnel
25
+
26
+ - **Free (Default)**: Management control plane converges 100% over outbound HTTPS to Slack (Admin UI stays local-only); open 1 HTTPS port on your VPS/firewall for third-party Web SSH.
27
+ - **Pro Zero-Port Mode (`opsairlock tunnel`)**: Zero inbound ports on your VPS—end-to-end encrypted TLS/SSH passthrough via the hosted OpsAirlock Approval Router (zero decryption, GDPR-friendly).
28
+
29
+ ## How OpsAirlock Compares
30
+
31
+ | Solution | Best For | Why Teams Pick OpsAirlock Instead |
32
+ | :--- | :--- | :--- |
33
+ | **[Teleport](https://goteleport.com/use-cases/agentic-ai/) / [Hoop.dev](https://github.com/hoophq/hoop)** | Enterprise platform teams | Heavy multi-component clusters; OpsAirlock deploys on a single VPS in 60 seconds |
34
+ | **[ssh-mcp](https://github.com/tufantunc/ssh-mcp) / MCP plugins** | Local MCP clients only | No server-side OS sandbox, no contractor browser Web SSH, no video replay |
35
+ | **Raw SSH / Root Keys** | Solo hobby servers | Standing root keys, no sandbox isolation, no kill switch, no audit trail |
36
+ | **OpsAirlock** | **1–50 person SMBs, AI agencies, indie founders** | **1-Step `install` • Slack Control Plane • 3 OS Sandbox Profiles • TTL Kill Switch** |
37
+
38
+ ## Attribution & License
39
+
40
+ Licensed under the Apache-2.0 License. Powered by the unmodified upstream [Warpgate](https://github.com/warp-tech/warpgate) (Apache-2.0) bastion engine. See [`LICENSE`](./LICENSE), [`NOTICE`](./NOTICE).
@@ -0,0 +1,8 @@
1
+ """OpsAirlock — Zero-Trust Access Airlock, OS Sandbox & Slack-First Control Plane."""
2
+
3
+ __version__ = "0.1.0"
4
+ PRODUCT_NAME = "OpsAirlock"
5
+ PRODUCT_URL = "https://opsairlock.com"
6
+ DEFAULT_ROUTER_URL = "https://router.opsairlock.com"
7
+ HARDENING_SERVICE_URL = "https://github.com/wu00112238/n8n-production-hardening"
8
+ UPSTREAM_WARPGATE_IMAGE = "ghcr.io/warp-tech/warpgate:0.30.0"
@@ -0,0 +1,213 @@
1
+ """Outbound-only Human-in-the-Loop (HITL) approval & pairing client for OpsAirlock Router."""
2
+
3
+ from __future__ import annotations
4
+
5
+ import json
6
+ import os
7
+ import time
8
+ import urllib.error
9
+ import urllib.request
10
+ from typing import Any, Callable, Dict, List, Optional
11
+
12
+ from . import DEFAULT_ROUTER_URL, __version__
13
+
14
+
15
+ class ApprovalClient:
16
+ """Submits lightweight approval tickets to OpsAirlock Approval Router and polls verdict."""
17
+
18
+ def __init__(
19
+ self,
20
+ router_url: Optional[str] = None,
21
+ router_token: Optional[str] = None,
22
+ server_label: Optional[str] = None,
23
+ poll_interval: float = 2.0,
24
+ timeout_seconds: float = 120.0,
25
+ ) -> None:
26
+ self.router_url = (
27
+ router_url if router_url is not None else os.environ.get("OPSAIRLOCK_ROUTER_URL", "")
28
+ ).strip().rstrip("/")
29
+ self.router_token = (
30
+ router_token if router_token is not None else os.environ.get("OPSAIRLOCK_ROUTER_TOKEN", "")
31
+ ).strip()
32
+ self.server_label = (server_label or os.environ.get("OPSAIRLOCK_TARGET", "prod-server")).strip()
33
+ self.poll_interval = poll_interval
34
+ self.timeout_seconds = timeout_seconds
35
+
36
+ @property
37
+ def is_configured(self) -> bool:
38
+ return bool(self.router_url and self.router_token)
39
+
40
+ def _request(
41
+ self,
42
+ method: str,
43
+ path: str,
44
+ payload: Optional[Dict[str, Any]] = None,
45
+ with_auth: bool = True,
46
+ ) -> Dict[str, Any]:
47
+ url = f"{self.router_url}{path}"
48
+ data = json.dumps(payload).encode("utf-8") if payload is not None else None
49
+ headers: Dict[str, str] = {"Accept": "application/json", "User-Agent": f"OpsAirlock-CLI/{__version__}"}
50
+ if with_auth and self.router_token:
51
+ headers["Authorization"] = f"Bearer {self.router_token}"
52
+ if data is not None:
53
+ headers["Content-Type"] = "application/json"
54
+ req = urllib.request.Request(url, data=data, headers=headers, method=method)
55
+ with urllib.request.urlopen(req, timeout=15) as resp:
56
+ raw = resp.read().decode("utf-8").strip()
57
+ return json.loads(raw) if raw else {}
58
+
59
+ def start_pairing(
60
+ self,
61
+ channel_type: str = "telegram",
62
+ on_pair_url: Optional[Callable[[Dict[str, Any]], None]] = None,
63
+ ) -> Dict[str, Any]:
64
+ """Initiate zero-ID pairing via clickable URL / QR page and poll for issued token."""
65
+ if not self.router_url:
66
+ self.router_url = DEFAULT_ROUTER_URL
67
+ started = self._request(
68
+ "POST",
69
+ "/api/v1/pair/start",
70
+ {"server_label": self.server_label, "channel_type": channel_type},
71
+ with_auth=False,
72
+ )
73
+ if on_pair_url is not None:
74
+ on_pair_url(started)
75
+
76
+ pair_code = started.get("pair_code")
77
+ if not pair_code:
78
+ raise RuntimeError("Router did not return a pair_code.")
79
+
80
+ deadline = time.monotonic() + self.timeout_seconds
81
+ while time.monotonic() < deadline:
82
+ state = self._request("GET", f"/api/v1/pair/{pair_code}", with_auth=False)
83
+ status = str(state.get("status", "PENDING")).upper()
84
+ if status == "COMPLETED" and state.get("token"):
85
+ return state
86
+ if status == "EXPIRED":
87
+ raise RuntimeError("Pairing code expired. Please run 'opsairlock connect' again.")
88
+ time.sleep(self.poll_interval)
89
+ raise TimeoutError("Pairing timed out waiting for Slack/Telegram confirmation.")
90
+
91
+ def request_approval(
92
+ self,
93
+ actor: str,
94
+ channel: str,
95
+ command: str,
96
+ rule_ids: List[str],
97
+ severity: str,
98
+ ) -> Dict[str, Any]:
99
+ """Request human approval for a high-risk command. Fails closed if router is absent or unreachable."""
100
+ if not self.is_configured:
101
+ return {
102
+ "verdict": "DENIED_NO_ROUTER",
103
+ "approved": False,
104
+ "reason": "Blocked by Fail-Closed policy (no OpsAirlock Approval Router connected).",
105
+ }
106
+
107
+ try:
108
+ created = self._request(
109
+ "POST",
110
+ "/api/v1/approvals",
111
+ {
112
+ "server_label": self.server_label,
113
+ "actor": actor,
114
+ "channel": channel,
115
+ "command": command,
116
+ "rule_ids": rule_ids,
117
+ "severity": severity,
118
+ },
119
+ )
120
+ except (urllib.error.URLError, OSError, ValueError) as exc:
121
+ return {
122
+ "verdict": "DENIED_ROUTER_ERROR",
123
+ "approved": False,
124
+ "reason": f"Approval Router unreachable (Fail-Closed): {exc}",
125
+ }
126
+
127
+ req_id = created.get("request_id")
128
+ if not req_id:
129
+ return {
130
+ "verdict": "DENIED_ROUTER_ERROR",
131
+ "approved": False,
132
+ "reason": "Approval Router returned no request_id (Fail-Closed).",
133
+ }
134
+
135
+ deadline = time.monotonic() + self.timeout_seconds
136
+ while time.monotonic() < deadline:
137
+ try:
138
+ state = self._request("GET", f"/api/v1/approvals/{req_id}")
139
+ except (urllib.error.URLError, OSError, ValueError) as exc:
140
+ return {
141
+ "verdict": "DENIED_ROUTER_ERROR",
142
+ "approved": False,
143
+ "request_id": req_id,
144
+ "reason": f"Approval Router poll error (Fail-Closed): {exc}",
145
+ }
146
+
147
+ status = str(state.get("status", "PENDING")).upper()
148
+ if status == "APPROVED":
149
+ return {
150
+ "verdict": "APPROVED",
151
+ "approved": True,
152
+ "request_id": req_id,
153
+ "decided_by": state.get("decided_by"),
154
+ }
155
+ if status in ("DENIED", "EXPIRED"):
156
+ return {
157
+ "verdict": status,
158
+ "approved": False,
159
+ "request_id": req_id,
160
+ "decided_by": state.get("decided_by"),
161
+ "reason": f"Command {status.lower()} by server owner.",
162
+ }
163
+ time.sleep(self.poll_interval)
164
+
165
+ return {
166
+ "verdict": "TIMED_OUT",
167
+ "approved": False,
168
+ "request_id": req_id,
169
+ "reason": f"Approval request {req_id} timed out after {int(self.timeout_seconds)}s (Fail-Closed).",
170
+ }
171
+
172
+ def send_digest(self, report: Dict[str, Any]) -> Dict[str, Any]:
173
+ """Push sanitized audit digest metadata (zero raw stdout/secrets) to Approval Router."""
174
+ if not self.is_configured:
175
+ return {"sent": False, "reason": "No Approval Router connected."}
176
+ payload = {
177
+ "server_label": self.server_label,
178
+ "overall_status": report.get("overall_status", "GREEN"),
179
+ "summary": report.get("summary", {}),
180
+ "flagged_rules": sorted({f.get("rule_id", "") for f in report.get("findings", []) if f.get("rule_id")}),
181
+ "replay_urls": [s.get("replay_url", "") for s in report.get("sessions", []) if s.get("replay_url")][:5],
182
+ }
183
+ return self._request("POST", "/api/v1/digest", payload)
184
+
185
+ def poll_next_command(self) -> Optional[Dict[str, Any]]:
186
+ """Poll next Slack-dispatched management command from Approval Router."""
187
+ if not self.is_configured:
188
+ return None
189
+ res = self._request("GET", "/api/v1/commands/next")
190
+ return res.get("command")
191
+
192
+ def post_command_result(self, cmd_id: str, status: str, result_text: str) -> Dict[str, Any]:
193
+ """Return sanitized command execution result to Approval Router."""
194
+ return self._request(
195
+ "POST",
196
+ f"/api/v1/commands/{cmd_id}/result",
197
+ {"status": status, "result_text": result_text},
198
+ )
199
+
200
+ def poll_next_proxy_request(self) -> Optional[Dict[str, Any]]:
201
+ """Poll next incoming subdomain HTTP request for zero-config Web SSH tunneling."""
202
+ if not self.is_configured:
203
+ return None
204
+ res = self._request("GET", "/api/v1/proxy/next")
205
+ return res.get("request")
206
+
207
+ def post_proxy_response(self, req_id: str, status: int, headers: Dict[str, str], body_b64: str) -> Dict[str, Any]:
208
+ """Return local Warpgate HTTP response back through the zero-config subdomain tunnel."""
209
+ return self._request(
210
+ "POST",
211
+ f"/api/v1/proxy/{req_id}/response",
212
+ {"status": status, "headers": headers, "body_b64": body_b64},
213
+ )