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/recovery.py
ADDED
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from dataclasses import dataclass
|
|
4
|
+
from enum import Enum
|
|
5
|
+
from uuid import UUID
|
|
6
|
+
|
|
7
|
+
from onec_runtime.errors import RecoveryIdentityMismatch
|
|
8
|
+
from onec_runtime.rdbg.models import DebugTarget, ModuleLocation, StopEvent
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class RecoveryPhase(str, Enum):
|
|
12
|
+
CAPTURED = "captured"
|
|
13
|
+
FLUSHING = "flushing"
|
|
14
|
+
RESUMING = "resuming"
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
class RecoveryOutcome(str, Enum):
|
|
18
|
+
RECOVERED = "recovered"
|
|
19
|
+
LOST = "lost"
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
class SideEffectStatus(str, Enum):
|
|
23
|
+
PLANNED = "planned"
|
|
24
|
+
SENT = "sent"
|
|
25
|
+
ACKNOWLEDGED = "acknowledged"
|
|
26
|
+
SUCCEEDED = "succeeded"
|
|
27
|
+
FAILED = "failed"
|
|
28
|
+
OUTCOME_UNKNOWN = "outcome_unknown"
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
@dataclass(frozen=True, slots=True)
|
|
32
|
+
class RootWriteRecord:
|
|
33
|
+
sequence: int
|
|
34
|
+
root: str
|
|
35
|
+
expression_sha256: str
|
|
36
|
+
status: SideEffectStatus
|
|
37
|
+
result_id: UUID | None
|
|
38
|
+
error: str = ""
|
|
39
|
+
|
|
40
|
+
@property
|
|
41
|
+
def replay_forbidden(self) -> bool:
|
|
42
|
+
return self.status in {
|
|
43
|
+
SideEffectStatus.ACKNOWLEDGED,
|
|
44
|
+
SideEffectStatus.SUCCEEDED,
|
|
45
|
+
SideEffectStatus.FAILED,
|
|
46
|
+
SideEffectStatus.OUTCOME_UNKNOWN,
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
@property
|
|
50
|
+
def succeeded(self) -> bool:
|
|
51
|
+
return self.status is SideEffectStatus.SUCCEEDED
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
@dataclass(frozen=True, slots=True)
|
|
55
|
+
class RecoveryCheckpoint:
|
|
56
|
+
sequence: int
|
|
57
|
+
runtime_generation: int
|
|
58
|
+
operation_id: int
|
|
59
|
+
phase: RecoveryPhase
|
|
60
|
+
target: DebugTarget
|
|
61
|
+
frame_location: ModuleLocation | None
|
|
62
|
+
stop_sequence: int
|
|
63
|
+
breakpoint_workspace: tuple[ModuleLocation, ...]
|
|
64
|
+
write_journal: tuple[RootWriteRecord, ...]
|
|
65
|
+
continue_sent: bool
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
@dataclass(frozen=True, slots=True)
|
|
69
|
+
class RecoveryIdentityEvidence:
|
|
70
|
+
target: DebugTarget
|
|
71
|
+
stop: StopEvent
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
@dataclass(frozen=True, slots=True)
|
|
75
|
+
class RecoveryResult:
|
|
76
|
+
outcome: RecoveryOutcome
|
|
77
|
+
phase: RecoveryPhase
|
|
78
|
+
checkpoint: RecoveryCheckpoint
|
|
79
|
+
reason: str
|
|
80
|
+
continuation: object | None = None
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
def is_paused_target_state(state: str) -> bool:
|
|
84
|
+
return state.casefold() in {"stopped", "stoponnextline"}
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
def validate_paused_identity(
|
|
88
|
+
checkpoint: RecoveryCheckpoint,
|
|
89
|
+
evidence: RecoveryIdentityEvidence,
|
|
90
|
+
) -> None:
|
|
91
|
+
if evidence.target.target_id != checkpoint.target.target_id:
|
|
92
|
+
raise RecoveryIdentityMismatch("Recovered target identity changed")
|
|
93
|
+
if evidence.target.target_type != checkpoint.target.target_type:
|
|
94
|
+
raise RecoveryIdentityMismatch("Recovered target type changed")
|
|
95
|
+
if not is_paused_target_state(evidence.target.state):
|
|
96
|
+
raise RecoveryIdentityMismatch("Recovered target is not stopped")
|
|
97
|
+
if (
|
|
98
|
+
checkpoint.target.state_number is not None
|
|
99
|
+
and evidence.target.state_number is not None
|
|
100
|
+
and evidence.target.state_number != checkpoint.target.state_number
|
|
101
|
+
):
|
|
102
|
+
raise RecoveryIdentityMismatch("Recovered target state number changed")
|
|
103
|
+
if checkpoint.frame_location is None:
|
|
104
|
+
raise RecoveryIdentityMismatch("Checkpoint has no frame-zero location")
|
|
105
|
+
if evidence.stop.location != checkpoint.frame_location:
|
|
106
|
+
raise RecoveryIdentityMismatch("Recovered frame-zero location changed")
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from dataclasses import dataclass
|
|
4
|
+
from datetime import datetime, timezone
|
|
5
|
+
from threading import Lock
|
|
6
|
+
from typing import Callable
|
|
7
|
+
|
|
8
|
+
from onec_runtime.privacy import public_artifact_value
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
AppendJsonl = Callable[[str, object], None]
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
@dataclass(frozen=True, slots=True)
|
|
15
|
+
class JournalEvent:
|
|
16
|
+
sequence: int
|
|
17
|
+
timestamp: str
|
|
18
|
+
stream: str
|
|
19
|
+
event: str
|
|
20
|
+
fields: dict[str, object]
|
|
21
|
+
|
|
22
|
+
def as_json(self) -> dict[str, object]:
|
|
23
|
+
return {
|
|
24
|
+
"sequence": self.sequence,
|
|
25
|
+
"timestamp": self.timestamp,
|
|
26
|
+
"event": self.event,
|
|
27
|
+
**self.fields,
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
class RecoveryJournal:
|
|
32
|
+
def __init__(self, sink: AppendJsonl | None = None) -> None:
|
|
33
|
+
self._sink = sink
|
|
34
|
+
self._lock = Lock()
|
|
35
|
+
# Serialize the complete snapshot -> sink -> retire loop without
|
|
36
|
+
# holding the state lock across user I/O. ``record`` may therefore be
|
|
37
|
+
# called by another thread (or by the sink itself), while recursive
|
|
38
|
+
# ``flush`` from the sink is deliberately unsupported.
|
|
39
|
+
self._flush_lock = Lock()
|
|
40
|
+
self._events: list[JournalEvent] = []
|
|
41
|
+
self._pending: list[JournalEvent] = []
|
|
42
|
+
|
|
43
|
+
@property
|
|
44
|
+
def events(self) -> tuple[JournalEvent, ...]:
|
|
45
|
+
return tuple(self._events)
|
|
46
|
+
|
|
47
|
+
@property
|
|
48
|
+
def pending_count(self) -> int:
|
|
49
|
+
return len(self._pending)
|
|
50
|
+
|
|
51
|
+
def record(self, stream: str, event: str, **fields: object) -> JournalEvent:
|
|
52
|
+
normalized = {key: public_artifact_value(value) for key, value in fields.items()}
|
|
53
|
+
with self._lock:
|
|
54
|
+
item = JournalEvent(
|
|
55
|
+
sequence=len(self._events) + 1,
|
|
56
|
+
timestamp=datetime.now(timezone.utc).isoformat(timespec="milliseconds"),
|
|
57
|
+
stream=stream,
|
|
58
|
+
event=event,
|
|
59
|
+
fields=normalized,
|
|
60
|
+
)
|
|
61
|
+
self._events.append(item)
|
|
62
|
+
self._pending.append(item)
|
|
63
|
+
return item
|
|
64
|
+
|
|
65
|
+
def flush(self) -> None:
|
|
66
|
+
with self._flush_lock:
|
|
67
|
+
with self._lock:
|
|
68
|
+
pending = tuple(self._pending)
|
|
69
|
+
if self._sink is None:
|
|
70
|
+
with self._lock:
|
|
71
|
+
del self._pending[: len(pending)]
|
|
72
|
+
return
|
|
73
|
+
for item in pending:
|
|
74
|
+
self._sink(item.stream, item.as_json())
|
|
75
|
+
with self._lock:
|
|
76
|
+
# Concurrent records append after this snapshot; retire
|
|
77
|
+
# only the committed prefix and never a later append.
|
|
78
|
+
if self._pending and self._pending[0] is item:
|
|
79
|
+
del self._pending[0]
|
|
Binary file
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
{
|
|
2
|
+
"schema_version": 1,
|
|
3
|
+
"product_id": "onec-interactive-runtime",
|
|
4
|
+
"extension_name": "OnecInteractiveRuntime",
|
|
5
|
+
"artifact_version": "0.1.2",
|
|
6
|
+
"protocol_version": "1",
|
|
7
|
+
"cfe_filename": "OnecInteractiveRuntime.cfe",
|
|
8
|
+
"cfe_size": 20556,
|
|
9
|
+
"cfe_sha256": "d052016b6f95540de0a498c191506217ef2b5b70f8ac4992cb821322e92aa06c",
|
|
10
|
+
"fingerprints": {
|
|
11
|
+
"identity": {
|
|
12
|
+
"product_id": "onec-interactive-runtime",
|
|
13
|
+
"extension_name": "OnecInteractiveRuntime",
|
|
14
|
+
"root_id": "fcac7610-e58e-4c3b-b637-9d809453a8a2",
|
|
15
|
+
"runtime_module_ids": [
|
|
16
|
+
"33445a61-8047-40aa-8144-690175755340",
|
|
17
|
+
"403bd06b-17d6-4171-94d6-e38fc5f8a585",
|
|
18
|
+
"4a0aa21a-4046-47f7-8421-5eeb79d0e9f0",
|
|
19
|
+
"c8a390d7-e463-4413-ae75-2bb83ce8c299"
|
|
20
|
+
],
|
|
21
|
+
"purpose": "AddOn",
|
|
22
|
+
"name_prefix": "OnecInteractiveRuntime_",
|
|
23
|
+
"vendor": "onec-interactive-runtime"
|
|
24
|
+
},
|
|
25
|
+
"artifact": {
|
|
26
|
+
"artifact_version": "0.1.2",
|
|
27
|
+
"protocol_version": "1",
|
|
28
|
+
"language_bound_by_name": false,
|
|
29
|
+
"metadata": [
|
|
30
|
+
{
|
|
31
|
+
"name": "CommonModule.RuntimeContextStoreServer",
|
|
32
|
+
"object_id": "c8a390d7-e463-4413-ae75-2bb83ce8c299"
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
"name": "CommonModule.RuntimeContextStoreServer.Module",
|
|
36
|
+
"object_id": "c8a390d7-e463-4413-ae75-2bb83ce8c299"
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
"name": "CommonModule.RuntimeKernelServer",
|
|
40
|
+
"object_id": "4a0aa21a-4046-47f7-8421-5eeb79d0e9f0"
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
"name": "CommonModule.RuntimeKernelServer.Module",
|
|
44
|
+
"object_id": "4a0aa21a-4046-47f7-8421-5eeb79d0e9f0"
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
"name": "CommonModule.RuntimeTableTransferServer",
|
|
48
|
+
"object_id": "33445a61-8047-40aa-8144-690175755340"
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
"name": "CommonModule.RuntimeTableTransferServer.Module",
|
|
52
|
+
"object_id": "33445a61-8047-40aa-8144-690175755340"
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
"name": "CommonModule.RuntimeValueTransferServer",
|
|
56
|
+
"object_id": "403bd06b-17d6-4171-94d6-e38fc5f8a585"
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
"name": "CommonModule.RuntimeValueTransferServer.Module",
|
|
60
|
+
"object_id": "403bd06b-17d6-4171-94d6-e38fc5f8a585"
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
"name": "Configuration.OnecInteractiveRuntime",
|
|
64
|
+
"object_id": "fcac7610-e58e-4c3b-b637-9d809453a8a2"
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
"name": "Configuration.OnecInteractiveRuntime.ManagedApplicationModule",
|
|
68
|
+
"object_id": "96ff5058-0bc6-4207-935b-3cb72a166691"
|
|
69
|
+
}
|
|
70
|
+
],
|
|
71
|
+
"source_sha256": {
|
|
72
|
+
"CommonModules/RuntimeKernelServer/Ext/Module.bsl": "fe05d7264bb4470d349e577ce967a054f96854b40cdea4dc6b02739208afc3b6",
|
|
73
|
+
"Ext/ManagedApplicationModule.bsl": "d58c93d80b76a813191f20e593ec96c2610d21dc4cd0f86d450c9bcea589cd2c"
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
"identity_sha256": "726065a5d3c6f5472e24a83fc0c474fd5f13c42eace441b90c7eba1b404df496",
|
|
77
|
+
"artifact_sha256": "e4147b6d09ca927d9e87a82f4beac35797b643b48480f0d59e3c7dfc87176f04"
|
|
78
|
+
},
|
|
79
|
+
"breakpoints": {
|
|
80
|
+
"managed": {
|
|
81
|
+
"module_type": "ExtensionModule",
|
|
82
|
+
"url": "",
|
|
83
|
+
"object_id": "fcac7610-e58e-4c3b-b637-9d809453a8a2",
|
|
84
|
+
"property_id": "d22e852a-cf8a-4f77-8ccb-3548e7792bea",
|
|
85
|
+
"line": 7,
|
|
86
|
+
"extension_name": "OnecInteractiveRuntime",
|
|
87
|
+
"ext_id": 0
|
|
88
|
+
},
|
|
89
|
+
"server_entry": {
|
|
90
|
+
"module_type": "ExtensionModule",
|
|
91
|
+
"url": "",
|
|
92
|
+
"object_id": "4a0aa21a-4046-47f7-8421-5eeb79d0e9f0",
|
|
93
|
+
"property_id": "d5963243-262e-4398-b4d7-fb16d06484f6",
|
|
94
|
+
"line": 110,
|
|
95
|
+
"extension_name": "OnecInteractiveRuntime",
|
|
96
|
+
"ext_id": 0
|
|
97
|
+
},
|
|
98
|
+
"server_service": {
|
|
99
|
+
"module_type": "ExtensionModule",
|
|
100
|
+
"url": "",
|
|
101
|
+
"object_id": "4a0aa21a-4046-47f7-8421-5eeb79d0e9f0",
|
|
102
|
+
"property_id": "d5963243-262e-4398-b4d7-fb16d06484f6",
|
|
103
|
+
"line": 117,
|
|
104
|
+
"extension_name": "OnecInteractiveRuntime",
|
|
105
|
+
"ext_id": 0
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|