webtap-tool 0.7.1__py3-none-any.whl → 0.8.0__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.
Potentially problematic release.
This version of webtap-tool might be problematic. Click here for more details.
- webtap/__init__.py +4 -0
- webtap/api.py +50 -57
- webtap/app.py +5 -0
- webtap/cdp/session.py +77 -25
- webtap/commands/TIPS.md +125 -22
- webtap/commands/_builders.py +7 -1
- webtap/commands/_code_generation.py +110 -0
- webtap/commands/body.py +9 -5
- webtap/commands/connection.py +21 -0
- webtap/commands/javascript.py +13 -25
- webtap/commands/navigation.py +5 -0
- webtap/commands/quicktype.py +268 -0
- webtap/commands/to_model.py +23 -75
- webtap/services/body.py +209 -24
- webtap/services/dom.py +19 -12
- webtap/services/fetch.py +19 -0
- webtap/services/main.py +192 -0
- webtap/services/state_snapshot.py +88 -0
- {webtap_tool-0.7.1.dist-info → webtap_tool-0.8.0.dist-info}/METADATA +1 -1
- {webtap_tool-0.7.1.dist-info → webtap_tool-0.8.0.dist-info}/RECORD +22 -19
- {webtap_tool-0.7.1.dist-info → webtap_tool-0.8.0.dist-info}/WHEEL +0 -0
- {webtap_tool-0.7.1.dist-info → webtap_tool-0.8.0.dist-info}/entry_points.txt +0 -0
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
"""Immutable state snapshots for thread-safe SSE broadcasting.
|
|
2
|
+
|
|
3
|
+
PUBLIC API:
|
|
4
|
+
- StateSnapshot: Frozen dataclass for zero-lock state reads
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
from dataclasses import dataclass
|
|
8
|
+
from typing import Any
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
@dataclass(frozen=True)
|
|
12
|
+
class StateSnapshot:
|
|
13
|
+
"""Immutable snapshot of WebTap state.
|
|
14
|
+
|
|
15
|
+
Frozen dataclass provides inherent thread safety - multiple threads can
|
|
16
|
+
read simultaneously without locks. Updated atomically when state changes.
|
|
17
|
+
|
|
18
|
+
Used by SSE broadcast to avoid lock contention between asyncio event loop
|
|
19
|
+
and background threads (WebSocket, disconnect handlers).
|
|
20
|
+
|
|
21
|
+
Attributes:
|
|
22
|
+
connected: Whether connected to Chrome page
|
|
23
|
+
page_id: Stable page identifier (empty if not connected)
|
|
24
|
+
page_title: Page title (empty if not connected)
|
|
25
|
+
page_url: Page URL (empty if not connected)
|
|
26
|
+
event_count: Total CDP events stored
|
|
27
|
+
fetch_enabled: Whether fetch interception is active
|
|
28
|
+
paused_count: Number of paused requests (if fetch enabled)
|
|
29
|
+
enabled_filters: Tuple of enabled filter category names
|
|
30
|
+
disabled_filters: Tuple of disabled filter category names
|
|
31
|
+
inspect_active: Whether element inspection mode is active
|
|
32
|
+
selections: Dict of selected elements (id -> element data)
|
|
33
|
+
prompt: Browser prompt text (unused, reserved)
|
|
34
|
+
pending_count: Number of pending element selections being processed
|
|
35
|
+
error_message: Current error message or None
|
|
36
|
+
error_timestamp: Error timestamp or None
|
|
37
|
+
"""
|
|
38
|
+
|
|
39
|
+
# Connection state
|
|
40
|
+
connected: bool
|
|
41
|
+
page_id: str
|
|
42
|
+
page_title: str
|
|
43
|
+
page_url: str
|
|
44
|
+
|
|
45
|
+
# Event state
|
|
46
|
+
event_count: int
|
|
47
|
+
|
|
48
|
+
# Fetch interception state
|
|
49
|
+
fetch_enabled: bool
|
|
50
|
+
paused_count: int
|
|
51
|
+
|
|
52
|
+
# Filter state (immutable tuples)
|
|
53
|
+
enabled_filters: tuple[str, ...]
|
|
54
|
+
disabled_filters: tuple[str, ...]
|
|
55
|
+
|
|
56
|
+
# Browser/DOM state
|
|
57
|
+
inspect_active: bool
|
|
58
|
+
selections: dict[str, Any] # Dict is mutable but replaced atomically
|
|
59
|
+
prompt: str
|
|
60
|
+
pending_count: int
|
|
61
|
+
|
|
62
|
+
# Error state
|
|
63
|
+
error_message: str | None
|
|
64
|
+
error_timestamp: float | None
|
|
65
|
+
|
|
66
|
+
@classmethod
|
|
67
|
+
def create_empty(cls) -> "StateSnapshot":
|
|
68
|
+
"""Create empty snapshot for disconnected state."""
|
|
69
|
+
return cls(
|
|
70
|
+
connected=False,
|
|
71
|
+
page_id="",
|
|
72
|
+
page_title="",
|
|
73
|
+
page_url="",
|
|
74
|
+
event_count=0,
|
|
75
|
+
fetch_enabled=False,
|
|
76
|
+
paused_count=0,
|
|
77
|
+
enabled_filters=(),
|
|
78
|
+
disabled_filters=(),
|
|
79
|
+
inspect_active=False,
|
|
80
|
+
selections={},
|
|
81
|
+
prompt="",
|
|
82
|
+
pending_count=0,
|
|
83
|
+
error_message=None,
|
|
84
|
+
error_timestamp=None,
|
|
85
|
+
)
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
__all__ = ["StateSnapshot"]
|
|
@@ -1,51 +1,54 @@
|
|
|
1
1
|
webtap/VISION.md,sha256=kfoJfEPVc4chOrD9tNMDmYBY9rX9KB-286oZj70ALCE,7681
|
|
2
|
-
webtap/__init__.py,sha256=
|
|
3
|
-
webtap/api.py,sha256=
|
|
4
|
-
webtap/app.py,sha256=
|
|
2
|
+
webtap/__init__.py,sha256=gQPBOt8Q9Y9znQidBvIM5DbecNBTQe4XuoLK5WjFIfU,1250
|
|
3
|
+
webtap/api.py,sha256=w-7WGyR54fv980GF873w4T5TPErYcgx9PfRBNiddk64,18251
|
|
4
|
+
webtap/app.py,sha256=DG40lLVod4iSJP1TnrzxrEkkP4_sQ6G5euGubQqfEGQ,4073
|
|
5
5
|
webtap/filters.py,sha256=kRCicGMSV3R_zSvwzqZqksnry6jxJNdXRcgWvpoBLfc,13323
|
|
6
6
|
webtap/cdp/README.md,sha256=0TS0V_dRgRAzBqhddpXWD4S0YVi5wI4JgFJSll_KUBE,5660
|
|
7
7
|
webtap/cdp/__init__.py,sha256=c6NFG0XJnAa5GTe9MLr9mDZcLZqoTQN7A1cvvOfLcgY,453
|
|
8
8
|
webtap/cdp/query.py,sha256=x2Cy7KMolYkTelpROGezOfMFgYnbSlCvHkvvW1v_gLI,4229
|
|
9
|
-
webtap/cdp/session.py,sha256=
|
|
9
|
+
webtap/cdp/session.py,sha256=nm4fpHKiGskvHkhxvlmZULEVaY4PpLb7g7lmuwdEEG4,21573
|
|
10
10
|
webtap/cdp/schema/README.md,sha256=hnWCzbXYcYtWaZb_SgjVaFBiG81S9b9Y3x-euQFwQDo,1222
|
|
11
11
|
webtap/cdp/schema/cdp_protocol.json,sha256=dp9_OLYLuVsQb1oV5r6MZfMzURscBLyAXUckdaPWyv4,1488452
|
|
12
12
|
webtap/cdp/schema/cdp_version.json,sha256=OhGy1qpfQjSe3Z7OqL6KynBFlDFBXxKGPZCY-ZN_lVU,399
|
|
13
13
|
webtap/commands/DEVELOPER_GUIDE.md,sha256=LYOhycZ3k5EHx5nREfkjvLz7vOs8pXCRLlcDm-keWao,11973
|
|
14
|
-
webtap/commands/TIPS.md,sha256=
|
|
14
|
+
webtap/commands/TIPS.md,sha256=ssTcJr-nzoAOtTQOvuziDVoWGFk7pLa7RomwX79_kaA,14228
|
|
15
15
|
webtap/commands/__init__.py,sha256=rr3xM_bY0BgxkDOjsnsI8UBhjlz7nqiYlgJ8fjiJ1jQ,270
|
|
16
|
-
webtap/commands/_builders.py,sha256=
|
|
16
|
+
webtap/commands/_builders.py,sha256=VUHiObHfOveduILYEX711wnA-tfx6GL_8t_zuQ-CPQw,8146
|
|
17
|
+
webtap/commands/_code_generation.py,sha256=uBpusbIGCWqm6HwaWSuhFnRu_J5jm4rJ7qmx-esogf4,3288
|
|
17
18
|
webtap/commands/_tips.py,sha256=SleMpwdghrHNqdzR60Cu8T0NZqJfWfcfrgIcyWI6GIQ,4793
|
|
18
19
|
webtap/commands/_utils.py,sha256=VLXDhhhJITrQjwEyeLRTU2ey0QcLzY-_OxTjtPJlhYM,6816
|
|
19
|
-
webtap/commands/body.py,sha256=
|
|
20
|
-
webtap/commands/connection.py,sha256=
|
|
20
|
+
webtap/commands/body.py,sha256=wEBD1hCEopmPSnq7M_f5mU0Rb4EPGak9OVED4jo0ZW4,7278
|
|
21
|
+
webtap/commands/connection.py,sha256=o_Ny6dbQewNsPZ8QfdGZKY4mgqeAhqbRIqq56ksniFU,6264
|
|
21
22
|
webtap/commands/console.py,sha256=BBaxSiLsVBChBY3Xi_nXwWjFlfc5KW9FQTPp5PzMUoE,2145
|
|
22
23
|
webtap/commands/events.py,sha256=dsS6xd8GfkZ4VOnAQSCMxyEvwdha9J0Kh9oeK0CaU5Y,4058
|
|
23
24
|
webtap/commands/fetch.py,sha256=8J6TPBWhStbkN5c5Q4KmK6nB5WiIgnAk0BkPFbh9ggg,7737
|
|
24
25
|
webtap/commands/filters.py,sha256=jDZ8JcYIZv_K6aupwuAo9uqAi85e3EIKbf38BXz5nnI,10316
|
|
25
26
|
webtap/commands/inspect.py,sha256=QonZigFYnfEVWYQY__r0n1aVvTqFBukFV-AWzc5KmfA,5711
|
|
26
|
-
webtap/commands/javascript.py,sha256=
|
|
27
|
+
webtap/commands/javascript.py,sha256=d1aCs6VthNUkxGXRIWHxCzFTwrr0j81NVtGknsz75GU,4274
|
|
27
28
|
webtap/commands/launch.py,sha256=iZDLundKlxKRLKf3Vz5at42-tp2f-Uj5wZf7fbhBfA0,2202
|
|
28
|
-
webtap/commands/navigation.py,sha256=
|
|
29
|
+
webtap/commands/navigation.py,sha256=OBhCUnRvzF4aZ7c3YZUznr-yU4uuLBGTndDtkb1EJHg,6167
|
|
29
30
|
webtap/commands/network.py,sha256=gEOg_u7VF9A5aKv5myzLCuvfAUkF1OPxsuj4UAgbS44,3111
|
|
31
|
+
webtap/commands/quicktype.py,sha256=t4hAVxkAbwKcf_gZlsxWIUPIABoDrboeZMS937usXHg,9002
|
|
30
32
|
webtap/commands/selections.py,sha256=M001d_Gc51aSTuVeXGa19LDh2ZGR_qBJEjVGKpcGGFM,4895
|
|
31
33
|
webtap/commands/server.py,sha256=DOcIgYuKp0ydwrK9EA3hGwqOwfwM9DABhdPu3hk_jjo,6948
|
|
32
34
|
webtap/commands/setup.py,sha256=dov1LaN50nAEMNIuBLSK7mcnwhfn9rtqdTopBm1-PhA,9648
|
|
33
|
-
webtap/commands/to_model.py,sha256=
|
|
35
|
+
webtap/commands/to_model.py,sha256=M_X_Y6Eb6tU-Ar4UP43q5AHBfBlCXV0chEuwRJ-poOE,3214
|
|
34
36
|
webtap/services/README.md,sha256=rala_jtnNgSiQ1lFLM7x_UQ4SJZDceAm7dpkQMRTYaI,2346
|
|
35
37
|
webtap/services/__init__.py,sha256=IjFqu0Ak6D-r18aokcQMtenDV3fbelvfjTCejGv6CZ0,570
|
|
36
|
-
webtap/services/body.py,sha256=
|
|
38
|
+
webtap/services/body.py,sha256=5c1YO3xKHU4qHFLeczag0m91PoSzp9-tBE30SENJEzg,11586
|
|
37
39
|
webtap/services/console.py,sha256=XVfSKTvEHyyOdujsg85S3wtj1CdZhzKtWwlx25MvSv8,3768
|
|
38
|
-
webtap/services/dom.py,sha256=
|
|
39
|
-
webtap/services/fetch.py,sha256
|
|
40
|
-
webtap/services/main.py,sha256=
|
|
40
|
+
webtap/services/dom.py,sha256=JNYHFrgPpJnMZJ3s267R5m6xFWJwKA8Fwn3XGln6wxs,19399
|
|
41
|
+
webtap/services/fetch.py,sha256=-ZsfEfF3iFge3fiyLniflU0v0In-SxJMb7VtIe7_sjU,14417
|
|
42
|
+
webtap/services/main.py,sha256=kHKHtLnwR3rnpbtJXZZtAdNmD_dg0ejvd-TvrkXTqLg,13948
|
|
41
43
|
webtap/services/network.py,sha256=0o_--F6YvmXqqFqrcjL1gc6Vr9V1Ytb_U7r_DSUWupA,3444
|
|
44
|
+
webtap/services/state_snapshot.py,sha256=xy7q-QaDhrHrEKVctJNH0t14zzI4DNmlt_-4C5ipr2M,2701
|
|
42
45
|
webtap/services/setup/__init__.py,sha256=lfoKCAroc-JoE_r7L-KZkF85ZWiB41MBIgrR7ZISSoE,7157
|
|
43
46
|
webtap/services/setup/chrome.py,sha256=zfPWeb6zm_xjIfiS2S_O9lR2BjGKaPXXo06pN_B9lAU,7187
|
|
44
47
|
webtap/services/setup/desktop.py,sha256=fXwQa201W-s2mengm_dJZ9BigJopVrO9YFUQcW_TSFQ,8022
|
|
45
48
|
webtap/services/setup/extension.py,sha256=iJY43JlQO6Vicgd9Mz6Mw0LQfbBNUGhnwI8n-LnvHBY,3602
|
|
46
49
|
webtap/services/setup/filters.py,sha256=lAPSLMH_KZQO-7bRkmURwzforx7C3SDrKEw2ZogN-Lo,3220
|
|
47
50
|
webtap/services/setup/platform.py,sha256=7yn-7LQFffgerWzWRtOG-yNEsR36ICThYUAu_N2FAso,4532
|
|
48
|
-
webtap_tool-0.
|
|
49
|
-
webtap_tool-0.
|
|
50
|
-
webtap_tool-0.
|
|
51
|
-
webtap_tool-0.
|
|
51
|
+
webtap_tool-0.8.0.dist-info/METADATA,sha256=6EJihElxEAWvWgBttK2EXsdNPJc95JKY96FzZ50Z4Hs,17636
|
|
52
|
+
webtap_tool-0.8.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
53
|
+
webtap_tool-0.8.0.dist-info/entry_points.txt,sha256=iFe575I0CIb1MbfPt0oX2VYyY5gSU_dA551PKVR83TU,39
|
|
54
|
+
webtap_tool-0.8.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|