termwright 0.2.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.
termwright/__init__.py ADDED
@@ -0,0 +1,125 @@
1
+ """termwright — semantic side-channel client for Python TUIs.
2
+
3
+ The protocol modules (:mod:`~termwright.framing`, :mod:`~termwright.marker`,
4
+ :mod:`~termwright.messages`, :mod:`~termwright.validate`,
5
+ :mod:`~termwright.client`) have no third-party dependencies. Textual is
6
+ instrumented automatically by :mod:`termwright_probe`; custom widgets may opt
7
+ into developer intent with :func:`termwright.textual.semantic`.
8
+
9
+ from termwright import client_from_env
10
+
11
+ client = client_from_env(adapter_name="my-tui", adapter_version="1.0.0")
12
+ if client is not None and await client.start():
13
+ marker = await client.publish(snapshot)
14
+ sys.stdout.write(marker) # after the render's last byte
15
+ """
16
+
17
+ from __future__ import annotations
18
+
19
+ from .client import (
20
+ CAPABILITIES_WITH_LOGS,
21
+ DEFAULT_CAPABILITIES,
22
+ ENV_ENDPOINT,
23
+ ENV_PROTOCOL,
24
+ ENV_TOKEN,
25
+ SemanticClient,
26
+ client_from_env,
27
+ )
28
+ from .debug import ENV_DEBUG, ENV_DEBUG_FILE, DebugLog, debug_path
29
+ from .errors import ProtocolViolation, TermwrightError
30
+ from .framing import FRAME_HEADER_BYTES, FrameDecoder, encode_frame, project_dto
31
+ from .limits import ABSOLUTE_LIMITS, DEFAULT_LIMITS, ProtocolLimits
32
+ from .logs import (
33
+ LOG_LEVEL_SEVERITY,
34
+ LOG_LEVELS,
35
+ MAX_LOG_ATTRS,
36
+ LogRecord,
37
+ LogValidationResult,
38
+ flatten_attrs,
39
+ validate_log_record,
40
+ )
41
+ from .marker import (
42
+ MARKER_MAC_BYTES,
43
+ MARKER_OSC_CODE,
44
+ MARKER_OSC_PREFIX,
45
+ RenderMarker,
46
+ encode_marker,
47
+ verify_marker_payload,
48
+ )
49
+ from .messages import (
50
+ PROTOCOL_ID,
51
+ PROTOCOL_VERSION,
52
+ ParseResult,
53
+ parse_adapter_message,
54
+ parse_driver_message,
55
+ )
56
+ from .roles import ADAPTER_CAPABILITIES, SEMANTIC_ACTIONS, SEMANTIC_ROLES
57
+ from .tree import (
58
+ CursorInfo,
59
+ NodeGeometryObservations,
60
+ Observation,
61
+ Rect,
62
+ SemanticNode,
63
+ SemanticSnapshot,
64
+ SemanticState,
65
+ SemanticTextRange,
66
+ )
67
+ from .validate import ValidationResult, apply_tree_delta, validate_snapshot, validate_tree_delta
68
+
69
+ __version__ = "0.2.0"
70
+
71
+ __all__ = [
72
+ "ABSOLUTE_LIMITS",
73
+ "CAPABILITIES_WITH_LOGS",
74
+ "LOG_LEVELS",
75
+ "LOG_LEVEL_SEVERITY",
76
+ "MAX_LOG_ATTRS",
77
+ "LogRecord",
78
+ "LogValidationResult",
79
+ "flatten_attrs",
80
+ "validate_log_record",
81
+ "ADAPTER_CAPABILITIES",
82
+ "DEFAULT_CAPABILITIES",
83
+ "DEFAULT_LIMITS",
84
+ "DebugLog",
85
+ "ENV_DEBUG",
86
+ "ENV_DEBUG_FILE",
87
+ "ENV_ENDPOINT",
88
+ "ENV_PROTOCOL",
89
+ "ENV_TOKEN",
90
+ "FRAME_HEADER_BYTES",
91
+ "FrameDecoder",
92
+ "MARKER_MAC_BYTES",
93
+ "MARKER_OSC_CODE",
94
+ "MARKER_OSC_PREFIX",
95
+ "PROTOCOL_ID",
96
+ "PROTOCOL_VERSION",
97
+ "ParseResult",
98
+ "ProtocolLimits",
99
+ "ProtocolViolation",
100
+ "RenderMarker",
101
+ "CursorInfo",
102
+ "NodeGeometryObservations",
103
+ "Observation",
104
+ "Rect",
105
+ "SEMANTIC_ACTIONS",
106
+ "SEMANTIC_ROLES",
107
+ "SemanticClient",
108
+ "SemanticNode",
109
+ "SemanticSnapshot",
110
+ "SemanticState",
111
+ "SemanticTextRange",
112
+ "TermwrightError",
113
+ "ValidationResult",
114
+ "client_from_env",
115
+ "debug_path",
116
+ "encode_frame",
117
+ "encode_marker",
118
+ "parse_adapter_message",
119
+ "parse_driver_message",
120
+ "project_dto",
121
+ "apply_tree_delta",
122
+ "validate_snapshot",
123
+ "validate_tree_delta",
124
+ "verify_marker_payload",
125
+ ]