onec-interactive-runtime-core 0.1.19__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.
- onec_interactive_runtime_core-0.1.19.dist-info/METADATA +12 -0
- onec_interactive_runtime_core-0.1.19.dist-info/RECORD +87 -0
- onec_interactive_runtime_core-0.1.19.dist-info/WHEEL +4 -0
- onec_interactive_runtime_core-0.1.19.dist-info/licenses/COPYRIGHT +9 -0
- onec_interactive_runtime_core-0.1.19.dist-info/licenses/LICENSE +232 -0
- onec_interactive_runtime_core-0.1.19.dist-info/licenses/THIRD_PARTY_NOTICES.txt +32 -0
- onec_runtime/AGENTS.md +7 -0
- onec_runtime/__init__.py +3 -0
- onec_runtime/artifacts.py +59 -0
- onec_runtime/bootstrap.py +310 -0
- onec_runtime/breakpoint_workspace.py +249 -0
- onec_runtime/bsl/__init__.py +139 -0
- onec_runtime/bsl/diagnostics.py +1046 -0
- onec_runtime/bsl/full_ast_worker_projection.py +522 -0
- onec_runtime/bsl/generated_semantic_parser.py +6322 -0
- onec_runtime/bsl/lexer.py +164 -0
- onec_runtime/bsl/module_catalog.py +420 -0
- onec_runtime/bsl/module_delta.py +1079 -0
- onec_runtime/bsl/module_universe.py +1877 -0
- onec_runtime/bsl/notebook_cells.py +232 -0
- onec_runtime/bsl/notebook_method_globals.py +74 -0
- onec_runtime/bsl/notebook_methods.py +175 -0
- onec_runtime/bsl/parser_artifact_identity.py +119 -0
- onec_runtime/bsl/parser_target.py +388 -0
- onec_runtime/bsl/preprocessor.py +16 -0
- onec_runtime/bsl/semantic_lowering.py +1539 -0
- onec_runtime/bsl/source_maps.py +2411 -0
- onec_runtime/bsl/worker_dependency_resolver.py +289 -0
- onec_runtime/bsl/worker_preprocessor.py +247 -0
- onec_runtime/bsl/worker_projection_model.py +137 -0
- onec_runtime/bsl/worker_reload_source_map.py +1697 -0
- onec_runtime/capture.py +113 -0
- onec_runtime/capture_source.py +453 -0
- onec_runtime/compact_table.py +376 -0
- onec_runtime/compact_table_backend.py +500 -0
- onec_runtime/config.py +198 -0
- onec_runtime/configurator_agent.py +520 -0
- onec_runtime/controller_worker.py +400 -0
- onec_runtime/credentials.py +18 -0
- onec_runtime/epf_container.py +196 -0
- onec_runtime/errors.py +205 -0
- onec_runtime/experiment.py +130 -0
- onec_runtime/extension_bundle.py +944 -0
- onec_runtime/extension_lifecycle.py +402 -0
- onec_runtime/extension_state.py +222 -0
- onec_runtime/fault_injection.py +30 -0
- onec_runtime/kernel.py +179 -0
- onec_runtime/lease.py +123 -0
- onec_runtime/observation.py +287 -0
- onec_runtime/performance_profile.py +245 -0
- onec_runtime/privacy.py +263 -0
- onec_runtime/processes.py +265 -0
- onec_runtime/prototype_runtime.py +2644 -0
- onec_runtime/rdbg/__init__.py +1 -0
- onec_runtime/rdbg/models.py +130 -0
- onec_runtime/rdbg/reconnect.py +59 -0
- onec_runtime/rdbg/session.py +913 -0
- onec_runtime/rdbg/transport.py +138 -0
- onec_runtime/rdbg/xml_codec.py +980 -0
- onec_runtime/recovery.py +106 -0
- onec_runtime/recovery_journal.py +79 -0
- onec_runtime/resources/extension/OnecInteractiveRuntime.cfe +0 -0
- onec_runtime/resources/extension/extension-manifest.json +108 -0
- onec_runtime/runtime_api.py +5272 -0
- onec_runtime/runtime_contracts.py +196 -0
- onec_runtime/server_worker.py +2034 -0
- onec_runtime/session.py +2123 -0
- onec_runtime/startup_diagnostics.py +45 -0
- onec_runtime/stop_routing.py +65 -0
- onec_runtime/supervised_processes.py +232 -0
- onec_runtime/supervised_runtime.py +512 -0
- onec_runtime/supervisor.py +363 -0
- onec_runtime/supervisor_model.py +148 -0
- onec_runtime/supervisor_protocol.py +77 -0
- onec_runtime/table_materialization.py +471 -0
- onec_runtime/table_transfer_backend.py +203 -0
- onec_runtime/table_value.py +311 -0
- onec_runtime/toolchain.py +730 -0
- onec_runtime/value_materialization.py +432 -0
- onec_runtime/value_transfer_backend.py +199 -0
- onec_runtime/worker_breakpoints.py +1431 -0
- onec_runtime/worker_epf.py +313 -0
- onec_runtime/worker_epf_template.py +53 -0
- onec_runtime/worker_stage_protocol.py +516 -0
- onec_runtime/worker_universe.py +3772 -0
- onec_runtime_build/__init__.py +1 -0
- onec_runtime_build/parser_target_development.py +116 -0
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from dataclasses import dataclass
|
|
4
|
+
from time import monotonic_ns
|
|
5
|
+
from typing import Callable
|
|
6
|
+
|
|
7
|
+
import httpx
|
|
8
|
+
|
|
9
|
+
from onec_runtime.errors import (
|
|
10
|
+
ProtocolError,
|
|
11
|
+
RdbgDebugUiNotRegistered,
|
|
12
|
+
RdbgTransportError,
|
|
13
|
+
)
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
@dataclass(frozen=True)
|
|
17
|
+
class TranscriptEntry:
|
|
18
|
+
monotonic_ns: int
|
|
19
|
+
command: str
|
|
20
|
+
request: bytes
|
|
21
|
+
status_code: int | None
|
|
22
|
+
response: bytes
|
|
23
|
+
duration_ms: float
|
|
24
|
+
error: str = ""
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
class RdbgTransport:
|
|
28
|
+
def __init__(
|
|
29
|
+
self,
|
|
30
|
+
host: str,
|
|
31
|
+
port: int,
|
|
32
|
+
*,
|
|
33
|
+
transcript: Callable[[TranscriptEntry], None] | None = None,
|
|
34
|
+
client: httpx.Client | None = None,
|
|
35
|
+
) -> None:
|
|
36
|
+
self._base_url = f"http://{host}:{port}/e1crdbg/rdbg"
|
|
37
|
+
self._transcript = transcript
|
|
38
|
+
self._client = client or httpx.Client(
|
|
39
|
+
headers={
|
|
40
|
+
"User-Agent": "1CV8",
|
|
41
|
+
"Accept": "application/xml",
|
|
42
|
+
"Content-Type": "application/xml; charset=utf-8",
|
|
43
|
+
},
|
|
44
|
+
trust_env=False,
|
|
45
|
+
)
|
|
46
|
+
|
|
47
|
+
def request(
|
|
48
|
+
self,
|
|
49
|
+
command: str,
|
|
50
|
+
payload: bytes = b"",
|
|
51
|
+
*,
|
|
52
|
+
timeout_s: float = 60.0,
|
|
53
|
+
dbgui: str | None = None,
|
|
54
|
+
) -> bytes:
|
|
55
|
+
start_ns = monotonic_ns()
|
|
56
|
+
status: int | None = None
|
|
57
|
+
response_body = b""
|
|
58
|
+
error_text = ""
|
|
59
|
+
try:
|
|
60
|
+
params = {"cmd": command}
|
|
61
|
+
if dbgui is not None:
|
|
62
|
+
params["dbgui"] = dbgui
|
|
63
|
+
response = self._client.post(
|
|
64
|
+
self._base_url,
|
|
65
|
+
params=params,
|
|
66
|
+
content=payload,
|
|
67
|
+
timeout=timeout_s,
|
|
68
|
+
)
|
|
69
|
+
status = response.status_code
|
|
70
|
+
response_body = response.content
|
|
71
|
+
if not 200 <= response.status_code < 300:
|
|
72
|
+
bounded = response_body[:1000].decode("utf-8", errors="replace")
|
|
73
|
+
if (
|
|
74
|
+
response.status_code == 400
|
|
75
|
+
and "UI+ -" in bounded
|
|
76
|
+
and "часть отладки не зарегистрирована" in bounded.casefold()
|
|
77
|
+
):
|
|
78
|
+
raise RdbgDebugUiNotRegistered(
|
|
79
|
+
f"RDBG debug UI is not registered during {command}"
|
|
80
|
+
)
|
|
81
|
+
raise ProtocolError(
|
|
82
|
+
f"RDBG {command} returned HTTP {response.status_code}: {bounded}"
|
|
83
|
+
)
|
|
84
|
+
return response_body
|
|
85
|
+
except httpx.ReadTimeout as error:
|
|
86
|
+
error_text = str(error)
|
|
87
|
+
if command == "pingDebugUIParams":
|
|
88
|
+
return b""
|
|
89
|
+
raise RdbgTransportError(
|
|
90
|
+
f"RDBG {command} transport failure: {error}"
|
|
91
|
+
) from error
|
|
92
|
+
except httpx.HTTPError as error:
|
|
93
|
+
error_text = str(error)
|
|
94
|
+
raise RdbgTransportError(
|
|
95
|
+
f"RDBG {command} transport failure: {error}"
|
|
96
|
+
) from error
|
|
97
|
+
except ProtocolError as error:
|
|
98
|
+
error_text = str(error)
|
|
99
|
+
raise
|
|
100
|
+
finally:
|
|
101
|
+
if self._transcript is not None:
|
|
102
|
+
self._transcript(
|
|
103
|
+
TranscriptEntry(
|
|
104
|
+
monotonic_ns=start_ns,
|
|
105
|
+
command=command,
|
|
106
|
+
request=payload,
|
|
107
|
+
status_code=status,
|
|
108
|
+
response=response_body,
|
|
109
|
+
duration_ms=(monotonic_ns() - start_ns) / 1_000_000,
|
|
110
|
+
error=error_text,
|
|
111
|
+
)
|
|
112
|
+
)
|
|
113
|
+
|
|
114
|
+
def test_server(self, *, timeout_s: float = 5.0) -> float:
|
|
115
|
+
start_ns = monotonic_ns()
|
|
116
|
+
try:
|
|
117
|
+
response = self._client.post(
|
|
118
|
+
self._base_url.replace("/rdbg", "/rdbgTest"),
|
|
119
|
+
params={"cmd": "test"},
|
|
120
|
+
content=b"",
|
|
121
|
+
timeout=timeout_s,
|
|
122
|
+
)
|
|
123
|
+
if response.status_code >= 500:
|
|
124
|
+
raise ProtocolError(
|
|
125
|
+
f"RDBG test endpoint returned HTTP {response.status_code}"
|
|
126
|
+
)
|
|
127
|
+
except httpx.HTTPError as error:
|
|
128
|
+
raise RdbgTransportError(f"RDBG test endpoint failure: {error}") from error
|
|
129
|
+
return (monotonic_ns() - start_ns) / 1_000_000
|
|
130
|
+
|
|
131
|
+
def close(self) -> None:
|
|
132
|
+
self._client.close()
|
|
133
|
+
|
|
134
|
+
def __enter__(self) -> "RdbgTransport":
|
|
135
|
+
return self
|
|
136
|
+
|
|
137
|
+
def __exit__(self, *_: object) -> None:
|
|
138
|
+
self.close()
|