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
onec_runtime/config.py
ADDED
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
import os
|
|
4
|
+
import re
|
|
5
|
+
from dataclasses import dataclass, field
|
|
6
|
+
from hashlib import sha256
|
|
7
|
+
from pathlib import Path
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
_CONNECTION_PART = re.compile(
|
|
11
|
+
r'[ \t]*([A-Za-z]+)[ \t]*=[ \t]*"([^"\r\n]*)"[ \t]*(?:;|$)'
|
|
12
|
+
)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
def _connection_target(value: str) -> tuple[str | None, str | None]:
|
|
16
|
+
"""Accept the file and server selectors used by 1C connection strings."""
|
|
17
|
+
if not isinstance(value, str) or not value or "\r" in value or "\n" in value:
|
|
18
|
+
raise ValueError("Invalid connection_string")
|
|
19
|
+
fields: dict[str, str] = {}
|
|
20
|
+
offset = 0
|
|
21
|
+
while offset < len(value):
|
|
22
|
+
match = _CONNECTION_PART.match(value, offset)
|
|
23
|
+
if match is None:
|
|
24
|
+
raise ValueError("Invalid connection_string")
|
|
25
|
+
key, target = match.group(1).casefold(), match.group(2)
|
|
26
|
+
if key not in {"file", "srvr", "ref"} or key in fields or not target:
|
|
27
|
+
raise ValueError("Invalid connection_string")
|
|
28
|
+
if any(ord(character) < 32 for character in target):
|
|
29
|
+
raise ValueError("Invalid connection_string")
|
|
30
|
+
fields[key] = target
|
|
31
|
+
offset = match.end()
|
|
32
|
+
if not value[offset:].strip():
|
|
33
|
+
break
|
|
34
|
+
if set(fields) == {"file"}:
|
|
35
|
+
return fields["file"], None
|
|
36
|
+
if set(fields) == {"srvr", "ref"}:
|
|
37
|
+
return None, fields["srvr"] + "\\" + fields["ref"]
|
|
38
|
+
raise ValueError("Invalid connection_string")
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
def _default_workspace(file_path: str | None, server_infobase: str | None) -> Path:
|
|
42
|
+
if os.name == "nt":
|
|
43
|
+
user_state = os.environ.get("LOCALAPPDATA") or Path.home() / "AppData" / "Local"
|
|
44
|
+
else:
|
|
45
|
+
user_state = os.environ.get("XDG_STATE_HOME") or Path.home() / ".local" / "state"
|
|
46
|
+
if file_path is not None:
|
|
47
|
+
identity = "file:" + str(Path(file_path).resolve())
|
|
48
|
+
if os.name == "nt":
|
|
49
|
+
identity = identity.casefold()
|
|
50
|
+
elif server_infobase is not None:
|
|
51
|
+
identity = "server:" + server_infobase.casefold()
|
|
52
|
+
else:
|
|
53
|
+
identity = "temporary"
|
|
54
|
+
key = sha256(identity.encode("utf-8")).hexdigest()[:20]
|
|
55
|
+
return Path(user_state) / "onec-interactive-runtime" / "workspaces" / key
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
@dataclass(frozen=True)
|
|
59
|
+
class RuntimeConfig:
|
|
60
|
+
workspace: Path | str | None = None
|
|
61
|
+
platform_bin: Path | str | None = None
|
|
62
|
+
connection_string: str | None = None
|
|
63
|
+
debug_host: str = "127.0.0.1"
|
|
64
|
+
debug_port_from: int = 1550
|
|
65
|
+
debug_port_to: int = 1559
|
|
66
|
+
username: str = ""
|
|
67
|
+
password: str = field(default="", repr=False)
|
|
68
|
+
debug_port: int = 1550
|
|
69
|
+
debug_alias: str | None = None
|
|
70
|
+
_file_path: Path | None = field(default=None, init=False, repr=False)
|
|
71
|
+
_server_infobase: str | None = field(default=None, init=False, repr=False)
|
|
72
|
+
|
|
73
|
+
def __post_init__(self) -> None:
|
|
74
|
+
if self.platform_bin is None:
|
|
75
|
+
raise TypeError("platform_bin is required")
|
|
76
|
+
file_path, server_infobase = (
|
|
77
|
+
_connection_target(self.connection_string)
|
|
78
|
+
if self.connection_string is not None else (None, None)
|
|
79
|
+
)
|
|
80
|
+
if server_infobase is not None:
|
|
81
|
+
if (
|
|
82
|
+
server_infobase.count("\\") != 1
|
|
83
|
+
or any(character in server_infobase for character in ';"/')
|
|
84
|
+
or any(ord(character) < 32 for character in server_infobase)
|
|
85
|
+
or any(not part or part != part.strip() for part in server_infobase.split("\\"))
|
|
86
|
+
):
|
|
87
|
+
raise ValueError("Invalid connection_string")
|
|
88
|
+
if type(self.debug_port) is not int or not 0 < self.debug_port <= 65535:
|
|
89
|
+
raise ValueError("Invalid debug_port")
|
|
90
|
+
if self.debug_alias is not None and (
|
|
91
|
+
not isinstance(self.debug_alias, str)
|
|
92
|
+
or not self.debug_alias.strip()
|
|
93
|
+
or any(ord(character) < 32 for character in self.debug_alias)
|
|
94
|
+
):
|
|
95
|
+
raise ValueError("Invalid debug_alias")
|
|
96
|
+
workspace = self.workspace
|
|
97
|
+
if workspace is None:
|
|
98
|
+
workspace = _default_workspace(file_path, server_infobase)
|
|
99
|
+
object.__setattr__(self, "workspace", Path(workspace).resolve())
|
|
100
|
+
object.__setattr__(self, "platform_bin", Path(self.platform_bin).resolve())
|
|
101
|
+
if file_path is not None:
|
|
102
|
+
object.__setattr__(self, "_file_path", Path(file_path).resolve())
|
|
103
|
+
object.__setattr__(self, "_server_infobase", server_infobase)
|
|
104
|
+
executables = (self.designer_exe, self.client_exe)
|
|
105
|
+
if not self.is_server_infobase:
|
|
106
|
+
executables += (self.debug_server_exe,)
|
|
107
|
+
for executable in executables:
|
|
108
|
+
if not executable.is_file():
|
|
109
|
+
raise ValueError(
|
|
110
|
+
f"Required 1C executable is missing: {executable.name}"
|
|
111
|
+
)
|
|
112
|
+
if not (0 < self.debug_port_from <= self.debug_port_to <= 65535):
|
|
113
|
+
raise ValueError("Invalid debug server port range")
|
|
114
|
+
if (
|
|
115
|
+
self._file_path is not None
|
|
116
|
+
and not (self._file_path / "1Cv8.1CD").is_file()
|
|
117
|
+
):
|
|
118
|
+
raise ValueError("External infobase must contain 1Cv8.1CD")
|
|
119
|
+
|
|
120
|
+
@property
|
|
121
|
+
def designer_exe(self) -> Path:
|
|
122
|
+
return self.platform_bin / "1cv8.exe"
|
|
123
|
+
|
|
124
|
+
@property
|
|
125
|
+
def client_exe(self) -> Path:
|
|
126
|
+
return self.platform_bin / "1cv8c.exe"
|
|
127
|
+
|
|
128
|
+
@property
|
|
129
|
+
def debug_server_exe(self) -> Path:
|
|
130
|
+
return self.platform_bin / "dbgs.exe"
|
|
131
|
+
|
|
132
|
+
@property
|
|
133
|
+
def runtime_dir(self) -> Path:
|
|
134
|
+
return self.workspace / ".runtime"
|
|
135
|
+
|
|
136
|
+
@property
|
|
137
|
+
def infobase_dir(self) -> Path:
|
|
138
|
+
if self.is_server_infobase:
|
|
139
|
+
raise ValueError("A server infobase has no local database directory")
|
|
140
|
+
if self._file_path is not None:
|
|
141
|
+
return self._file_path
|
|
142
|
+
return self.runtime_dir / "infobase"
|
|
143
|
+
|
|
144
|
+
@property
|
|
145
|
+
def uses_external_infobase(self) -> bool:
|
|
146
|
+
return self._file_path is not None or self.is_server_infobase
|
|
147
|
+
|
|
148
|
+
@property
|
|
149
|
+
def is_server_infobase(self) -> bool:
|
|
150
|
+
return self._server_infobase is not None
|
|
151
|
+
|
|
152
|
+
@property
|
|
153
|
+
def infobase_arguments(self) -> tuple[str, str]:
|
|
154
|
+
if self._server_infobase is not None:
|
|
155
|
+
return "/S", self._server_infobase
|
|
156
|
+
return "/F", str(self.infobase_dir)
|
|
157
|
+
|
|
158
|
+
@property
|
|
159
|
+
def infobase_identity(self) -> str:
|
|
160
|
+
if self._server_infobase is not None:
|
|
161
|
+
return "server:" + self._server_infobase.casefold()
|
|
162
|
+
return str(self.infobase_dir.resolve())
|
|
163
|
+
|
|
164
|
+
@property
|
|
165
|
+
def server_target_type(self) -> str:
|
|
166
|
+
return "Server" if self.is_server_infobase else "ServerEmulation"
|
|
167
|
+
|
|
168
|
+
@property
|
|
169
|
+
def infobase_debug_alias(self) -> str:
|
|
170
|
+
if self.debug_alias is not None:
|
|
171
|
+
return self.debug_alias
|
|
172
|
+
if self._server_infobase is not None:
|
|
173
|
+
return self._server_infobase.split("\\", 1)[1]
|
|
174
|
+
return "DefAlias"
|
|
175
|
+
|
|
176
|
+
@property
|
|
177
|
+
def build_infobase_dir(self) -> Path:
|
|
178
|
+
return self.runtime_dir / "build-infobase"
|
|
179
|
+
|
|
180
|
+
@property
|
|
181
|
+
def build_dir(self) -> Path:
|
|
182
|
+
return self.runtime_dir / "build"
|
|
183
|
+
|
|
184
|
+
@property
|
|
185
|
+
def kernel_epf(self) -> Path:
|
|
186
|
+
return self.build_dir / "Kernel.epf"
|
|
187
|
+
|
|
188
|
+
@property
|
|
189
|
+
def worker_epf(self) -> Path:
|
|
190
|
+
return self.build_dir / "Worker.epf"
|
|
191
|
+
|
|
192
|
+
@property
|
|
193
|
+
def logs_dir(self) -> Path:
|
|
194
|
+
return self.runtime_dir / "logs"
|
|
195
|
+
|
|
196
|
+
@property
|
|
197
|
+
def artifacts_dir(self) -> Path:
|
|
198
|
+
return self.workspace / "artifacts"
|