portacode 2.2.28.dev0__py3-none-any.whl → 2.2.28.dev2__py3-none-any.whl
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.
- portacode/_version.py +2 -2
- portacode/cli.py +12 -0
- portacode/connection/handlers/__init__.py +2 -0
- portacode/connection/handlers/cloudflare_forwarding.py +45 -6
- portacode/connection/handlers/codex_handlers.py +78 -26
- portacode/connection/handlers/system_handlers.py +4 -1
- portacode/connection/handlers/test_cloudflare_access.py +143 -0
- portacode/connection/handlers/test_cloudflare_forwarding.py +2 -2
- portacode/connection/terminal.py +23 -0
- portacode/tests/test_codex_handlers.py +59 -15
- portacode/tunneling/access.py +196 -0
- {portacode-2.2.28.dev0.dist-info → portacode-2.2.28.dev2.dist-info}/METADATA +2 -1
- {portacode-2.2.28.dev0.dist-info → portacode-2.2.28.dev2.dist-info}/RECORD +17 -15
- {portacode-2.2.28.dev0.dist-info → portacode-2.2.28.dev2.dist-info}/WHEEL +1 -1
- {portacode-2.2.28.dev0.dist-info → portacode-2.2.28.dev2.dist-info}/entry_points.txt +0 -0
- {portacode-2.2.28.dev0.dist-info → portacode-2.2.28.dev2.dist-info}/licenses/LICENSE +0 -0
- {portacode-2.2.28.dev0.dist-info → portacode-2.2.28.dev2.dist-info}/top_level.txt +0 -0
portacode/_version.py
CHANGED
|
@@ -18,7 +18,7 @@ version_tuple: tuple[int | str, ...]
|
|
|
18
18
|
commit_id: str | None
|
|
19
19
|
__commit_id__: str | None
|
|
20
20
|
|
|
21
|
-
__version__ = version = '2.2.28.
|
|
22
|
-
__version_tuple__ = version_tuple = (2, 2, 28, '
|
|
21
|
+
__version__ = version = '2.2.28.dev2'
|
|
22
|
+
__version_tuple__ = version_tuple = (2, 2, 28, 'dev2')
|
|
23
23
|
|
|
24
24
|
__commit_id__ = commit_id = None
|
portacode/cli.py
CHANGED
|
@@ -46,6 +46,18 @@ from .browser_cli import browser_group
|
|
|
46
46
|
cli.add_command(browser_group)
|
|
47
47
|
|
|
48
48
|
|
|
49
|
+
@cli.command("cloudflare-access-setup")
|
|
50
|
+
def cloudflare_access_setup():
|
|
51
|
+
"""Save an Access API token locally. Run as the Portacode service user."""
|
|
52
|
+
from .tunneling.access import save_token, inspect_access, PERMISSIONS
|
|
53
|
+
from .tunneling.state import load_state
|
|
54
|
+
click.echo("Create an API token scoped to your tunnel's Cloudflare account with: " + PERMISSIONS)
|
|
55
|
+
click.echo("https://dash.cloudflare.com/profile/api-tokens")
|
|
56
|
+
token = click.prompt("Cloudflare API token", hide_input=True)
|
|
57
|
+
save_token(token)
|
|
58
|
+
click.echo(inspect_access(load_state())["message"])
|
|
59
|
+
|
|
60
|
+
|
|
49
61
|
@cli.group()
|
|
50
62
|
def prepare() -> None:
|
|
51
63
|
"""Prepare supported developer tools for this Portacode device."""
|
|
@@ -71,6 +71,7 @@ from .proxmox_infra import (
|
|
|
71
71
|
)
|
|
72
72
|
from .cloudflare_tunnel import CloudflareTunnelSetupHandler
|
|
73
73
|
from .cloudflare_forwarding import (
|
|
74
|
+
CloudflareAccessHandler,
|
|
74
75
|
CloudflareForwardingHandler,
|
|
75
76
|
ConfigureProxmoxContainerExposePortsHandler,
|
|
76
77
|
)
|
|
@@ -153,6 +154,7 @@ __all__ = [
|
|
|
153
154
|
"RevertProxmoxInfraHandler",
|
|
154
155
|
"CloudflareTunnelSetupHandler",
|
|
155
156
|
"CloudflareForwardingHandler",
|
|
157
|
+
"CloudflareAccessHandler",
|
|
156
158
|
"ConfigureProxmoxContainerExposePortsHandler",
|
|
157
159
|
"AutomationV2StartHandler",
|
|
158
160
|
"AutomationV2StateHandler",
|
|
@@ -14,6 +14,7 @@ import time
|
|
|
14
14
|
import urllib.error
|
|
15
15
|
import urllib.parse
|
|
16
16
|
import urllib.request
|
|
17
|
+
import yaml
|
|
17
18
|
from concurrent.futures import ThreadPoolExecutor, as_completed
|
|
18
19
|
from pathlib import Path
|
|
19
20
|
from typing import Any, Dict, List, Optional
|
|
@@ -37,6 +38,7 @@ from portacode.tunneling.get_domain import extract_token_json
|
|
|
37
38
|
from portacode.tunneling.state import default_config_path, load_state
|
|
38
39
|
from portacode.tunneling.privileged import write_text
|
|
39
40
|
from portacode.tunneling.service_install import restart_service
|
|
41
|
+
from portacode.tunneling.access import normalize_access, prepare_access, inspect_access, enable_otp
|
|
40
42
|
|
|
41
43
|
logger = logging.getLogger(__name__)
|
|
42
44
|
|
|
@@ -133,6 +135,8 @@ def _normalize_rules(
|
|
|
133
135
|
"destination": destination or "",
|
|
134
136
|
"parsed": parsed,
|
|
135
137
|
}
|
|
138
|
+
if "access" in entry:
|
|
139
|
+
normalized_rule["access"] = dict(entry["access"]) if from_storage and entry["access"] else normalize_access(entry["access"])
|
|
136
140
|
if from_storage:
|
|
137
141
|
resolved_ip = str(entry.get("resolved_ip") or "").strip()
|
|
138
142
|
if resolved_ip:
|
|
@@ -273,6 +277,13 @@ def _build_ingress_entries(
|
|
|
273
277
|
else:
|
|
274
278
|
entry["originRequest"] = {"noTLSVerify": True}
|
|
275
279
|
entries.append(entry)
|
|
280
|
+
access = rule.get("access") or {}
|
|
281
|
+
if access.get("mode") in ("existing", "managed"):
|
|
282
|
+
if not access.get("team_name") or not access.get("aud_tag"):
|
|
283
|
+
raise ValueError("Access protection is incomplete; refusing to expose this route.")
|
|
284
|
+
entry.setdefault("originRequest", {})["access"] = {
|
|
285
|
+
"required": True, "teamName": access["team_name"], "audTag": access["aud_tag"],
|
|
286
|
+
}
|
|
276
287
|
return entries
|
|
277
288
|
|
|
278
289
|
|
|
@@ -289,10 +300,10 @@ def _load_active_config_resolved_ips(tunnel_state: Dict[str, Any]) -> Dict[str,
|
|
|
289
300
|
for raw_line in lines:
|
|
290
301
|
stripped = raw_line.strip()
|
|
291
302
|
if stripped.startswith("- hostname:"):
|
|
292
|
-
hostname = stripped.split(":", 1)[1].strip()
|
|
303
|
+
hostname = yaml.safe_load(stripped.split(":", 1)[1].strip())
|
|
293
304
|
continue
|
|
294
305
|
if hostname and stripped.startswith("service:"):
|
|
295
|
-
service = stripped.split(":", 1)[1].strip()
|
|
306
|
+
service = yaml.safe_load(stripped.split(":", 1)[1].strip())
|
|
296
307
|
parsed = urlparse(service)
|
|
297
308
|
if parsed.hostname:
|
|
298
309
|
try:
|
|
@@ -308,7 +319,8 @@ def _load_active_config_resolved_ips(tunnel_state: Dict[str, Any]) -> Dict[str,
|
|
|
308
319
|
def _format_config_value(value: Any) -> str:
|
|
309
320
|
if isinstance(value, bool):
|
|
310
321
|
return "true" if value else "false"
|
|
311
|
-
|
|
322
|
+
# JSON scalars/collections are valid YAML, including nested Access settings.
|
|
323
|
+
return json.dumps(value)
|
|
312
324
|
|
|
313
325
|
|
|
314
326
|
def _write_cloudflared_config(state: Dict[str, Any], entries: List[Dict[str, Any]]) -> None:
|
|
@@ -341,10 +353,10 @@ def _write_cloudflared_config(state: Dict[str, Any], entries: List[Dict[str, Any
|
|
|
341
353
|
lines.append("ingress:")
|
|
342
354
|
for entry in entries:
|
|
343
355
|
if "hostname" in entry:
|
|
344
|
-
lines.append(f" - hostname: {entry['hostname']}")
|
|
356
|
+
lines.append(f" - hostname: {json.dumps(entry['hostname'])}")
|
|
345
357
|
if "path" in entry:
|
|
346
|
-
lines.append(f" path: {entry['path']}")
|
|
347
|
-
lines.append(f" service: {entry['service']}")
|
|
358
|
+
lines.append(f" path: {json.dumps(entry['path'])}")
|
|
359
|
+
lines.append(f" service: {json.dumps(entry['service'])}")
|
|
348
360
|
origin_request = entry.get("originRequest")
|
|
349
361
|
if origin_request:
|
|
350
362
|
lines.append(" originRequest:")
|
|
@@ -547,6 +559,8 @@ def _sanitize_rules(rules: List[Dict[str, Any]]) -> List[Dict[str, str]]:
|
|
|
547
559
|
sanitized = []
|
|
548
560
|
for rule in rules:
|
|
549
561
|
item = {"hostname": rule["hostname"], "destination": rule["destination"]}
|
|
562
|
+
if "access" in rule:
|
|
563
|
+
item["access"] = rule["access"]
|
|
550
564
|
if rule.get("resolved_ip"):
|
|
551
565
|
item["resolved_ip"] = rule["resolved_ip"]
|
|
552
566
|
sanitized.append(item)
|
|
@@ -563,6 +577,19 @@ def _apply_and_persist_forwarding_rules(
|
|
|
563
577
|
if not domain or not tunnel_name:
|
|
564
578
|
raise RuntimeError("Cloudflare domain or tunnel name missing from state.")
|
|
565
579
|
|
|
580
|
+
previous_rules = load_forwarding_state().get("rules", [])
|
|
581
|
+
config_file = Path(str(tunnel_state.get("config_path") or default_config_path()))
|
|
582
|
+
if config_file.exists():
|
|
583
|
+
active_config = yaml.safe_load(config_file.read_text()) or {}
|
|
584
|
+
if not isinstance(active_config, dict):
|
|
585
|
+
raise ValueError("Existing tunnel configuration is invalid; refusing to overwrite it.")
|
|
586
|
+
stored_hosts = {r["hostname"] for r in previous_rules if (r.get("access") or {}).get("mode") in ("managed", "existing")}
|
|
587
|
+
requested_hosts = {r["hostname"] for r in rules if (r.get("access") or {}).get("mode") in ("managed", "existing")}
|
|
588
|
+
for entry in active_config.get("ingress", []):
|
|
589
|
+
access_config = (entry.get("originRequest") or {}).get("access", (active_config.get("originRequest") or {}).get("access", {}))
|
|
590
|
+
if access_config.get("required") and entry.get("hostname") not in stored_hosts | requested_hosts:
|
|
591
|
+
raise ValueError("Manually configured Access protection detected. Link that hostname to its existing Access application before changing ingress rules.")
|
|
592
|
+
prepare_access(rules, previous_rules, tunnel_state)
|
|
566
593
|
active_resolved_ips = _load_active_config_resolved_ips(tunnel_state)
|
|
567
594
|
for rule in rules:
|
|
568
595
|
if not rule.get("resolved_ip") and rule.get("hostname") in active_resolved_ips:
|
|
@@ -1154,6 +1181,18 @@ def reconcile_container_forwarding_ip(
|
|
|
1154
1181
|
return True
|
|
1155
1182
|
|
|
1156
1183
|
|
|
1184
|
+
class CloudflareAccessHandler(SyncHandler):
|
|
1185
|
+
@property
|
|
1186
|
+
def command_name(self) -> str:
|
|
1187
|
+
return "cloudflare_access_status"
|
|
1188
|
+
|
|
1189
|
+
def execute(self, message):
|
|
1190
|
+
state = _load_tunnel_state()
|
|
1191
|
+
with _FORWARDING_UPDATE_LOCK:
|
|
1192
|
+
result = enable_otp(state) if message.get("enable_otp") is True else inspect_access(state)
|
|
1193
|
+
return {"event": "cloudflare_access_status", "device_id": str(message.get("device_id") or ""), "access": result}
|
|
1194
|
+
|
|
1195
|
+
|
|
1157
1196
|
class CloudflareForwardingHandler(SyncHandler):
|
|
1158
1197
|
@property
|
|
1159
1198
|
def command_name(self) -> str:
|
|
@@ -103,18 +103,30 @@ class _SessionAwareSender:
|
|
|
103
103
|
project_id: Optional[str] = None,
|
|
104
104
|
explicit_sessions: Optional[List[str]] = None,
|
|
105
105
|
) -> None:
|
|
106
|
-
target_sessions = set(explicit_sessions or [])
|
|
107
106
|
client_session_manager = self.context.get("client_session_manager")
|
|
107
|
+
target_sessions = set()
|
|
108
108
|
if client_session_manager and client_session_manager.has_interested_clients():
|
|
109
109
|
target_sessions.update(client_session_manager.get_target_sessions(project_id))
|
|
110
|
+
if payload.get("event") == "codex_event":
|
|
111
|
+
params = payload.get("notification", {}).get("params", {})
|
|
112
|
+
thread_id = params.get("threadId") or (params.get("thread") or {}).get("id")
|
|
113
|
+
if not thread_id:
|
|
114
|
+
return
|
|
115
|
+
sessions = client_session_manager.get_sessions()
|
|
116
|
+
target_sessions = {
|
|
117
|
+
name for name in target_sessions
|
|
118
|
+
if (sessions.get(name, {}).get("codex_thread_id") == thread_id
|
|
119
|
+
if "codex_thread_id" in sessions.get(name, {})
|
|
120
|
+
else name in (explicit_sessions or []))
|
|
121
|
+
}
|
|
110
122
|
reply_channel = client_session_manager.get_reply_channel_for_compatibility()
|
|
111
123
|
if reply_channel:
|
|
112
124
|
payload = dict(payload)
|
|
113
125
|
payload["reply_channel"] = reply_channel
|
|
114
|
-
if target_sessions:
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
126
|
+
if not target_sessions:
|
|
127
|
+
return
|
|
128
|
+
payload = dict(payload)
|
|
129
|
+
payload["client_sessions"] = sorted(target_sessions)
|
|
118
130
|
await self.control_channel.send(payload)
|
|
119
131
|
|
|
120
132
|
|
|
@@ -130,8 +142,10 @@ class CodexChatManager:
|
|
|
130
142
|
self._thread_project: Dict[str, str] = {}
|
|
131
143
|
self._cwd_project: Dict[str, str] = {}
|
|
132
144
|
self._thread_active_turn: Dict[str, str] = {}
|
|
133
|
-
self._thread_completed_turn: Dict[str, Dict[str, Any]] = {}
|
|
134
145
|
self._thread_sessions: Dict[str, set[str]] = {}
|
|
146
|
+
self._activity: Dict[str, Dict[str, Any]] = {}
|
|
147
|
+
self._activity_revision = 0
|
|
148
|
+
self._activity_lock = asyncio.Lock()
|
|
135
149
|
# Materialized in-progress items live with the device agent, not a
|
|
136
150
|
# browser websocket. New/reconnected tabs receive these on resume.
|
|
137
151
|
self._thread_live_items: Dict[str, Dict[str, Dict[str, Any]]] = {}
|
|
@@ -144,12 +158,43 @@ class CodexChatManager:
|
|
|
144
158
|
"""Rebind outbound transport after reconnect without changing Codex state."""
|
|
145
159
|
self.sender.control_channel = control_channel
|
|
146
160
|
self.sender.context = context
|
|
161
|
+
self._thread_sessions.clear()
|
|
162
|
+
|
|
163
|
+
async def publish_activity(self, thread_id=None) -> None:
|
|
164
|
+
"""Send compact state only when the server explicitly subscribes to it."""
|
|
165
|
+
if not self.sender.context.get("codex_activity_subscription"):
|
|
166
|
+
return
|
|
167
|
+
async with self._activity_lock:
|
|
168
|
+
self._activity_revision += 1
|
|
169
|
+
await self.sender.control_channel.send({
|
|
170
|
+
"event": "codex_activity",
|
|
171
|
+
"revision": self._activity_revision,
|
|
172
|
+
"complete": thread_id is None,
|
|
173
|
+
"threads": copy.deepcopy([self._activity[thread_id]] if thread_id else list(self._activity.values())),
|
|
174
|
+
})
|
|
175
|
+
|
|
176
|
+
def _remember_activity(self, thread_id, project_id, method, params):
|
|
177
|
+
turn = params.get("turn") or {}
|
|
178
|
+
turn_id = params.get("turnId") or turn.get("id")
|
|
179
|
+
self._activity.pop(thread_id, None)
|
|
180
|
+
self._activity[thread_id] = {
|
|
181
|
+
"event": "codex_event", "project_id": project_id,
|
|
182
|
+
"notification": {"method": method, "params": {
|
|
183
|
+
"threadId": thread_id, "turnId": turn_id,
|
|
184
|
+
"turn": {"id": turn_id, "status": turn.get("status"),
|
|
185
|
+
"error": bool(turn.get("error"))},
|
|
186
|
+
}},
|
|
187
|
+
}
|
|
188
|
+
completed = [key for key in self._activity if key not in self._thread_active_turn]
|
|
189
|
+
for key in completed[:-100]:
|
|
190
|
+
self._activity.pop(key, None)
|
|
147
191
|
|
|
148
192
|
async def _on_bridge_exit(self, returncode: Optional[int]) -> None:
|
|
149
193
|
"""Turn an app-server crash into terminal events for waiting browsers."""
|
|
150
194
|
active = list(self._thread_active_turn.items())
|
|
151
195
|
self._thread_active_turn.clear()
|
|
152
196
|
for thread_id, turn_id in active:
|
|
197
|
+
self._thread_live_items.pop(thread_id, None)
|
|
153
198
|
project_id = self._thread_project.get(thread_id)
|
|
154
199
|
if not project_id:
|
|
155
200
|
continue
|
|
@@ -162,6 +207,8 @@ class CodexChatManager:
|
|
|
162
207
|
"additionalDetails": "Portacode is restarting it. Retry the message after it reconnects.",
|
|
163
208
|
},
|
|
164
209
|
}
|
|
210
|
+
self._remember_activity(thread_id, project_id, "error", params)
|
|
211
|
+
await self.publish_activity(thread_id)
|
|
165
212
|
await self.sender.send(
|
|
166
213
|
{
|
|
167
214
|
"event": "codex_event",
|
|
@@ -191,6 +238,9 @@ class CodexChatManager:
|
|
|
191
238
|
thread_id = params.get("threadId") or (params.get("thread") or {}).get("id")
|
|
192
239
|
turn = params.get("turn") if isinstance(params.get("turn"), dict) else {}
|
|
193
240
|
turn_id = params.get("turnId") or turn.get("id")
|
|
241
|
+
if (thread_id and method in {"turn/completed", "error"} and turn_id
|
|
242
|
+
and self._thread_active_turn.get(str(thread_id)) not in {None, str(turn_id)}):
|
|
243
|
+
return
|
|
194
244
|
if thread_id and method == "turn/started" and turn_id:
|
|
195
245
|
self._thread_active_turn[str(thread_id)] = str(turn_id)
|
|
196
246
|
self._thread_live_items[str(thread_id)] = {}
|
|
@@ -200,14 +250,10 @@ class CodexChatManager:
|
|
|
200
250
|
oldest = next(key for key in self._thread_live_items if key != str(thread_id))
|
|
201
251
|
self._thread_live_items.pop(oldest, None)
|
|
202
252
|
elif thread_id and method == "turn/completed":
|
|
203
|
-
self._thread_completed_turn[str(thread_id)] = {
|
|
204
|
-
"id": str(turn_id) if turn_id else None,
|
|
205
|
-
"items": self.live_items(str(thread_id)),
|
|
206
|
-
}
|
|
207
|
-
while len(self._thread_completed_turn) > MAX_TRACKED_LIVE_THREADS:
|
|
208
|
-
self._thread_completed_turn.pop(next(iter(self._thread_completed_turn)))
|
|
209
253
|
self._thread_active_turn.pop(str(thread_id), None)
|
|
210
|
-
#
|
|
254
|
+
# Durable history is authoritative once a turn completes. Keeping
|
|
255
|
+
# its reconnect snapshot would make resume return the same turn in
|
|
256
|
+
# both `items` and `liveItems`.
|
|
211
257
|
self._thread_live_items.pop(str(thread_id), None)
|
|
212
258
|
elif thread_id and method == "error" and not params.get("willRetry"):
|
|
213
259
|
self._thread_active_turn.pop(str(thread_id), None)
|
|
@@ -227,6 +273,11 @@ class CodexChatManager:
|
|
|
227
273
|
"notification": {"method": method, "params": params},
|
|
228
274
|
"project_id": project_id,
|
|
229
275
|
}
|
|
276
|
+
if thread_id and method in {"turn/started", "turn/completed", "error"} and not params.get("willRetry"):
|
|
277
|
+
self._remember_activity(str(thread_id), project_id, method, params)
|
|
278
|
+
await self.publish_activity(str(thread_id))
|
|
279
|
+
if self.sender.context.get("codex_activity_subscription"):
|
|
280
|
+
event_payload["activity_reported"] = True
|
|
230
281
|
await self.sender.send(
|
|
231
282
|
event_payload,
|
|
232
283
|
project_id=project_id,
|
|
@@ -822,12 +873,11 @@ class CodexThreadResumeHandler(CodexAsyncHandler):
|
|
|
822
873
|
already_active=str(thread_id) in manager._thread_active_turn,
|
|
823
874
|
)
|
|
824
875
|
thread = _thread_from_result(resume_result)
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
active_turn = {"id": known_turn_id, "status": "inProgress"}
|
|
876
|
+
if not active_turn:
|
|
877
|
+
known_turn_id = manager._thread_active_turn.get(str(thread_id))
|
|
878
|
+
if known_turn_id:
|
|
879
|
+
active_turn = {"id": known_turn_id, "status": "inProgress"}
|
|
880
|
+
|
|
831
881
|
live_items = manager.live_items(thread_id) if active_turn else []
|
|
832
882
|
# During an active reconnect the live snapshot is the authoritative
|
|
833
883
|
# representation of that turn. Do not also send its possibly partial
|
|
@@ -848,13 +898,7 @@ class CodexThreadResumeHandler(CodexAsyncHandler):
|
|
|
848
898
|
"thread": thread,
|
|
849
899
|
"items": items,
|
|
850
900
|
"liveItems": live_items,
|
|
851
|
-
"syncId": message.get("syncId"),
|
|
852
901
|
}
|
|
853
|
-
completed = manager._thread_completed_turn.get(str(thread_id))
|
|
854
|
-
if completed and not active_turn:
|
|
855
|
-
payload["completedTurnId"] = completed["id"]
|
|
856
|
-
# Recover the tail even if durable history has not flushed yet.
|
|
857
|
-
payload["completedItems"] = completed["items"]
|
|
858
902
|
if active_turn:
|
|
859
903
|
payload["activeTurn"] = active_turn
|
|
860
904
|
active_turn_id = active_turn.get("id") or active_turn.get("turnId")
|
|
@@ -924,8 +968,16 @@ class CodexTurnStartHandler(CodexAsyncHandler):
|
|
|
924
968
|
result = await manager.bridge.call("turn/start", params)
|
|
925
969
|
turn = _turn_from_result(result)
|
|
926
970
|
turn_id = turn.get("id") or turn.get("turnId")
|
|
927
|
-
|
|
971
|
+
activity = manager._activity.get(str(thread_id), {}).get("notification", {})
|
|
972
|
+
already_finished = (activity.get("method") in {"turn/completed", "error"}
|
|
973
|
+
and activity.get("params", {}).get("turnId") == turn_id)
|
|
974
|
+
if turn_id and not already_finished:
|
|
928
975
|
manager._thread_active_turn[str(thread_id)] = str(turn_id)
|
|
976
|
+
if activity.get("params", {}).get("turnId") != turn_id and project_id:
|
|
977
|
+
manager._remember_activity(str(thread_id), project_id, "turn/started", {
|
|
978
|
+
"threadId": thread_id, "turnId": turn_id,
|
|
979
|
+
})
|
|
980
|
+
await manager.publish_activity(str(thread_id))
|
|
929
981
|
|
|
930
982
|
payload = {
|
|
931
983
|
"event": "codex_turn_started",
|
|
@@ -423,7 +423,10 @@ def _get_cloudflare_forwarding_state() -> Dict[str, Any]:
|
|
|
423
423
|
destination = entry.get("destination")
|
|
424
424
|
if not hostname or not destination:
|
|
425
425
|
continue
|
|
426
|
-
|
|
426
|
+
rule = {"hostname": hostname, "destination": destination}
|
|
427
|
+
if "access" in entry:
|
|
428
|
+
rule["access"] = entry["access"]
|
|
429
|
+
rules.append(rule)
|
|
427
430
|
return {"rules": rules, "updated_at": state.get("updated_at")}
|
|
428
431
|
|
|
429
432
|
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import json
|
|
2
|
+
import tempfile
|
|
3
|
+
import unittest
|
|
4
|
+
from pathlib import Path
|
|
5
|
+
from unittest.mock import MagicMock, patch
|
|
6
|
+
|
|
7
|
+
import yaml
|
|
8
|
+
|
|
9
|
+
from portacode.tunneling import access
|
|
10
|
+
from portacode.connection.handlers import cloudflare_forwarding as forwarding
|
|
11
|
+
from portacode.connection.handlers.system_handlers import _get_cloudflare_forwarding_state
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
class AccessTests(unittest.TestCase):
|
|
15
|
+
def rule(self, **extra):
|
|
16
|
+
return {"hostname": "app.example.com", "destination": "http://localhost:80", **extra}
|
|
17
|
+
|
|
18
|
+
def protected(self):
|
|
19
|
+
return {"mode": "managed", "emails": ["a@example.com"], "managed_id": "app-id",
|
|
20
|
+
"application_id": "app-id", "team_name": "team", "aud_tag": ["aud"]}
|
|
21
|
+
|
|
22
|
+
def test_validates_policy_and_drops_untrusted_metadata(self):
|
|
23
|
+
value = access.normalize_access({**self.protected(), "team_name": "attacker"})
|
|
24
|
+
self.assertEqual(value, {"mode": "managed", "emails": ["a@example.com"]})
|
|
25
|
+
for value in ({"mode": "managed", "emails": []}, {"mode": "managed", "emails": ["bad"]}, {"mode": "existing", "application_id": "../../apps"}, {"mode": "unknown"}):
|
|
26
|
+
with self.assertRaises(ValueError):
|
|
27
|
+
access.normalize_access(value)
|
|
28
|
+
|
|
29
|
+
@patch.object(access, "AccessClient")
|
|
30
|
+
def test_unchanged_and_omitted_settings_survive_without_api(self, client):
|
|
31
|
+
previous = [self.rule(access=self.protected())]
|
|
32
|
+
for rules in ([self.rule()], [self.rule(access=self.protected())]):
|
|
33
|
+
access.prepare_access(rules, previous, {})
|
|
34
|
+
self.assertEqual(rules[0]["access"], self.protected())
|
|
35
|
+
client.assert_not_called()
|
|
36
|
+
|
|
37
|
+
@patch.object(access, "AccessClient")
|
|
38
|
+
def test_removal_and_off_never_delete_cloudflare_apps(self, client):
|
|
39
|
+
access.prepare_access([], [self.rule(access=self.protected())], {})
|
|
40
|
+
rules = [self.rule(access={"mode": "off"})]
|
|
41
|
+
access.prepare_access(rules, [self.rule(access=self.protected())], {})
|
|
42
|
+
self.assertEqual(rules[0]["access"], {"mode": "off"})
|
|
43
|
+
client.assert_not_called()
|
|
44
|
+
|
|
45
|
+
@patch.object(access, "AccessClient")
|
|
46
|
+
def test_existing_app_must_match_hostname_and_type(self, client):
|
|
47
|
+
api = client.return_value
|
|
48
|
+
for app in ({"domain": "other.example.com", "type": "self_hosted"}, {"domain": "app.example.com/private", "type": "self_hosted"}, {"domain": "app.example.com", "type": "saas"}):
|
|
49
|
+
api.request.side_effect = [{"auth_domain": "team.cloudflareaccess.com"}, app]
|
|
50
|
+
with self.assertRaises(ValueError):
|
|
51
|
+
access.prepare_access([self.rule(access={"mode": "existing", "application_id": "id"})], [], {})
|
|
52
|
+
|
|
53
|
+
@patch.object(access, "AccessClient")
|
|
54
|
+
def test_existing_app_uses_verified_audience(self, client):
|
|
55
|
+
api = client.return_value
|
|
56
|
+
api.request.side_effect = [{"auth_domain": "team.cloudflareaccess.com"}, {"id": "id", "domain": "app.example.com", "type": "self_hosted", "aud": "real"}]
|
|
57
|
+
rules = [self.rule(access={"mode": "existing", "application_id": "id", "aud_tag": ["fake"]})]
|
|
58
|
+
access.prepare_access(rules, [], {})
|
|
59
|
+
self.assertEqual(rules[0]["access"]["aud_tag"], ["real"])
|
|
60
|
+
self.assertTrue(all(c.args[0] == "GET" for c in api.request.call_args_list))
|
|
61
|
+
|
|
62
|
+
@patch.object(access, "AccessClient")
|
|
63
|
+
def test_managed_creation_and_update(self, client):
|
|
64
|
+
api = client.return_value
|
|
65
|
+
api.list.side_effect = [[{"type": "onetimepin"}], []]
|
|
66
|
+
api.request.side_effect = [{"auth_domain": "team.cloudflareaccess.com"}, {"id": "new", "aud": "aud"}]
|
|
67
|
+
rules = [self.rule(access={"mode": "managed", "emails": ["a@example.com"]})]
|
|
68
|
+
access.prepare_access(rules, [], {})
|
|
69
|
+
self.assertEqual(api.request.call_args.args[:2], ("POST", "/apps"))
|
|
70
|
+
self.assertEqual(api.request.call_args.args[2]["policies"][0]["decision"], "allow")
|
|
71
|
+
self.assertEqual(rules[0]["access"]["managed_id"], "new")
|
|
72
|
+
previous = [self.rule(access=self.protected())]
|
|
73
|
+
api.list.side_effect = [[{"type": "onetimepin"}], [{"id": "app-id", "domain": "app.example.com"}]]
|
|
74
|
+
api.request.side_effect = [{"auth_domain": "team.cloudflareaccess.com"}, {"id": "app-id", "aud": "aud"}]
|
|
75
|
+
access.prepare_access([self.rule(access={"mode": "managed", "emails": ["b@example.com"]})], previous, {})
|
|
76
|
+
self.assertEqual(api.request.call_args.args[:2], ("PUT", "/apps/app-id"))
|
|
77
|
+
|
|
78
|
+
@patch.object(access, "AccessClient")
|
|
79
|
+
def test_existing_external_application_not_overwritten(self, client):
|
|
80
|
+
api = client.return_value
|
|
81
|
+
api.request.return_value = {"auth_domain": "team.cloudflareaccess.com"}
|
|
82
|
+
api.list.side_effect = [[{"type": "onetimepin"}], [{"id": "external", "domain": "app.example.com"}]]
|
|
83
|
+
with self.assertRaisesRegex(ValueError, "already exists"):
|
|
84
|
+
access.prepare_access([self.rule(access=self.protected())], [], {})
|
|
85
|
+
self.assertEqual(api.request.call_count, 1)
|
|
86
|
+
|
|
87
|
+
@patch.object(access, "AccessClient")
|
|
88
|
+
def test_permission_and_setup_states_distinguished(self, client):
|
|
89
|
+
for status in ("permissions_required", "organization_missing", "unavailable"):
|
|
90
|
+
client.side_effect = access.AccessError(status, "Safe message")
|
|
91
|
+
result = access.inspect_access({})
|
|
92
|
+
self.assertEqual(result["status"], status)
|
|
93
|
+
self.assertFalse(result["ready"])
|
|
94
|
+
|
|
95
|
+
@patch.object(access, "AccessClient")
|
|
96
|
+
def test_login_missing_and_otp_idempotence(self, client):
|
|
97
|
+
api = client.return_value
|
|
98
|
+
api.request.return_value = {"auth_domain": "team.cloudflareaccess.com"}
|
|
99
|
+
api.list.return_value = []
|
|
100
|
+
self.assertEqual(access.inspect_access({})["status"], "login_required")
|
|
101
|
+
api.list.return_value = [{"type": "onetimepin"}]
|
|
102
|
+
with patch.object(access, "inspect_access", return_value={"ready": True}):
|
|
103
|
+
access.enable_otp({})
|
|
104
|
+
self.assertFalse(any(c.args[0] == "POST" for c in api.request.call_args_list))
|
|
105
|
+
|
|
106
|
+
def test_config_contains_nested_jwt_validation(self):
|
|
107
|
+
rules = forwarding._normalize_rules([self.rule(access=self.protected())], "example.com", from_storage=True)
|
|
108
|
+
entries = forwarding._build_ingress_entries(rules, None, None)
|
|
109
|
+
with tempfile.TemporaryDirectory() as directory:
|
|
110
|
+
config = Path(directory) / "config.yml"
|
|
111
|
+
creds = Path(directory) / "credentials.json"
|
|
112
|
+
creds.write_text("{}")
|
|
113
|
+
forwarding._write_cloudflared_config({"tunnel_id": "id", "credentials_file": str(creds), "config_path": str(config)}, entries)
|
|
114
|
+
result = yaml.safe_load(config.read_text())
|
|
115
|
+
self.assertEqual(result["ingress"][0]["originRequest"]["access"], {"required": True, "teamName": "team", "audTag": ["aud"]})
|
|
116
|
+
|
|
117
|
+
def test_system_info_retains_access(self):
|
|
118
|
+
with patch("portacode.connection.handlers.system_handlers.load_forwarding_state", return_value={"rules": [self.rule(access=self.protected())]}):
|
|
119
|
+
self.assertEqual(_get_cloudflare_forwarding_state()["rules"][0]["access"], self.protected())
|
|
120
|
+
|
|
121
|
+
def test_token_saved_with_private_permissions(self):
|
|
122
|
+
with tempfile.TemporaryDirectory() as directory, patch.object(access, "CONFIG_DIR", Path(directory)), patch.object(access, "TOKEN_PATH", Path(directory) / "token"):
|
|
123
|
+
access.save_token("test-token")
|
|
124
|
+
self.assertEqual(access.TOKEN_PATH.stat().st_mode & 0o777, 0o600)
|
|
125
|
+
|
|
126
|
+
@patch.object(forwarding, "_write_cloudflared_config")
|
|
127
|
+
@patch.object(forwarding, "load_forwarding_state", return_value={"rules": []})
|
|
128
|
+
def test_manual_protection_cannot_be_silently_overwritten(self, state, write):
|
|
129
|
+
with tempfile.TemporaryDirectory() as directory:
|
|
130
|
+
config = Path(directory) / "config.yml"
|
|
131
|
+
config.write_text('ingress:\n- hostname: app.example.com\n originRequest:\n access:\n required: true\n')
|
|
132
|
+
with self.assertRaisesRegex(ValueError, "Manually configured"):
|
|
133
|
+
forwarding._apply_and_persist_forwarding_rules([], tunnel_state={"domain": "example.com", "tunnel_name": "test", "config_path": str(config)})
|
|
134
|
+
write.assert_not_called()
|
|
135
|
+
|
|
136
|
+
@patch.object(forwarding, "prepare_access", side_effect=access.AccessError("unavailable", "Unavailable"))
|
|
137
|
+
@patch.object(forwarding, "_write_cloudflared_config")
|
|
138
|
+
@patch.object(forwarding, "load_forwarding_state", return_value={"rules": []})
|
|
139
|
+
def test_provision_failure_does_not_publish_route(self, state, write, prepare):
|
|
140
|
+
with tempfile.TemporaryDirectory() as directory:
|
|
141
|
+
with self.assertRaises(access.AccessError):
|
|
142
|
+
forwarding._apply_and_persist_forwarding_rules([], tunnel_state={"domain": "example.com", "tunnel_name": "test", "config_path": str(Path(directory) / "config")})
|
|
143
|
+
write.assert_not_called()
|
|
@@ -196,7 +196,7 @@ class CloudflareForwardingEnvTests(TestCase):
|
|
|
196
196
|
):
|
|
197
197
|
with tempfile.TemporaryDirectory() as tmp:
|
|
198
198
|
config_path = Path(tmp) / "config.yml"
|
|
199
|
-
config_path.write_text("previous config\n", encoding="utf-8")
|
|
199
|
+
config_path.write_text("ingress: [] # previous config\n", encoding="utf-8")
|
|
200
200
|
mock_build.return_value = [{"hostname": "new.example.com", "service": "http://10.0.0.2"}]
|
|
201
201
|
tunnel = {
|
|
202
202
|
"domain": "example.com",
|
|
@@ -209,7 +209,7 @@ class CloudflareForwardingEnvTests(TestCase):
|
|
|
209
209
|
with self.assertRaisesRegex(RuntimeError, "DNS failed"):
|
|
210
210
|
_apply_and_persist_forwarding_rules([], tunnel_state=tunnel)
|
|
211
211
|
|
|
212
|
-
self.assertEqual(config_path.read_text(encoding="utf-8"), "previous config\n")
|
|
212
|
+
self.assertEqual(config_path.read_text(encoding="utf-8"), "ingress: [] # previous config\n")
|
|
213
213
|
mock_reload.assert_called_once()
|
|
214
214
|
mock_persist.assert_not_called()
|
|
215
215
|
|
portacode/connection/terminal.py
CHANGED
|
@@ -85,6 +85,7 @@ from .handlers import (
|
|
|
85
85
|
RollbackProxmoxContainerSnapshotHandler,
|
|
86
86
|
CloudflareTunnelSetupHandler,
|
|
87
87
|
CloudflareForwardingHandler,
|
|
88
|
+
CloudflareAccessHandler,
|
|
88
89
|
ConfigureProxmoxContainerExposePortsHandler,
|
|
89
90
|
AutomationV2StartHandler,
|
|
90
91
|
AutomationV2StateHandler,
|
|
@@ -478,6 +479,8 @@ class TerminalManager:
|
|
|
478
479
|
|
|
479
480
|
def _set_mux(self, mux: Multiplexer, is_initial: bool = False) -> None:
|
|
480
481
|
self.mux = mux
|
|
482
|
+
self._client_sessions_revision = -1
|
|
483
|
+
self._client_session_manager.update_sessions([])
|
|
481
484
|
self._control_channel = self.mux.get_channel(self.CONTROL_CHANNEL_ID)
|
|
482
485
|
|
|
483
486
|
# Only create new session manager on initial setup, preserve existing one on reconnection
|
|
@@ -511,6 +514,7 @@ class TerminalManager:
|
|
|
511
514
|
if manager is not None:
|
|
512
515
|
manager.rebind_transport(self._control_channel, self._context)
|
|
513
516
|
self._guest_host_request_results: Dict[str, Dict[str, Any]] = {}
|
|
517
|
+
self._context["codex_activity_subscription"] = False
|
|
514
518
|
|
|
515
519
|
# Initialize command registry
|
|
516
520
|
self._command_registry = CommandRegistry(self._control_channel, self._context)
|
|
@@ -628,6 +632,7 @@ class TerminalManager:
|
|
|
628
632
|
self._command_registry.register(RevertProxmoxInfraHandler)
|
|
629
633
|
self._command_registry.register(CloudflareTunnelSetupHandler)
|
|
630
634
|
self._command_registry.register(CloudflareForwardingHandler)
|
|
635
|
+
self._command_registry.register(CloudflareAccessHandler)
|
|
631
636
|
self._command_registry.register(ConfigureProxmoxContainerExposePortsHandler)
|
|
632
637
|
self._command_registry.register(UpdatePortacodeHandler)
|
|
633
638
|
self._command_registry.register(AutomationV2StartHandler)
|
|
@@ -683,10 +688,28 @@ class TerminalManager:
|
|
|
683
688
|
|
|
684
689
|
# Handle client sessions update directly (special case)
|
|
685
690
|
if cmd == "client_sessions_update":
|
|
691
|
+
revision = message.get("revision")
|
|
692
|
+
if isinstance(revision, int):
|
|
693
|
+
if revision <= self._client_sessions_revision:
|
|
694
|
+
continue
|
|
695
|
+
self._client_sessions_revision = revision
|
|
686
696
|
sessions = message.get("sessions", [])
|
|
687
697
|
logger.info("terminal_manager: 🔔 RECEIVED client_sessions_update with %d sessions", len(sessions))
|
|
688
698
|
logger.debug("terminal_manager: Session details: %s", sessions)
|
|
689
699
|
newly_added_sessions = self._client_session_manager.update_sessions(sessions)
|
|
700
|
+
subscribed = self._context.get("codex_activity_subscription")
|
|
701
|
+
self._context["codex_activity_subscription"] = message.get("codex_activity_subscription") is True
|
|
702
|
+
manager = self._context.get("codex_manager")
|
|
703
|
+
if manager is None and self._context["codex_activity_subscription"]:
|
|
704
|
+
from .handlers.codex_handlers import CodexChatManager
|
|
705
|
+
manager = CodexChatManager(self._control_channel, self._context)
|
|
706
|
+
self._context["codex_manager"] = manager
|
|
707
|
+
if manager is not None:
|
|
708
|
+
live = self._client_session_manager.get_sessions()
|
|
709
|
+
for names in manager._thread_sessions.values():
|
|
710
|
+
names.intersection_update(live)
|
|
711
|
+
if not subscribed:
|
|
712
|
+
await manager.publish_activity()
|
|
690
713
|
logger.info("terminal_manager: ✅ Updated client sessions (%d sessions)", len(sessions))
|
|
691
714
|
|
|
692
715
|
# Auto-send initial data only to newly added clients
|
|
@@ -41,7 +41,11 @@ def test_delegated_codex_allows_non_git_project_folders():
|
|
|
41
41
|
|
|
42
42
|
class DummyClientSessionManager:
|
|
43
43
|
def __init__(self, sessions: list[str] | None = None):
|
|
44
|
-
self.sessions =
|
|
44
|
+
self.sessions = ["sess-1"] if sessions is None else sessions
|
|
45
|
+
self.selected = "th-1"
|
|
46
|
+
|
|
47
|
+
def get_sessions(self):
|
|
48
|
+
return {name: {"codex_thread_id": self.selected} for name in self.sessions}
|
|
45
49
|
|
|
46
50
|
def has_interested_clients(self) -> bool:
|
|
47
51
|
return bool(self.sessions)
|
|
@@ -61,6 +65,57 @@ class DummyControlChannel:
|
|
|
61
65
|
self.sent.append(payload)
|
|
62
66
|
|
|
63
67
|
|
|
68
|
+
@pytest.mark.asyncio
|
|
69
|
+
async def test_unwatched_stream_is_local_but_server_receives_compact_activity():
|
|
70
|
+
channel = DummyControlChannel()
|
|
71
|
+
context = {"client_session_manager": DummyClientSessionManager([]),
|
|
72
|
+
"codex_activity_subscription": True}
|
|
73
|
+
manager = CodexChatManager(channel, context)
|
|
74
|
+
manager.record_thread("th-1", "/tmp/proj", "p-1")
|
|
75
|
+
manager.subscribe_thread("th-1", "closed-tab")
|
|
76
|
+
await manager._on_notification("turn/started", {"threadId": "th-1", "turnId": "turn-1"})
|
|
77
|
+
await manager._on_notification("item/agentMessage/delta", {
|
|
78
|
+
"threadId": "th-1", "itemId": "item-1", "delta": "private transcript",
|
|
79
|
+
})
|
|
80
|
+
assert [message["event"] for message in channel.sent] == ["codex_activity"]
|
|
81
|
+
assert "private transcript" not in str(channel.sent)
|
|
82
|
+
assert manager.live_items("th-1")[0]["text"] == "private transcript"
|
|
83
|
+
await manager._on_notification("turn/completed", {
|
|
84
|
+
"threadId": "th-1", "turn": {"id": "turn-1", "status": "completed"},
|
|
85
|
+
})
|
|
86
|
+
assert len(channel.sent) == 2
|
|
87
|
+
assert channel.sent[-1]["threads"][0]["notification"]["method"] == "turn/completed"
|
|
88
|
+
replacement = DummyControlChannel()
|
|
89
|
+
manager.rebind_transport(replacement, context)
|
|
90
|
+
await manager.publish_activity()
|
|
91
|
+
assert replacement.sent[0]["revision"] > channel.sent[-1]["revision"]
|
|
92
|
+
assert replacement.sent[0]["threads"] == channel.sent[-1]["threads"]
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
@pytest.mark.asyncio
|
|
96
|
+
async def test_thread_switch_and_explicit_close_override_remembered_subscription():
|
|
97
|
+
channel = DummyControlChannel()
|
|
98
|
+
sessions = DummyClientSessionManager()
|
|
99
|
+
manager = CodexChatManager(channel, {"client_session_manager": sessions})
|
|
100
|
+
manager.record_thread("th-1", "/tmp/proj", "p-1")
|
|
101
|
+
manager.subscribe_thread("th-1", "sess-1")
|
|
102
|
+
for selected in ["other-thread", None]:
|
|
103
|
+
sessions.selected = selected
|
|
104
|
+
await manager._on_notification("item/agentMessage/delta", {"threadId": "th-1", "delta": "hidden"})
|
|
105
|
+
assert channel.sent == []
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
@pytest.mark.asyncio
|
|
109
|
+
async def test_activity_requires_server_subscription_and_old_completion_cannot_end_new_turn():
|
|
110
|
+
channel = DummyControlChannel()
|
|
111
|
+
manager = CodexChatManager(channel, {"client_session_manager": DummyClientSessionManager([])})
|
|
112
|
+
manager.record_thread("th-1", "/tmp/proj", "p-1")
|
|
113
|
+
await manager._on_notification("turn/started", {"threadId": "th-1", "turnId": "new-turn"})
|
|
114
|
+
await manager._on_notification("turn/completed", {"threadId": "th-1", "turnId": "old-turn"})
|
|
115
|
+
assert manager._thread_active_turn == {"th-1": "new-turn"}
|
|
116
|
+
assert channel.sent == []
|
|
117
|
+
|
|
118
|
+
|
|
64
119
|
def test_codex_manager_rebind_transport_preserves_bridge_and_state():
|
|
65
120
|
old_channel = DummyControlChannel()
|
|
66
121
|
new_channel = DummyControlChannel()
|
|
@@ -543,7 +598,7 @@ async def test_notification_forwarding_targets_project():
|
|
|
543
598
|
|
|
544
599
|
|
|
545
600
|
@pytest.mark.asyncio
|
|
546
|
-
async def
|
|
601
|
+
async def test_remembered_session_cannot_bypass_live_registry():
|
|
547
602
|
channel = DummyControlChannel()
|
|
548
603
|
context = _context()
|
|
549
604
|
manager = CodexChatManager(channel, context)
|
|
@@ -555,7 +610,7 @@ async def test_resumed_thread_events_include_new_tab_before_session_registry_upd
|
|
|
555
610
|
{"threadId": "th-1", "delta": "live"},
|
|
556
611
|
)
|
|
557
612
|
|
|
558
|
-
assert channel.sent[-1]["client_sessions"] == ["
|
|
613
|
+
assert channel.sent[-1]["client_sessions"] == ["sess-1"]
|
|
559
614
|
|
|
560
615
|
|
|
561
616
|
@pytest.mark.asyncio
|
|
@@ -653,20 +708,8 @@ async def test_completed_turn_snapshot_is_not_replayed_on_resume():
|
|
|
653
708
|
|
|
654
709
|
payload = channel.sent[-1]
|
|
655
710
|
assert payload["liveItems"] == []
|
|
656
|
-
assert payload["completedTurnId"] == "turn-1"
|
|
657
|
-
assert payload["completedItems"][0]["text"] == "hello"
|
|
658
711
|
assert [item["id"] for item in payload["items"]] == ["msg-1"]
|
|
659
712
|
|
|
660
|
-
await manager._on_notification("turn/started", {"threadId": "th-1", "turnId": "turn-2"})
|
|
661
|
-
await handler.handle({
|
|
662
|
-
"cmd": "codex_thread_resume", "project_id": "p-1",
|
|
663
|
-
"threadId": "th-1", "syncId": "recovery-2",
|
|
664
|
-
})
|
|
665
|
-
payload = channel.sent[-1]
|
|
666
|
-
assert payload["syncId"] == "recovery-2"
|
|
667
|
-
assert payload["activeTurn"]["id"] == "turn-2"
|
|
668
|
-
assert "completedTurnId" not in payload
|
|
669
|
-
|
|
670
713
|
|
|
671
714
|
@pytest.mark.asyncio
|
|
672
715
|
async def test_active_turn_history_is_not_duplicated_with_live_snapshot():
|
|
@@ -763,6 +806,7 @@ async def test_codex_turn_start_records_thread_mapping():
|
|
|
763
806
|
async def test_codex_turn_start_routes_notification_before_rpc_response():
|
|
764
807
|
channel = DummyControlChannel()
|
|
765
808
|
context = _context()
|
|
809
|
+
context["client_session_manager"].selected = "th-9"
|
|
766
810
|
manager = CodexChatManager(channel, context)
|
|
767
811
|
manager.bridge = FakeBridge()
|
|
768
812
|
context["codex_manager"] = manager
|
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
"""Cloudflare Access provisioning. Credentials stay on the tunnel device."""
|
|
2
|
+
from __future__ import annotations
|
|
3
|
+
|
|
4
|
+
import json
|
|
5
|
+
import os
|
|
6
|
+
import re
|
|
7
|
+
import tempfile
|
|
8
|
+
import urllib.error
|
|
9
|
+
import urllib.request
|
|
10
|
+
|
|
11
|
+
from .state import CONFIG_DIR, default_cert_path
|
|
12
|
+
from .get_domain import extract_token_json
|
|
13
|
+
|
|
14
|
+
TOKEN_PATH = CONFIG_DIR / "cloudflare_access_token"
|
|
15
|
+
SETUP_URL = "https://developers.cloudflare.com/cloudflare-one/setup/"
|
|
16
|
+
PERMISSIONS = "Access: Apps and Policies Write; Access: Organizations, Identity Providers, and Groups Write"
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
def _team_name(organization):
|
|
20
|
+
domain = str(organization.get("auth_domain") or "")
|
|
21
|
+
suffix = ".cloudflareaccess.com"
|
|
22
|
+
team = domain[:-len(suffix)] if domain.endswith(suffix) else ""
|
|
23
|
+
return team if re.fullmatch(r"[a-zA-Z0-9-]+", team) else ""
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
class AccessError(RuntimeError):
|
|
27
|
+
def __init__(self, status, message):
|
|
28
|
+
super().__init__(message)
|
|
29
|
+
self.status = status
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
def save_token(token):
|
|
33
|
+
token = token.strip()
|
|
34
|
+
if not token or re.search(r"\s", token):
|
|
35
|
+
raise ValueError("Enter a valid Cloudflare API token.")
|
|
36
|
+
CONFIG_DIR.mkdir(parents=True, exist_ok=True)
|
|
37
|
+
fd, name = tempfile.mkstemp(dir=CONFIG_DIR)
|
|
38
|
+
try:
|
|
39
|
+
with os.fdopen(fd, "w") as stream:
|
|
40
|
+
stream.write(token)
|
|
41
|
+
os.replace(name, TOKEN_PATH)
|
|
42
|
+
finally:
|
|
43
|
+
if os.path.exists(name):
|
|
44
|
+
os.unlink(name)
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
class AccessClient:
|
|
48
|
+
def __init__(self, state):
|
|
49
|
+
cert = extract_token_json(str(state.get("cert_path") or default_cert_path()))
|
|
50
|
+
self.account = str(cert.get("accountID") or "")
|
|
51
|
+
if not re.fullmatch(r"[a-fA-F0-9]{32}", self.account):
|
|
52
|
+
raise AccessError("account_missing", "Reconnect the domain to identify its Cloudflare account.")
|
|
53
|
+
self.token = TOKEN_PATH.read_text().strip() if TOKEN_PATH.exists() else cert.get("apiToken", "")
|
|
54
|
+
self.base = f"/accounts/{self.account}/access"
|
|
55
|
+
|
|
56
|
+
def request(self, method, path, payload=None):
|
|
57
|
+
request = urllib.request.Request(
|
|
58
|
+
"https://api.cloudflare.com/client/v4" + self.base + path,
|
|
59
|
+
data=json.dumps(payload).encode() if payload is not None else None,
|
|
60
|
+
headers={"Authorization": f"Bearer {self.token}", "Content-Type": "application/json"},
|
|
61
|
+
method=method,
|
|
62
|
+
)
|
|
63
|
+
try:
|
|
64
|
+
with urllib.request.urlopen(request, timeout=10) as response:
|
|
65
|
+
data = json.load(response)
|
|
66
|
+
except urllib.error.HTTPError as exc:
|
|
67
|
+
if exc.code in (401, 403):
|
|
68
|
+
raise AccessError("permissions_required", "Authorize Access management with a Cloudflare API token on this device.") from None
|
|
69
|
+
if exc.code == 404 and path == "/organizations":
|
|
70
|
+
raise AccessError("organization_missing", "Complete Cloudflare Zero Trust onboarding and choose a team name.") from None
|
|
71
|
+
raise AccessError("api_error", f"Cloudflare rejected the Access operation (HTTP {exc.code}). Existing protection is retained.") from None
|
|
72
|
+
except (OSError, ValueError):
|
|
73
|
+
raise AccessError("unavailable", "Unable to verify Cloudflare Access. Check the connection and retry.") from None
|
|
74
|
+
if not data.get("success"):
|
|
75
|
+
raise AccessError("api_error", "Cloudflare could not complete the Access operation. Check account permissions and setup.")
|
|
76
|
+
return data.get("result")
|
|
77
|
+
|
|
78
|
+
def list(self, path):
|
|
79
|
+
items = []
|
|
80
|
+
for page in range(1, 101):
|
|
81
|
+
batch = self.request("GET", f"{path}?page={page}&per_page=100") or []
|
|
82
|
+
items.extend(batch)
|
|
83
|
+
if len(batch) < 100:
|
|
84
|
+
return items
|
|
85
|
+
raise AccessError("unavailable", "Too many Access resources to safely inspect this account.")
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
def inspect_access(state):
|
|
89
|
+
try:
|
|
90
|
+
client = AccessClient(state)
|
|
91
|
+
org = client.request("GET", "/organizations") or {}
|
|
92
|
+
team = _team_name(org)
|
|
93
|
+
if not team:
|
|
94
|
+
raise AccessError("organization_missing", "Complete Cloudflare Zero Trust onboarding and choose a team name.")
|
|
95
|
+
providers = client.list("/identity_providers")
|
|
96
|
+
apps = client.list("/apps")
|
|
97
|
+
return {"status": "ready" if providers else "login_required", "ready": bool(providers),
|
|
98
|
+
"message": "Access is available. Saving protection requires Access write permissions." if providers else "Configure a login method in Cloudflare, or enable email PIN below.",
|
|
99
|
+
"team_name": team, "can_enable_otp": True,
|
|
100
|
+
"applications": [{"id": a["id"], "name": a.get("name", ""), "domain": a.get("domain", "")} for a in apps if a.get("type") == "self_hosted"],
|
|
101
|
+
"setup_url": SETUP_URL, "permissions": PERMISSIONS}
|
|
102
|
+
except (AccessError, RuntimeError, OSError) as exc:
|
|
103
|
+
return {"status": getattr(exc, "status", "unavailable"), "ready": False,
|
|
104
|
+
"message": str(exc), "setup_url": SETUP_URL, "permissions": PERMISSIONS}
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
def normalize_access(value):
|
|
108
|
+
if value is None:
|
|
109
|
+
raise ValueError("Access settings cannot be null; use an explicit mode.")
|
|
110
|
+
if not isinstance(value, dict) or value.get("mode") not in ("off", "existing", "managed"):
|
|
111
|
+
raise ValueError("Access mode must be off, existing, or managed.")
|
|
112
|
+
mode = value["mode"]
|
|
113
|
+
if mode == "off":
|
|
114
|
+
return {"mode": mode}
|
|
115
|
+
if mode == "existing":
|
|
116
|
+
app_id = str(value.get("application_id") or "")
|
|
117
|
+
if not re.fullmatch(r"[a-zA-Z0-9-]{1,64}", app_id):
|
|
118
|
+
raise ValueError("Choose an existing Access application.")
|
|
119
|
+
return {"mode": mode, "application_id": app_id}
|
|
120
|
+
emails = value.get("emails")
|
|
121
|
+
if not isinstance(emails, list) or not 1 <= len(emails) <= 100:
|
|
122
|
+
raise ValueError("Enter between 1 and 100 allowed email addresses.")
|
|
123
|
+
emails = sorted(set(str(e).strip().lower() for e in emails))
|
|
124
|
+
if any(not re.fullmatch(r"[^\s@]+@[^\s@]+\.[^\s@]+", e) or len(e) > 254 for e in emails):
|
|
125
|
+
raise ValueError("Enter valid allowed email addresses.")
|
|
126
|
+
return {"mode": mode, "emails": emails}
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
def prepare_access(rules, previous, state):
|
|
130
|
+
"""Provision before routing; never trust client-supplied ownership or AUDs.
|
|
131
|
+
|
|
132
|
+
Apps are intentionally retained on route removal/off, so a failure or a
|
|
133
|
+
shared hostname cannot accidentally become public. Deletion is explicit in
|
|
134
|
+
Cloudflare; the UI explains this contract.
|
|
135
|
+
"""
|
|
136
|
+
old = {r["hostname"]: r.get("access") for r in previous}
|
|
137
|
+
by_host = {}
|
|
138
|
+
client = None
|
|
139
|
+
for rule in rules:
|
|
140
|
+
requested = rule.get("access", old.get(rule["hostname"]))
|
|
141
|
+
if requested is None:
|
|
142
|
+
continue
|
|
143
|
+
desired = normalize_access(requested)
|
|
144
|
+
host = rule["hostname"]
|
|
145
|
+
if host in by_host:
|
|
146
|
+
if normalize_access(by_host[host]) != desired:
|
|
147
|
+
raise ValueError("All routes for one hostname must use the same Access settings.")
|
|
148
|
+
rule["access"] = by_host[host]
|
|
149
|
+
continue
|
|
150
|
+
prior = old.get(host) or {}
|
|
151
|
+
if desired["mode"] == "off":
|
|
152
|
+
rule["access"] = desired
|
|
153
|
+
elif prior and desired == normalize_access(prior):
|
|
154
|
+
# Offline/unrelated updates retain the known JWT enforcement.
|
|
155
|
+
if not prior.get("aud_tag") or not prior.get("team_name"):
|
|
156
|
+
raise ValueError("Existing Access metadata is incomplete; configure protection again.")
|
|
157
|
+
rule["access"] = dict(prior)
|
|
158
|
+
else:
|
|
159
|
+
client = client or AccessClient(state)
|
|
160
|
+
org = client.request("GET", "/organizations") or {}
|
|
161
|
+
team = _team_name(org)
|
|
162
|
+
if not team:
|
|
163
|
+
raise ValueError("Complete Zero Trust onboarding first.")
|
|
164
|
+
if desired["mode"] == "existing":
|
|
165
|
+
app = client.request("GET", "/apps/" + desired["application_id"])
|
|
166
|
+
if app.get("type") != "self_hosted" or app.get("domain", "").lower() != host:
|
|
167
|
+
raise ValueError("Choose a self-hosted Access application covering this entire hostname.")
|
|
168
|
+
else:
|
|
169
|
+
providers = client.list("/identity_providers")
|
|
170
|
+
if not providers:
|
|
171
|
+
raise ValueError("Configure a login method or enable email PIN first.")
|
|
172
|
+
apps = client.list("/apps")
|
|
173
|
+
app = next((a for a in apps if a.get("id") == prior.get("managed_id")), None)
|
|
174
|
+
if app is None and any(a.get("domain", "").split("/")[0].lower() == host for a in apps):
|
|
175
|
+
raise ValueError("An Access application already exists for this hostname. Use existing application instead.")
|
|
176
|
+
payload = {"name": f"Portacode: {host}", "domain": host, "type": "self_hosted", "session_duration": "24h",
|
|
177
|
+
"policies": [{"name": "Portacode allowed emails", "decision": "allow", "include": [{"email": {"email": e}} for e in desired["emails"]]}]}
|
|
178
|
+
if app:
|
|
179
|
+
if app.get("domain") != host:
|
|
180
|
+
raise ValueError("Managed Access application changed externally; review it in Cloudflare.")
|
|
181
|
+
app = client.request("PUT", "/apps/" + app["id"], payload)
|
|
182
|
+
else:
|
|
183
|
+
app = client.request("POST", "/apps", payload)
|
|
184
|
+
desired["managed_id"] = app["id"]
|
|
185
|
+
if not app.get("aud"):
|
|
186
|
+
raise ValueError("Cloudflare did not return an application audience. Routing was not changed.")
|
|
187
|
+
desired.update(team_name=team, aud_tag=[app["aud"]], application_id=app["id"])
|
|
188
|
+
rule["access"] = desired
|
|
189
|
+
by_host[host] = rule["access"]
|
|
190
|
+
|
|
191
|
+
|
|
192
|
+
def enable_otp(state):
|
|
193
|
+
client = AccessClient(state)
|
|
194
|
+
if not any(p.get("type") == "onetimepin" for p in client.list("/identity_providers")):
|
|
195
|
+
client.request("POST", "/identity_providers", {"name": "Email one-time PIN", "type": "onetimepin", "config": {}})
|
|
196
|
+
return inspect_access(state)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: portacode
|
|
3
|
-
Version: 2.2.28.
|
|
3
|
+
Version: 2.2.28.dev2
|
|
4
4
|
Summary: Device agent for the AI platform that builds, tests, deploys, and operates real software
|
|
5
5
|
Home-page: https://portacode.com/
|
|
6
6
|
Author: Meena Erian
|
|
@@ -33,6 +33,7 @@ Description-Content-Type: text/markdown
|
|
|
33
33
|
License-File: LICENSE
|
|
34
34
|
Requires-Dist: click>=8.0
|
|
35
35
|
Requires-Dist: platformdirs>=3.0
|
|
36
|
+
Requires-Dist: PyYAML<7,>=6.0
|
|
36
37
|
Requires-Dist: cryptography>=41.0
|
|
37
38
|
Requires-Dist: websockets>=12.0
|
|
38
39
|
Requires-Dist: pyperclip>=1.8
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
portacode/README.md,sha256=R76fnJCKOnLiBEirTtc7fj4A6j5vAN1pdYMGNGqu1cs,1215
|
|
2
2
|
portacode/__init__.py,sha256=Hwk8wm5KA79qi06r0qKJKT2kjUlHrWaDtH4CyhnWFw8,1086
|
|
3
3
|
portacode/__main__.py,sha256=jmHTGC1hzmo9iKJLv-SSYe9BSIbPPZ2IOpecI03PlTs,296
|
|
4
|
-
portacode/_version.py,sha256=
|
|
4
|
+
portacode/_version.py,sha256=XJn3qjKVSpjEo7pnzbcsx9bPIx7FxE2uBOuVwOT-nJs,535
|
|
5
5
|
portacode/browser_cli.py,sha256=MEc_WxTeezR4WP9wKcC89FGDeXbLyN6Ybfs-foUnrEY,5995
|
|
6
6
|
portacode/browser_prepare.py,sha256=xZRMkSEDZxw1YYz4LbiiYbmF9nOkXLcGsgkbGtVFfmQ,4805
|
|
7
7
|
portacode/browser_runtime.py,sha256=YR0duDqZaZrgSy0I9HrfZqV2fzcU2kIvUG1VyBiC93c,4276
|
|
8
|
-
portacode/cli.py,sha256=
|
|
8
|
+
portacode/cli.py,sha256=mei5eqhrnI_uDQw3IJ_lyDCP4YiUdoq4r9SgHYa8OJA,41508
|
|
9
9
|
portacode/codex_loopback_proxy.py,sha256=CK875nnfdyHGY61C-hC7IaQHG9V-jCKdgbdOf2WuaWA,24837
|
|
10
10
|
portacode/codex_prepare.py,sha256=eVIYcXjyk06XhNBGl46sC_PsBQvykSR1sIR7Ny69cR0,28284
|
|
11
11
|
portacode/codex_usage_limit.py,sha256=H3TTD-dest4bTLvgX-ZWKpxVP5Yv25PDteJnHrLOyu8,1414
|
|
@@ -36,21 +36,21 @@ portacode/connection/client.py,sha256=QDFRwBjATw5tp-wlhkiz5OfL_jVAwRHcVpPOYg6ntO
|
|
|
36
36
|
portacode/connection/codex_app_server.py,sha256=Q16bD78Hf14mtiWQ4QIB8eCTEY4wZrVytrXxr36Mo2E,23245
|
|
37
37
|
portacode/connection/guest_host_protocol.py,sha256=bXghGvUFuj2yg89pPljLuS4ivEYwgM3BwDK7CHIc2Dk,6199
|
|
38
38
|
portacode/connection/multiplex.py,sha256=L-TxqJ_ZEbfNEfu1cwxgJ5vUdyRzZjsMy2Kx1diiZys,5237
|
|
39
|
-
portacode/connection/terminal.py,sha256=
|
|
39
|
+
portacode/connection/terminal.py,sha256=039wxCa502VYz1K4gG2ZMvVb4iLXYQD3D_SZz9EyBus,75614
|
|
40
40
|
portacode/connection/test_guest_host_protocol.py,sha256=KhoXv4YMDYh6ENQrzW5rQNDZ3PMTP7oSN6iSC9KH4NE,2561
|
|
41
41
|
portacode/connection/test_guest_host_terminal.py,sha256=3c54_1fBHljdKmxpj4LYudVpgMZ-W8p_wB14WYVswps,5151
|
|
42
42
|
portacode/connection/test_webmin_proxy_config.py,sha256=52Qv9C0E5UzKUvQDJfREAb3RwJWs5R_CkKECrTWOsNg,1121
|
|
43
43
|
portacode/connection/webmin_proxy_config.py,sha256=vxzucOUz_GgxDjZWcgNVj7ImNfbdpIRABWpG_ihcK6s,2569
|
|
44
44
|
portacode/connection/handlers/README.md,sha256=pnSmHxnmBIwLkWcuNBbZb2XQdYox_dOnSu8-cWoDWJA,13385
|
|
45
45
|
portacode/connection/handlers/WEBSOCKET_PROTOCOL.md,sha256=tKZS0I9mPSaH96U3gNqWn96NCERErVW2x9VMqaKJ51w,134520
|
|
46
|
-
portacode/connection/handlers/__init__.py,sha256=
|
|
46
|
+
portacode/connection/handlers/__init__.py,sha256=1orh40S0gMbL4tvuUaIRapihCtGJ5tXipo4YUotcJAM,5278
|
|
47
47
|
portacode/connection/handlers/automation_v2_handlers.py,sha256=tCwXul5MZaZhdwGwKvIQEaUC2ySiX12e35R64Gm3wR0,54239
|
|
48
48
|
portacode/connection/handlers/base.py,sha256=tMsKJmnNhXA3a4YZA55a0WO2e8-4Uh4BsG9lWAr3Ris,10829
|
|
49
49
|
portacode/connection/handlers/browser_handlers.py,sha256=FRSxxkexiqJVq7zivDoPwEAyZvhN2GFpwN0N8_lAlno,29065
|
|
50
50
|
portacode/connection/handlers/chunked_content.py,sha256=h6hXRmxSeOgnIxoU8CkmvEf2Odv-ajPrpHIe_W3GKcA,9251
|
|
51
|
-
portacode/connection/handlers/cloudflare_forwarding.py,sha256=
|
|
51
|
+
portacode/connection/handlers/cloudflare_forwarding.py,sha256=v7jLFnSYoECakB8O8cEKArhk1SuD8NYsRr_YE-QT0f8,49528
|
|
52
52
|
portacode/connection/handlers/cloudflare_tunnel.py,sha256=qHBrm2rATxFmvfoC49YOBj0EUXjh_FETiWw66krxCIg,6655
|
|
53
|
-
portacode/connection/handlers/codex_handlers.py,sha256=
|
|
53
|
+
portacode/connection/handlers/codex_handlers.py,sha256=np7PxFC6nL68Qj99B7VD-1DdCayABR-KlideTxytjwU,53639
|
|
54
54
|
portacode/connection/handlers/diff_handlers.py,sha256=coN8gfY85KctBEs_bL9RCrZ6iymbP7zaB4Mzwgqrsck,24676
|
|
55
55
|
portacode/connection/handlers/file_handlers.py,sha256=ZPenZ14fJu7TTZSS79pLrAF2PKHMdbgmpzz5xZalW2I,44093
|
|
56
56
|
portacode/connection/handlers/file_transfer_handlers.py,sha256=otUb6x4roms-zFuuomyZFH68CNY5abr0A-eUMVgYAO8,7746
|
|
@@ -62,11 +62,12 @@ portacode/connection/handlers/registry.py,sha256=dMv0fiCY4RFtkkyB1vmQMrrpD7zEhiP
|
|
|
62
62
|
portacode/connection/handlers/resumable_transfer_handlers.py,sha256=p8PaRRYh45LjKdfhIdHdUqREHpTlJ90yXWxnhAdYGaE,32671
|
|
63
63
|
portacode/connection/handlers/runtime_user.py,sha256=tvetxe4CKe8QzmROz9HE-dEpTlKJhg_7UjChyviOlOc,7707
|
|
64
64
|
portacode/connection/handlers/session.py,sha256=xUmSorFxKoLz7y9BLxfFD4VkSHEtL0bi_qf3mP0kmcw,46784
|
|
65
|
-
portacode/connection/handlers/system_handlers.py,sha256
|
|
65
|
+
portacode/connection/handlers/system_handlers.py,sha256=rzu1vMiOlVMMoHXsbRO0ttuHEZfYYCsxDSe5QfRBT10,23870
|
|
66
66
|
portacode/connection/handlers/tab_factory.py,sha256=yn93h6GASjD1VpvW1oqpax3EpoT0r7r97zFXxML1wdA,16173
|
|
67
67
|
portacode/connection/handlers/terminal_handlers.py,sha256=s6bNmnXkjbV7rjSoYVDbbB9uHLGj2yNCz30wM6aRaHA,18651
|
|
68
68
|
portacode/connection/handlers/test_browser_handlers.py,sha256=Z5XuVrapOdCa5ZBcfmC6KLSuSV4Jl57YfIu0bLBLvAs,19407
|
|
69
|
-
portacode/connection/handlers/
|
|
69
|
+
portacode/connection/handlers/test_cloudflare_access.py,sha256=P43aeaVVZJ7Jr2GAwFzI5BSHIzMfKBXCcc0_vis6YQA,8743
|
|
70
|
+
portacode/connection/handlers/test_cloudflare_forwarding.py,sha256=ifKF-aSeEPr7IDuBlYjAfDowO7Q_qvji46I0iQe6T1w,11661
|
|
70
71
|
portacode/connection/handlers/test_file_move_copy.py,sha256=uXejCCcPWKs9qfyL6ckp0NxjwGYK3-Y63i3lFz-F47M,2872
|
|
71
72
|
portacode/connection/handlers/test_git_handlers.py,sha256=T9gFkCjanEC2L8n_kS2Ht0e67he34vThQtJU7j68auo,3514
|
|
72
73
|
portacode/connection/handlers/test_proxmox_infra.py,sha256=8vDSP7RhYltWazKOkD7oVxp2BpvQwPScDK3sD0D7FNg,60419
|
|
@@ -110,7 +111,7 @@ portacode/tests/test_browser_cli.py,sha256=ZmmNdRkIdLbTybWCKW6lCjktLRHvjK48wy1tQ
|
|
|
110
111
|
portacode/tests/test_browser_prepare.py,sha256=a75un88L1E5vX1B-1Qeh0ng6I_HictNcZ-Wf-F8uqKs,5395
|
|
111
112
|
portacode/tests/test_cli_service_logs.py,sha256=Fog68tVDMEe8zOcpfA1ukPRodhgjOwbTQ6Rm4leH6dQ,1733
|
|
112
113
|
portacode/tests/test_codex_app_server.py,sha256=xUiCno_Gx3Z5KrrhoxN38c5nGJBDgJ9bT7TDvFGZDMs,13993
|
|
113
|
-
portacode/tests/test_codex_handlers.py,sha256=
|
|
114
|
+
portacode/tests/test_codex_handlers.py,sha256=vacHHn0_eujVfsudnYL6WC_WOXbGb6IzS2_JwMcugC4,35432
|
|
114
115
|
portacode/tests/test_codex_loopback_proxy.py,sha256=W51wtATGxNMzODXY-tmRG5IU5N2FqIN8hvqQNxNv1xg,10423
|
|
115
116
|
portacode/tests/test_codex_prepare.py,sha256=n0LyedZq8IVP5OqR1pkd0h6Qvjax5_vDOwOnJGfUou8,13331
|
|
116
117
|
portacode/tests/test_codex_prepare_cli.py,sha256=hhhU3FDbLGfsSv2uC-sLzECfEScgeyyUXc_5JLNFBzw,2666
|
|
@@ -122,6 +123,7 @@ portacode/tests/test_system_handlers.py,sha256=gbc5n6o3OxDpm-wRs4D2Y3IURfs1Vesli
|
|
|
122
123
|
portacode/tests/test_terminal_periodic_system_info.py,sha256=cYdTnI6lEigWGNtDH_54JWP9Mo4D6xr8MFHvtE_PADA,1940
|
|
123
124
|
portacode/tests/test_terminal_session_shell.py,sha256=nNM_fbT1vM8oknGDBeNk0eiRtZ8uz17dXXOB7STgGK8,2157
|
|
124
125
|
portacode/tunneling/__init__.py,sha256=qOrizn5awmPfsabVF59-EkmXnvS8AogvcBtVON6UfP0,54
|
|
126
|
+
portacode/tunneling/access.py,sha256=zRdhsT_fQ-cFyqN2ZdLkOWwzXsHifm9tz3qqpVkke_U,9865
|
|
125
127
|
portacode/tunneling/cloudflared_login.py,sha256=5guJT84CG-O1KgR5PgLNIJNzQ-HxCjGgtfqoHSKe8Zg,2456
|
|
126
128
|
portacode/tunneling/ensure_cloudflared.py,sha256=4NiN-WZ8-vTeoFTALg-mc_sksvhEaFo0oCZwUMvPBdY,6041
|
|
127
129
|
portacode/tunneling/ensure_pyyaml.py,sha256=cR4LOdJnUQnhH_chq5NL1MAxtSd5x0coNrwzZdPbzhY,2178
|
|
@@ -136,7 +138,7 @@ portacode/utils/diff_apply.py,sha256=ArkT-vEQ7iyA1Nfqufq1AiNtRLhoCMnC75FCRh2kNgI
|
|
|
136
138
|
portacode/utils/diff_renderer.py,sha256=S76StnQ2DLfsz4Gg0m07UwPfRp8270PuzbNaQq-rmYk,13850
|
|
137
139
|
portacode/utils/ntp_clock.py,sha256=VqCnWCTehCufE43W23oB-WUdAZGeCcLxkmIOPwInYHc,2499
|
|
138
140
|
portacode/utils/runtime_paths.py,sha256=G9ROho5f5gnDhoQ7vpEAX2XifBzoJTvqTylkF2Hkx8E,1660
|
|
139
|
-
portacode-2.2.28.
|
|
141
|
+
portacode-2.2.28.dev2.dist-info/licenses/LICENSE,sha256=iiV44E3po4OL77NL8diCk3WtYvCNGu6gUci2TYxVUgQ,5520
|
|
140
142
|
test_modules/README.md,sha256=Do_agkm9WhSzueXjRAkV_xEj6Emy5zB3N3VKY5Roce8,9274
|
|
141
143
|
test_modules/__init__.py,sha256=1LcbHodIHsB0g-g4NGjSn6AMuCoGbymvXPYLOb6Z7F0,53
|
|
142
144
|
test_modules/test_device_online.py,sha256=QtYq0Dq9vME8Gp2O4fGSheqVf8LUtpsSKosXXk56gGM,1654
|
|
@@ -162,8 +164,8 @@ testing_framework/core/playwright_manager.py,sha256=asMe7zQg8Kp3a71F7pv92OiFt63B
|
|
|
162
164
|
testing_framework/core/runner.py,sha256=t3fq0mGCVUCE_TbieEPwmLKjxe44ez29SzW8G33ACME,19746
|
|
163
165
|
testing_framework/core/shared_cli_manager.py,sha256=BESSNtyQb7BOlaOvZmm04T8Uezjms4KCBs2MzTxvzYQ,8790
|
|
164
166
|
testing_framework/core/test_discovery.py,sha256=2FZ9fJ8Dp5dloA-fkgXoJ_gCMC_nYPBnA3Hs2xlagzM,4928
|
|
165
|
-
portacode-2.2.28.
|
|
166
|
-
portacode-2.2.28.
|
|
167
|
-
portacode-2.2.28.
|
|
168
|
-
portacode-2.2.28.
|
|
169
|
-
portacode-2.2.28.
|
|
167
|
+
portacode-2.2.28.dev2.dist-info/METADATA,sha256=QjfhIH6P5pLHnIYBbO4lutrP0v_19j9gdLixZSR1nIM,12881
|
|
168
|
+
portacode-2.2.28.dev2.dist-info/WHEEL,sha256=a-udL2m4V_6Yn8b-uKzWb12RjRxwwMo6ohYFM24tpaY,91
|
|
169
|
+
portacode-2.2.28.dev2.dist-info/entry_points.txt,sha256=0cV_SuIztVnLWACUY5KMR8K8pWdAsLiaFbLXE5He0rk,151
|
|
170
|
+
portacode-2.2.28.dev2.dist-info/top_level.txt,sha256=TGhTYUxfW8SyVZc_zGgzjzc24gGT7nSw8Qf73liVRKM,41
|
|
171
|
+
portacode-2.2.28.dev2.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|