File size: 1,972 Bytes
399b80c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
"""
    RecordingManager
      β”œβ”€β”€ internal management of platform.RecordingClient
      β”œβ”€β”€ internal management of platform.ScreenshotClient
      β”œβ”€β”€ internal management of TrajectoryRecorder
      └── internal management of ActionRecorder
"""

from importlib import import_module

__all__ = [
    'RecordingManager',
    'TrajectoryRecorder',
    'ActionRecorder',
    'load_trajectory_from_jsonl',
    'load_metadata',
    'format_trajectory_for_export',
    'analyze_trajectory',
    'load_recording_session',
    'filter_trajectory',
    'extract_errors',
    'generate_summary_report',
    'load_agent_actions',
    'analyze_agent_actions',
    'format_agent_actions',
]

_EXPORTS = {
    'RecordingManager': ('.manager', 'RecordingManager'),
    'TrajectoryRecorder': ('.recorder', 'TrajectoryRecorder'),
    'ActionRecorder': ('.action_recorder', 'ActionRecorder'),
    'load_trajectory_from_jsonl': ('.utils', 'load_trajectory_from_jsonl'),
    'load_metadata': ('.utils', 'load_metadata'),
    'format_trajectory_for_export': ('.utils', 'format_trajectory_for_export'),
    'analyze_trajectory': ('.utils', 'analyze_trajectory'),
    'load_recording_session': ('.utils', 'load_recording_session'),
    'filter_trajectory': ('.utils', 'filter_trajectory'),
    'extract_errors': ('.utils', 'extract_errors'),
    'generate_summary_report': ('.utils', 'generate_summary_report'),
    'load_agent_actions': ('.action_recorder', 'load_agent_actions'),
    'analyze_agent_actions': ('.action_recorder', 'analyze_agent_actions'),
    'format_agent_actions': ('.action_recorder', 'format_agent_actions'),
}


def __getattr__(name: str):
    try:
        module_name, attr_name = _EXPORTS[name]
    except KeyError as exc:
        raise AttributeError(f'module {__name__!r} has no attribute {name!r}') from exc
    module = import_module(module_name, __name__)
    value = getattr(module, attr_name)
    globals()[name] = value
    return value