nodepyx 1.0.0
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.
- package/LICENSE +22 -0
- package/README.md +399 -0
- package/binding.gyp +73 -0
- package/dist/core/PyCallable.d.ts +65 -0
- package/dist/core/PyCallable.d.ts.map +1 -0
- package/dist/core/PyCallable.js +109 -0
- package/dist/core/PyCallable.js.map +1 -0
- package/dist/core/PyContext.d.ts +76 -0
- package/dist/core/PyContext.d.ts.map +1 -0
- package/dist/core/PyContext.js +228 -0
- package/dist/core/PyContext.js.map +1 -0
- package/dist/core/PyIterator.d.ts +84 -0
- package/dist/core/PyIterator.d.ts.map +1 -0
- package/dist/core/PyIterator.js +243 -0
- package/dist/core/PyIterator.js.map +1 -0
- package/dist/core/PyModule.d.ts +55 -0
- package/dist/core/PyModule.d.ts.map +1 -0
- package/dist/core/PyModule.js +172 -0
- package/dist/core/PyModule.js.map +1 -0
- package/dist/core/PyProxy.d.ts +65 -0
- package/dist/core/PyProxy.d.ts.map +1 -0
- package/dist/core/PyProxy.js +483 -0
- package/dist/core/PyProxy.js.map +1 -0
- package/dist/core/PyRuntime.d.ts +105 -0
- package/dist/core/PyRuntime.d.ts.map +1 -0
- package/dist/core/PyRuntime.js +438 -0
- package/dist/core/PyRuntime.js.map +1 -0
- package/dist/env/CondaManager.d.ts +118 -0
- package/dist/env/CondaManager.d.ts.map +1 -0
- package/dist/env/CondaManager.js +401 -0
- package/dist/env/CondaManager.js.map +1 -0
- package/dist/env/PackageInstaller.d.ts +233 -0
- package/dist/env/PackageInstaller.d.ts.map +1 -0
- package/dist/env/PackageInstaller.js +609 -0
- package/dist/env/PackageInstaller.js.map +1 -0
- package/dist/env/PythonDetector.d.ts +103 -0
- package/dist/env/PythonDetector.d.ts.map +1 -0
- package/dist/env/PythonDetector.js +381 -0
- package/dist/env/PythonDetector.js.map +1 -0
- package/dist/env/VenvManager.d.ts +117 -0
- package/dist/env/VenvManager.d.ts.map +1 -0
- package/dist/env/VenvManager.js +331 -0
- package/dist/env/VenvManager.js.map +1 -0
- package/dist/index.d.ts +169 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +393 -0
- package/dist/index.js.map +1 -0
- package/dist/plugins/Plugin.interface.d.ts +41 -0
- package/dist/plugins/Plugin.interface.d.ts.map +1 -0
- package/dist/plugins/Plugin.interface.js +12 -0
- package/dist/plugins/Plugin.interface.js.map +1 -0
- package/dist/plugins/PluginManager.d.ts +26 -0
- package/dist/plugins/PluginManager.d.ts.map +1 -0
- package/dist/plugins/PluginManager.js +174 -0
- package/dist/plugins/PluginManager.js.map +1 -0
- package/dist/plugins/builtin/NumpyPlugin.d.ts +17 -0
- package/dist/plugins/builtin/NumpyPlugin.d.ts.map +1 -0
- package/dist/plugins/builtin/NumpyPlugin.js +41 -0
- package/dist/plugins/builtin/NumpyPlugin.js.map +1 -0
- package/dist/plugins/builtin/PandasPlugin.d.ts +19 -0
- package/dist/plugins/builtin/PandasPlugin.d.ts.map +1 -0
- package/dist/plugins/builtin/PandasPlugin.js +57 -0
- package/dist/plugins/builtin/PandasPlugin.js.map +1 -0
- package/dist/plugins/builtin/TorchPlugin.d.ts +23 -0
- package/dist/plugins/builtin/TorchPlugin.d.ts.map +1 -0
- package/dist/plugins/builtin/TorchPlugin.js +50 -0
- package/dist/plugins/builtin/TorchPlugin.js.map +1 -0
- package/dist/plugins/index.d.ts +7 -0
- package/dist/plugins/index.d.ts.map +1 -0
- package/dist/plugins/index.js +12 -0
- package/dist/plugins/index.js.map +1 -0
- package/dist/serialization/DataFrameBridge.d.ts +141 -0
- package/dist/serialization/DataFrameBridge.d.ts.map +1 -0
- package/dist/serialization/DataFrameBridge.js +355 -0
- package/dist/serialization/DataFrameBridge.js.map +1 -0
- package/dist/serialization/MsgPackSerializer.d.ts +45 -0
- package/dist/serialization/MsgPackSerializer.d.ts.map +1 -0
- package/dist/serialization/MsgPackSerializer.js +242 -0
- package/dist/serialization/MsgPackSerializer.js.map +1 -0
- package/dist/serialization/NumpyBridge.d.ts +96 -0
- package/dist/serialization/NumpyBridge.d.ts.map +1 -0
- package/dist/serialization/NumpyBridge.js +323 -0
- package/dist/serialization/NumpyBridge.js.map +1 -0
- package/dist/serialization/Serializer.d.ts +78 -0
- package/dist/serialization/Serializer.d.ts.map +1 -0
- package/dist/serialization/Serializer.js +281 -0
- package/dist/serialization/Serializer.js.map +1 -0
- package/dist/types/PythonTypeMapper.d.ts +87 -0
- package/dist/types/PythonTypeMapper.d.ts.map +1 -0
- package/dist/types/PythonTypeMapper.js +449 -0
- package/dist/types/PythonTypeMapper.js.map +1 -0
- package/dist/types/StubCache.d.ts +109 -0
- package/dist/types/StubCache.d.ts.map +1 -0
- package/dist/types/StubCache.js +333 -0
- package/dist/types/StubCache.js.map +1 -0
- package/dist/types/TypeGenerator.d.ts +139 -0
- package/dist/types/TypeGenerator.d.ts.map +1 -0
- package/dist/types/TypeGenerator.js +372 -0
- package/dist/types/TypeGenerator.js.map +1 -0
- package/dist/types/addon.d.ts +114 -0
- package/dist/types/addon.d.ts.map +1 -0
- package/dist/types/addon.js +32 -0
- package/dist/types/addon.js.map +1 -0
- package/dist/types/config.d.ts +175 -0
- package/dist/types/config.d.ts.map +1 -0
- package/dist/types/config.js +35 -0
- package/dist/types/config.js.map +1 -0
- package/dist/types/index.d.ts +10 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +12 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/python.d.ts +235 -0
- package/dist/types/python.d.ts.map +1 -0
- package/dist/types/python.js +7 -0
- package/dist/types/python.js.map +1 -0
- package/dist/utils/ErrorTranslator.d.ts +83 -0
- package/dist/utils/ErrorTranslator.d.ts.map +1 -0
- package/dist/utils/ErrorTranslator.js +210 -0
- package/dist/utils/ErrorTranslator.js.map +1 -0
- package/dist/utils/Logger.d.ts +27 -0
- package/dist/utils/Logger.d.ts.map +1 -0
- package/dist/utils/Logger.js +115 -0
- package/dist/utils/Logger.js.map +1 -0
- package/dist/utils/MemoryMonitor.d.ts +44 -0
- package/dist/utils/MemoryMonitor.d.ts.map +1 -0
- package/dist/utils/MemoryMonitor.js +143 -0
- package/dist/utils/MemoryMonitor.js.map +1 -0
- package/package.json +177 -0
- package/python/error_handler.py +433 -0
- package/python/nodepyx_runtime.py +575 -0
- package/python/serializer.py +379 -0
- package/python/type_inspector.py +288 -0
- package/scripts/build-native.js +68 -0
- package/scripts/download-prebuilds.js +99 -0
- package/scripts/generate-stubs.js +405 -0
- package/scripts/install.js +260 -0
- package/src/core/PyCallable.ts +137 -0
- package/src/core/PyContext.ts +296 -0
- package/src/core/PyIterator.ts +294 -0
- package/src/core/PyModule.ts +194 -0
- package/src/core/PyProxy.ts +605 -0
- package/src/core/PyRuntime.ts +504 -0
- package/src/env/CondaManager.ts +451 -0
- package/src/env/PackageInstaller.ts +738 -0
- package/src/env/PythonDetector.ts +414 -0
- package/src/env/VenvManager.ts +396 -0
- package/src/index.ts +425 -0
- package/src/native/gil_guard.cpp +26 -0
- package/src/native/gil_guard.h +175 -0
- package/src/native/nodepyx_addon.cpp +886 -0
- package/src/native/python_bridge.cpp +790 -0
- package/src/native/python_bridge.h +257 -0
- package/src/native/thread_pool.cpp +336 -0
- package/src/native/thread_pool.h +175 -0
- package/src/native/type_converter.cpp +901 -0
- package/src/native/type_converter.h +272 -0
- package/src/nextjs/PyProvider.tsx +123 -0
- package/src/nextjs/index.ts +21 -0
- package/src/nextjs/usePython.ts +106 -0
- package/src/nextjs/withnodepyx.ts +88 -0
- package/src/plugins/Plugin.interface.ts +51 -0
- package/src/plugins/PluginManager.ts +155 -0
- package/src/plugins/builtin/NumpyPlugin.ts +36 -0
- package/src/plugins/builtin/PandasPlugin.ts +49 -0
- package/src/plugins/builtin/TorchPlugin.ts +56 -0
- package/src/plugins/index.ts +7 -0
- package/src/serialization/DataFrameBridge.ts +398 -0
- package/src/serialization/MsgPackSerializer.ts +220 -0
- package/src/serialization/NumpyBridge.ts +332 -0
- package/src/serialization/Serializer.ts +320 -0
- package/src/types/PythonTypeMapper.ts +495 -0
- package/src/types/StubCache.ts +340 -0
- package/src/types/TypeGenerator.ts +491 -0
- package/src/types/addon.ts +170 -0
- package/src/types/config.ts +226 -0
- package/src/types/index.ts +55 -0
- package/src/types/python.ts +309 -0
- package/src/types/stubs/numpy.d.ts +441 -0
- package/src/types/stubs/pandas.d.ts +575 -0
- package/src/types/stubs/sklearn.d.ts +728 -0
- package/src/types/stubs/torch.d.ts +694 -0
- package/src/utils/ErrorTranslator.ts +220 -0
- package/src/utils/Logger.ts +119 -0
- package/src/utils/MemoryMonitor.ts +175 -0
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* nodepyx — Error Translator
|
|
4
|
+
* Converts Python exceptions into proper JavaScript Error subclasses.
|
|
5
|
+
* Preserves full traceback, exception type, and chained causes.
|
|
6
|
+
*/
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
exports.nodepyxShutdownError = exports.nodepyxNotInitializedError = exports.PythonTimeoutError = exports.PythonStopIteration = exports.PythonMemoryError = exports.PythonRuntimeError = exports.PythonPermissionError = exports.PythonFileNotFoundError = exports.PythonModuleNotFoundError = exports.PythonImportError = exports.PythonAttributeError = exports.PythonIndexError = exports.PythonKeyError = exports.PythonTypeError = exports.PythonValueError = exports.PythonError = void 0;
|
|
9
|
+
exports.translatePythonError = translatePythonError;
|
|
10
|
+
exports.isPythonError = isPythonError;
|
|
11
|
+
exports.isPythonErrorOfType = isPythonErrorOfType;
|
|
12
|
+
/**
|
|
13
|
+
* Base class for all Python-originating errors.
|
|
14
|
+
* Provides access to Python-specific error metadata.
|
|
15
|
+
*/
|
|
16
|
+
class PythonError extends Error {
|
|
17
|
+
/** Python exception class name (e.g. 'ValueError', 'FileNotFoundError') */
|
|
18
|
+
pythonType;
|
|
19
|
+
/** Python module where the exception originated */
|
|
20
|
+
pythonModule;
|
|
21
|
+
/** Full Python traceback string */
|
|
22
|
+
traceback;
|
|
23
|
+
/** Original PyErrorInfo object */
|
|
24
|
+
pyErrorInfo;
|
|
25
|
+
constructor(info) {
|
|
26
|
+
super(`[Python ${info.type}] ${info.message}`);
|
|
27
|
+
this.name = 'PythonError';
|
|
28
|
+
this.pythonType = info.type;
|
|
29
|
+
this.pythonModule = info.module ?? 'builtins';
|
|
30
|
+
this.traceback = info.traceback;
|
|
31
|
+
this.pyErrorInfo = info;
|
|
32
|
+
// Maintain proper prototype chain
|
|
33
|
+
Object.setPrototypeOf(this, new.target.prototype);
|
|
34
|
+
// Capture stack trace
|
|
35
|
+
if (Error.captureStackTrace) {
|
|
36
|
+
Error.captureStackTrace(this, PythonError);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
/** Format error with Python traceback for display */
|
|
40
|
+
format() {
|
|
41
|
+
return [
|
|
42
|
+
`PythonError: ${this.pythonType}: ${this.pyErrorInfo.message}`,
|
|
43
|
+
'',
|
|
44
|
+
'--- Python Traceback ---',
|
|
45
|
+
this.traceback,
|
|
46
|
+
'--- Node.js Stack ---',
|
|
47
|
+
this.stack ?? '',
|
|
48
|
+
].join('\n');
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
exports.PythonError = PythonError;
|
|
52
|
+
// ─── Specific Python Exception Subclasses ──────────────────────────────────
|
|
53
|
+
class PythonValueError extends PythonError {
|
|
54
|
+
constructor(info) {
|
|
55
|
+
super(info);
|
|
56
|
+
this.name = 'PythonValueError';
|
|
57
|
+
Object.setPrototypeOf(this, new.target.prototype);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
exports.PythonValueError = PythonValueError;
|
|
61
|
+
class PythonTypeError extends PythonError {
|
|
62
|
+
constructor(info) {
|
|
63
|
+
super(info);
|
|
64
|
+
this.name = 'PythonTypeError';
|
|
65
|
+
Object.setPrototypeOf(this, new.target.prototype);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
exports.PythonTypeError = PythonTypeError;
|
|
69
|
+
class PythonKeyError extends PythonError {
|
|
70
|
+
constructor(info) {
|
|
71
|
+
super(info);
|
|
72
|
+
this.name = 'PythonKeyError';
|
|
73
|
+
Object.setPrototypeOf(this, new.target.prototype);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
exports.PythonKeyError = PythonKeyError;
|
|
77
|
+
class PythonIndexError extends PythonError {
|
|
78
|
+
constructor(info) {
|
|
79
|
+
super(info);
|
|
80
|
+
this.name = 'PythonIndexError';
|
|
81
|
+
Object.setPrototypeOf(this, new.target.prototype);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
exports.PythonIndexError = PythonIndexError;
|
|
85
|
+
class PythonAttributeError extends PythonError {
|
|
86
|
+
constructor(info) {
|
|
87
|
+
super(info);
|
|
88
|
+
this.name = 'PythonAttributeError';
|
|
89
|
+
Object.setPrototypeOf(this, new.target.prototype);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
exports.PythonAttributeError = PythonAttributeError;
|
|
93
|
+
class PythonImportError extends PythonError {
|
|
94
|
+
constructor(info) {
|
|
95
|
+
super(info);
|
|
96
|
+
this.name = 'PythonImportError';
|
|
97
|
+
Object.setPrototypeOf(this, new.target.prototype);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
exports.PythonImportError = PythonImportError;
|
|
101
|
+
class PythonModuleNotFoundError extends PythonImportError {
|
|
102
|
+
constructor(info) {
|
|
103
|
+
super(info);
|
|
104
|
+
this.name = 'PythonModuleNotFoundError';
|
|
105
|
+
Object.setPrototypeOf(this, new.target.prototype);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
exports.PythonModuleNotFoundError = PythonModuleNotFoundError;
|
|
109
|
+
class PythonFileNotFoundError extends PythonError {
|
|
110
|
+
constructor(info) {
|
|
111
|
+
super(info);
|
|
112
|
+
this.name = 'PythonFileNotFoundError';
|
|
113
|
+
Object.setPrototypeOf(this, new.target.prototype);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
exports.PythonFileNotFoundError = PythonFileNotFoundError;
|
|
117
|
+
class PythonPermissionError extends PythonError {
|
|
118
|
+
constructor(info) {
|
|
119
|
+
super(info);
|
|
120
|
+
this.name = 'PythonPermissionError';
|
|
121
|
+
Object.setPrototypeOf(this, new.target.prototype);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
exports.PythonPermissionError = PythonPermissionError;
|
|
125
|
+
class PythonRuntimeError extends PythonError {
|
|
126
|
+
constructor(info) {
|
|
127
|
+
super(info);
|
|
128
|
+
this.name = 'PythonRuntimeError';
|
|
129
|
+
Object.setPrototypeOf(this, new.target.prototype);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
exports.PythonRuntimeError = PythonRuntimeError;
|
|
133
|
+
class PythonMemoryError extends PythonError {
|
|
134
|
+
constructor(info) {
|
|
135
|
+
super(info);
|
|
136
|
+
this.name = 'PythonMemoryError';
|
|
137
|
+
Object.setPrototypeOf(this, new.target.prototype);
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
exports.PythonMemoryError = PythonMemoryError;
|
|
141
|
+
class PythonStopIteration extends PythonError {
|
|
142
|
+
constructor(info) {
|
|
143
|
+
super(info);
|
|
144
|
+
this.name = 'PythonStopIteration';
|
|
145
|
+
Object.setPrototypeOf(this, new.target.prototype);
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
exports.PythonStopIteration = PythonStopIteration;
|
|
149
|
+
class PythonTimeoutError extends Error {
|
|
150
|
+
timeoutMs;
|
|
151
|
+
constructor(timeoutMs, operation) {
|
|
152
|
+
super(`Python operation timed out after ${timeoutMs}ms: ${operation}`);
|
|
153
|
+
this.name = 'PythonTimeoutError';
|
|
154
|
+
this.timeoutMs = timeoutMs;
|
|
155
|
+
Object.setPrototypeOf(this, new.target.prototype);
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
exports.PythonTimeoutError = PythonTimeoutError;
|
|
159
|
+
class nodepyxNotInitializedError extends Error {
|
|
160
|
+
constructor(message = 'nodepyx is not initialized. Call nodepyx.init() first.') {
|
|
161
|
+
super(message);
|
|
162
|
+
this.name = 'nodepyxNotInitializedError';
|
|
163
|
+
Object.setPrototypeOf(this, new.target.prototype);
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
exports.nodepyxNotInitializedError = nodepyxNotInitializedError;
|
|
167
|
+
class nodepyxShutdownError extends Error {
|
|
168
|
+
constructor(message = 'nodepyx runtime has been shut down.') {
|
|
169
|
+
super(message);
|
|
170
|
+
this.name = 'nodepyxShutdownError';
|
|
171
|
+
Object.setPrototypeOf(this, new.target.prototype);
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
exports.nodepyxShutdownError = nodepyxShutdownError;
|
|
175
|
+
const EXCEPTION_MAP = {
|
|
176
|
+
ValueError: PythonValueError,
|
|
177
|
+
TypeError: PythonTypeError,
|
|
178
|
+
KeyError: PythonKeyError,
|
|
179
|
+
IndexError: PythonIndexError,
|
|
180
|
+
AttributeError: PythonAttributeError,
|
|
181
|
+
ImportError: PythonImportError,
|
|
182
|
+
ModuleNotFoundError: PythonModuleNotFoundError,
|
|
183
|
+
FileNotFoundError: PythonFileNotFoundError,
|
|
184
|
+
PermissionError: PythonPermissionError,
|
|
185
|
+
RuntimeError: PythonRuntimeError,
|
|
186
|
+
MemoryError: PythonMemoryError,
|
|
187
|
+
StopIteration: PythonStopIteration,
|
|
188
|
+
StopAsyncIteration: PythonStopIteration,
|
|
189
|
+
};
|
|
190
|
+
/**
|
|
191
|
+
* Translates a PyErrorInfo (from the C++ addon) into the appropriate
|
|
192
|
+
* JavaScript Error subclass. Falls back to generic PythonError.
|
|
193
|
+
*/
|
|
194
|
+
function translatePythonError(info) {
|
|
195
|
+
const Ctor = EXCEPTION_MAP[info.type] ?? PythonError;
|
|
196
|
+
return new Ctor(info);
|
|
197
|
+
}
|
|
198
|
+
/**
|
|
199
|
+
* Type guard: checks whether a value is a PythonError.
|
|
200
|
+
*/
|
|
201
|
+
function isPythonError(value) {
|
|
202
|
+
return value instanceof PythonError;
|
|
203
|
+
}
|
|
204
|
+
/**
|
|
205
|
+
* Type guard: checks whether a value is a specific Python exception type.
|
|
206
|
+
*/
|
|
207
|
+
function isPythonErrorOfType(value, pythonType) {
|
|
208
|
+
return value instanceof PythonError && value.pythonType === pythonType;
|
|
209
|
+
}
|
|
210
|
+
//# sourceMappingURL=ErrorTranslator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ErrorTranslator.js","sourceRoot":"","sources":["../../src/utils/ErrorTranslator.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAqMH,oDAGC;AAKD,sCAEC;AAKD,kDAEC;AAlND;;;GAGG;AACH,MAAa,WAAY,SAAQ,KAAK;IACpC,2EAA2E;IAClE,UAAU,CAAS;IAC5B,mDAAmD;IAC1C,YAAY,CAAS;IAC9B,mCAAmC;IAC1B,SAAS,CAAS;IAC3B,kCAAkC;IACzB,WAAW,CAAc;IAElC,YAAY,IAAiB;QAC3B,KAAK,CAAC,WAAW,IAAI,CAAC,IAAI,KAAK,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC;QAC/C,IAAI,CAAC,IAAI,GAAG,aAAa,CAAC;QAC1B,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC;QAC5B,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,MAAM,IAAI,UAAU,CAAC;QAC9C,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC;QAChC,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC;QAExB,kCAAkC;QAClC,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,GAAG,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;QAElD,sBAAsB;QACtB,IAAI,KAAK,CAAC,iBAAiB,EAAE,CAAC;YAC5B,KAAK,CAAC,iBAAiB,CAAC,IAAI,EAAE,WAAW,CAAC,CAAC;QAC7C,CAAC;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AU,KAAK,UAAU,CAAC;AACzE,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* nodepyx — Logger
|
|
3
|
+
* Structured logger with level filtering and colorized output.
|
|
4
|
+
*/
|
|
5
|
+
import type { LogLevel } from '../types/config';
|
|
6
|
+
export declare class Logger {
|
|
7
|
+
private _level;
|
|
8
|
+
private _prefix;
|
|
9
|
+
private static _globalLevel;
|
|
10
|
+
constructor(prefix: string, level?: LogLevel);
|
|
11
|
+
static setGlobalLevel(level: LogLevel): void;
|
|
12
|
+
setLevel(level: LogLevel): void;
|
|
13
|
+
private _shouldLog;
|
|
14
|
+
private _format;
|
|
15
|
+
error(message: string, data?: unknown): void;
|
|
16
|
+
warn(message: string, data?: unknown): void;
|
|
17
|
+
info(message: string, data?: unknown): void;
|
|
18
|
+
debug(message: string, data?: unknown): void;
|
|
19
|
+
success(message: string, data?: unknown): void;
|
|
20
|
+
time(label: string): () => void;
|
|
21
|
+
child(subPrefix: string): Logger;
|
|
22
|
+
}
|
|
23
|
+
/** Global logger factory */
|
|
24
|
+
export declare function createLogger(prefix: string, level?: LogLevel): Logger;
|
|
25
|
+
/** Default nodepyx logger */
|
|
26
|
+
export declare const logger: Logger;
|
|
27
|
+
//# sourceMappingURL=Logger.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Logger.d.ts","sourceRoot":"","sources":["../../src/utils/Logger.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AA6BhD,qBAAa,MAAM;IACjB,OAAO,CAAC,MAAM,CAAW;IACzB,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,MAAM,CAAC,YAAY,CAAoB;gBAEnC,MAAM,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,QAAQ;IAK5C,MAAM,CAAC,cAAc,CAAC,KAAK,EAAE,QAAQ,GAAG,IAAI;IAI5C,QAAQ,CAAC,KAAK,EAAE,QAAQ,GAAG,IAAI;IAI/B,OAAO,CAAC,UAAU;IAIlB,OAAO,CAAC,OAAO;IAYf,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO,GAAG,IAAI;IAM5C,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO,GAAG,IAAI;IAM3C,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO,GAAG,IAAI;IAM3C,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO,GAAG,IAAI;IAM5C,OAAO,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO,GAAG,IAAI;IAM9C,IAAI,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,IAAI;IAQ/B,KAAK,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM;CAGjC;AAED,4BAA4B;AAC5B,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,QAAQ,GAAG,MAAM,CAErE;AAED,6BAA6B;AAC7B,eAAO,MAAM,MAAM,QAA0B,CAAC"}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* nodepyx — Logger
|
|
4
|
+
* Structured logger with level filtering and colorized output.
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.logger = exports.Logger = void 0;
|
|
8
|
+
exports.createLogger = createLogger;
|
|
9
|
+
const LEVELS = {
|
|
10
|
+
silent: 0,
|
|
11
|
+
error: 1,
|
|
12
|
+
warn: 2,
|
|
13
|
+
info: 3,
|
|
14
|
+
debug: 4,
|
|
15
|
+
};
|
|
16
|
+
const COLORS = {
|
|
17
|
+
reset: '\x1b[0m',
|
|
18
|
+
red: '\x1b[31m',
|
|
19
|
+
yellow: '\x1b[33m',
|
|
20
|
+
cyan: '\x1b[36m',
|
|
21
|
+
gray: '\x1b[90m',
|
|
22
|
+
green: '\x1b[32m',
|
|
23
|
+
blue: '\x1b[34m',
|
|
24
|
+
};
|
|
25
|
+
function colorize(color, text) {
|
|
26
|
+
if (!process.stdout.isTTY) {
|
|
27
|
+
return text;
|
|
28
|
+
}
|
|
29
|
+
return `${COLORS[color]}${text}${COLORS.reset}`;
|
|
30
|
+
}
|
|
31
|
+
function formatTimestamp() {
|
|
32
|
+
return new Date().toISOString().replace('T', ' ').replace('Z', '');
|
|
33
|
+
}
|
|
34
|
+
class Logger {
|
|
35
|
+
_level;
|
|
36
|
+
_prefix;
|
|
37
|
+
static _globalLevel = 'warn';
|
|
38
|
+
constructor(prefix, level) {
|
|
39
|
+
this._prefix = prefix;
|
|
40
|
+
this._level = level ?? Logger._globalLevel;
|
|
41
|
+
}
|
|
42
|
+
static setGlobalLevel(level) {
|
|
43
|
+
Logger._globalLevel = level;
|
|
44
|
+
}
|
|
45
|
+
setLevel(level) {
|
|
46
|
+
this._level = level;
|
|
47
|
+
}
|
|
48
|
+
_shouldLog(level) {
|
|
49
|
+
return LEVELS[level] <= LEVELS[this._level];
|
|
50
|
+
}
|
|
51
|
+
_format(level, message, data) {
|
|
52
|
+
const ts = colorize('gray', formatTimestamp());
|
|
53
|
+
const lvl = level;
|
|
54
|
+
const prefix = colorize('blue', `[${this._prefix}]`);
|
|
55
|
+
let line = `${ts} ${lvl} ${prefix} ${message}`;
|
|
56
|
+
if (data !== undefined) {
|
|
57
|
+
const dataStr = typeof data === 'string' ? data : JSON.stringify(data, null, 2);
|
|
58
|
+
line += `\n${colorize('gray', dataStr)}`;
|
|
59
|
+
}
|
|
60
|
+
return line;
|
|
61
|
+
}
|
|
62
|
+
error(message, data) {
|
|
63
|
+
if (!this._shouldLog('error')) {
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
const lvl = colorize('red', 'ERROR');
|
|
67
|
+
console.error(this._format(lvl, message, data));
|
|
68
|
+
}
|
|
69
|
+
warn(message, data) {
|
|
70
|
+
if (!this._shouldLog('warn')) {
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
const lvl = colorize('yellow', 'WARN ');
|
|
74
|
+
console.warn(this._format(lvl, message, data));
|
|
75
|
+
}
|
|
76
|
+
info(message, data) {
|
|
77
|
+
if (!this._shouldLog('info')) {
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
const lvl = colorize('cyan', 'INFO ');
|
|
81
|
+
console.info(this._format(lvl, message, data));
|
|
82
|
+
}
|
|
83
|
+
debug(message, data) {
|
|
84
|
+
if (!this._shouldLog('debug')) {
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
const lvl = colorize('gray', 'DEBUG');
|
|
88
|
+
console.debug(this._format(lvl, message, data));
|
|
89
|
+
}
|
|
90
|
+
success(message, data) {
|
|
91
|
+
if (!this._shouldLog('info')) {
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
const lvl = colorize('green', 'OK ');
|
|
95
|
+
console.info(this._format(lvl, message, data));
|
|
96
|
+
}
|
|
97
|
+
time(label) {
|
|
98
|
+
const start = performance.now();
|
|
99
|
+
return () => {
|
|
100
|
+
const elapsed = (performance.now() - start).toFixed(2);
|
|
101
|
+
this.debug(`${label} completed in ${elapsed}ms`);
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
child(subPrefix) {
|
|
105
|
+
return new Logger(`${this._prefix}:${subPrefix}`, this._level);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
exports.Logger = Logger;
|
|
109
|
+
/** Global logger factory */
|
|
110
|
+
function createLogger(prefix, level) {
|
|
111
|
+
return new Logger(prefix, level);
|
|
112
|
+
}
|
|
113
|
+
/** Default nodepyx logger */
|
|
114
|
+
exports.logger = createLogger('nodepyx');
|
|
115
|
+
//# sourceMappingURL=Logger.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+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YACV,MAAM,OAAO,GAAG,CAAC,WAAW,CAAC,GAAG,EAAE,GAAG,KAAK,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;YACvD,IAAI,CAAC,KAAK,CAAC,GAAG,KAAK,iBAAiB,OAAO,IAAI,CAAC,CAAC;QACnD,CAAC,CAAC;IACJ,CAAC;IAED,KAAK,CAAC,SAAiB;QACrB,OAAO,IAAI,MAAM,CAAC,GAAG,IAAI,CAAC,OAAO,IAAI,SAAS,EAAE,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;IACjE,CAAC;;AA1EH,wBA2EC;AAED,4BAA4B;AAC5B,SAAgB,YAAY,CAAC,MAAc,EAAE,KAAgB;IAC3D,OAAO,IAAI,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;AACnC,CAAC;AAED,6BAA6B;AAChB,QAAA,MAAM,GAAG,YAAY,CAAC,SAAS,CAAC,CAAC"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* nodepyx — Memory Monitor
|
|
3
|
+
* Tracks Python object references, heap usage, and triggers GC when needed.
|
|
4
|
+
*/
|
|
5
|
+
import type { NativeAddon } from '../types/addon';
|
|
6
|
+
export interface MemorySnapshot {
|
|
7
|
+
timestamp: number;
|
|
8
|
+
pythonHeapBytes: number;
|
|
9
|
+
pythonHeapPeakBytes: number;
|
|
10
|
+
trackedObjects: number;
|
|
11
|
+
pendingCallbacks: number;
|
|
12
|
+
nodeHeapUsed: number;
|
|
13
|
+
nodeHeapTotal: number;
|
|
14
|
+
nodeExternal: number;
|
|
15
|
+
}
|
|
16
|
+
export interface MemoryThresholds {
|
|
17
|
+
/** Trigger GC when Python heap exceeds this (bytes). Default: 1GB */
|
|
18
|
+
gcThreshold: number;
|
|
19
|
+
/** Emit warning when tracked objects exceed this. Default: 10000 */
|
|
20
|
+
objectWarningCount: number;
|
|
21
|
+
/** Emit warning when pending callbacks exceed this. Default: 500 */
|
|
22
|
+
callbackWarningCount: number;
|
|
23
|
+
}
|
|
24
|
+
export declare class MemoryMonitor {
|
|
25
|
+
private readonly _logger;
|
|
26
|
+
private _addon;
|
|
27
|
+
private _snapshots;
|
|
28
|
+
private _maxSnapshots;
|
|
29
|
+
private _monitorInterval;
|
|
30
|
+
private _thresholds;
|
|
31
|
+
private _gcRunning;
|
|
32
|
+
constructor(thresholds?: Partial<MemoryThresholds>);
|
|
33
|
+
attach(addon: NativeAddon): void;
|
|
34
|
+
startMonitoring(intervalMs?: number): void;
|
|
35
|
+
stopMonitoring(): void;
|
|
36
|
+
takeSnapshot(): Promise<MemorySnapshot>;
|
|
37
|
+
getSnapshots(): MemorySnapshot[];
|
|
38
|
+
getLatestSnapshot(): MemorySnapshot | null;
|
|
39
|
+
forceGC(): Promise<void>;
|
|
40
|
+
private _checkMemory;
|
|
41
|
+
private _parseBytes;
|
|
42
|
+
private _formatBytes;
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=MemoryMonitor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MemoryMonitor.d.ts","sourceRoot":"","sources":["../../src/utils/MemoryMonitor.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAElD,MAAM,WAAW,cAAc;IAC7B,SAAS,EAAE,MAAM,CAAC;IAClB,eAAe,EAAE,MAAM,CAAC;IACxB,mBAAmB,EAAE,MAAM,CAAC;IAC5B,cAAc,EAAE,MAAM,CAAC;IACvB,gBAAgB,EAAE,MAAM,CAAC;IACzB,YAAY,EAAE,MAAM,CAAC;IACrB,aAAa,EAAE,MAAM,CAAC;IACtB,YAAY,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,gBAAgB;IAC/B,qEAAqE;IACrE,WAAW,EAAE,MAAM,CAAC;IACpB,oEAAoE;IACpE,kBAAkB,EAAE,MAAM,CAAC;IAC3B,oEAAoE;IACpE,oBAAoB,EAAE,MAAM,CAAC;CAC9B;AAED,qBAAa,aAAa;IACxB,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAS;IACjC,OAAO,CAAC,MAAM,CAA4B;IAC1C,OAAO,CAAC,UAAU,CAAwB;IAC1C,OAAO,CAAC,aAAa,CAAO;IAC5B,OAAO,CAAC,gBAAgB,CAA+B;IACvD,OAAO,CAAC,WAAW,CAAmB;IACtC,OAAO,CAAC,UAAU,CAAS;gBAEf,UAAU,CAAC,EAAE,OAAO,CAAC,gBAAgB,CAAC;IAUlD,MAAM,CAAC,KAAK,EAAE,WAAW,GAAG,IAAI;IAIhC,eAAe,CAAC,UAAU,SAAO,GAAG,IAAI;IAgBxC,cAAc,IAAI,IAAI;IAQhB,YAAY,IAAI,OAAO,CAAC,cAAc,CAAC;IA8B7C,YAAY,IAAI,cAAc,EAAE;IAIhC,iBAAiB,IAAI,cAAc,GAAG,IAAI;IAIpC,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;YAYhB,YAAY;IA2B1B,OAAO,CAAC,WAAW;IAenB,OAAO,CAAC,YAAY;CAMrB"}
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* nodepyx — Memory Monitor
|
|
4
|
+
* Tracks Python object references, heap usage, and triggers GC when needed.
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.MemoryMonitor = void 0;
|
|
8
|
+
const Logger_1 = require("./Logger");
|
|
9
|
+
class MemoryMonitor {
|
|
10
|
+
_logger;
|
|
11
|
+
_addon = null;
|
|
12
|
+
_snapshots = [];
|
|
13
|
+
_maxSnapshots = 100;
|
|
14
|
+
_monitorInterval = null;
|
|
15
|
+
_thresholds;
|
|
16
|
+
_gcRunning = false;
|
|
17
|
+
constructor(thresholds) {
|
|
18
|
+
this._logger = new Logger_1.Logger('MemoryMonitor');
|
|
19
|
+
this._thresholds = {
|
|
20
|
+
gcThreshold: this._parseBytes('1GB'),
|
|
21
|
+
objectWarningCount: 10000,
|
|
22
|
+
callbackWarningCount: 500,
|
|
23
|
+
...thresholds,
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
attach(addon) {
|
|
27
|
+
this._addon = addon;
|
|
28
|
+
}
|
|
29
|
+
startMonitoring(intervalMs = 5000) {
|
|
30
|
+
if (this._monitorInterval) {
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
this._monitorInterval = setInterval(() => {
|
|
34
|
+
this._checkMemory().catch(err => {
|
|
35
|
+
this._logger.error('Memory check failed', err);
|
|
36
|
+
});
|
|
37
|
+
}, intervalMs);
|
|
38
|
+
// Don't keep event loop alive
|
|
39
|
+
if (this._monitorInterval.unref) {
|
|
40
|
+
this._monitorInterval.unref();
|
|
41
|
+
}
|
|
42
|
+
this._logger.debug(`Memory monitoring started (interval: ${intervalMs}ms)`);
|
|
43
|
+
}
|
|
44
|
+
stopMonitoring() {
|
|
45
|
+
if (this._monitorInterval) {
|
|
46
|
+
clearInterval(this._monitorInterval);
|
|
47
|
+
this._monitorInterval = null;
|
|
48
|
+
this._logger.debug('Memory monitoring stopped');
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
async takeSnapshot() {
|
|
52
|
+
const nodeHeap = process.memoryUsage();
|
|
53
|
+
let pythonStats = { pythonHeapBytes: 0, pythonHeapPeakBytes: 0, trackedObjects: 0, pendingCallbacks: 0 };
|
|
54
|
+
if (this._addon) {
|
|
55
|
+
const stats = this._addon.getMemoryStats();
|
|
56
|
+
pythonStats = {
|
|
57
|
+
pythonHeapBytes: stats.pythonHeapBytes,
|
|
58
|
+
pythonHeapPeakBytes: stats.pythonHeapPeakBytes,
|
|
59
|
+
trackedObjects: stats.trackedObjects,
|
|
60
|
+
pendingCallbacks: stats.pendingCallbacks,
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
const snapshot = {
|
|
64
|
+
timestamp: Date.now(),
|
|
65
|
+
...pythonStats,
|
|
66
|
+
nodeHeapUsed: nodeHeap.heapUsed,
|
|
67
|
+
nodeHeapTotal: nodeHeap.heapTotal,
|
|
68
|
+
nodeExternal: nodeHeap.external,
|
|
69
|
+
};
|
|
70
|
+
this._snapshots.push(snapshot);
|
|
71
|
+
if (this._snapshots.length > this._maxSnapshots) {
|
|
72
|
+
this._snapshots.shift();
|
|
73
|
+
}
|
|
74
|
+
return snapshot;
|
|
75
|
+
}
|
|
76
|
+
getSnapshots() {
|
|
77
|
+
return [...this._snapshots];
|
|
78
|
+
}
|
|
79
|
+
getLatestSnapshot() {
|
|
80
|
+
return this._snapshots[this._snapshots.length - 1] ?? null;
|
|
81
|
+
}
|
|
82
|
+
async forceGC() {
|
|
83
|
+
if (this._gcRunning || !this._addon) {
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
this._gcRunning = true;
|
|
87
|
+
try {
|
|
88
|
+
this._logger.debug('Running Python garbage collection...');
|
|
89
|
+
await this._addon.collectGarbage();
|
|
90
|
+
this._logger.debug('Python GC completed');
|
|
91
|
+
}
|
|
92
|
+
finally {
|
|
93
|
+
this._gcRunning = false;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
async _checkMemory() {
|
|
97
|
+
const snapshot = await this.takeSnapshot();
|
|
98
|
+
// Check Python heap threshold
|
|
99
|
+
if (snapshot.pythonHeapBytes > this._thresholds.gcThreshold) {
|
|
100
|
+
this._logger.warn(`Python heap (${this._formatBytes(snapshot.pythonHeapBytes)}) exceeded GC threshold ` +
|
|
101
|
+
`(${this._formatBytes(this._thresholds.gcThreshold)}). Running GC...`);
|
|
102
|
+
await this.forceGC();
|
|
103
|
+
}
|
|
104
|
+
// Check tracked objects
|
|
105
|
+
if (snapshot.trackedObjects > this._thresholds.objectWarningCount) {
|
|
106
|
+
this._logger.warn(`High Python object count: ${snapshot.trackedObjects} tracked objects`);
|
|
107
|
+
}
|
|
108
|
+
// Check pending callbacks
|
|
109
|
+
if (snapshot.pendingCallbacks > this._thresholds.callbackWarningCount) {
|
|
110
|
+
this._logger.warn(`High pending callback count: ${snapshot.pendingCallbacks}`);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
_parseBytes(str) {
|
|
114
|
+
const match = str.match(/^(\d+(?:\.\d+)?)\s*(B|KB|MB|GB|TB)?$/i);
|
|
115
|
+
if (!match) {
|
|
116
|
+
return 1_073_741_824;
|
|
117
|
+
} // 1GB default
|
|
118
|
+
const value = parseFloat(match[1]);
|
|
119
|
+
const unit = (match[2] ?? 'B').toUpperCase();
|
|
120
|
+
const units = {
|
|
121
|
+
B: 1,
|
|
122
|
+
KB: 1024,
|
|
123
|
+
MB: 1024 ** 2,
|
|
124
|
+
GB: 1024 ** 3,
|
|
125
|
+
TB: 1024 ** 4,
|
|
126
|
+
};
|
|
127
|
+
return Math.floor(value * (units[unit] ?? 1));
|
|
128
|
+
}
|
|
129
|
+
_formatBytes(bytes) {
|
|
130
|
+
if (bytes < 1024) {
|
|
131
|
+
return `${bytes}B`;
|
|
132
|
+
}
|
|
133
|
+
if (bytes < 1024 ** 2) {
|
|
134
|
+
return `${(bytes / 1024).toFixed(1)}KB`;
|
|
135
|
+
}
|
|
136
|
+
if (bytes < 1024 ** 3) {
|
|
137
|
+
return `${(bytes / 1024 ** 2).toFixed(1)}MB`;
|
|
138
|
+
}
|
|
139
|
+
return `${(bytes / 1024 ** 3).toFixed(2)}GB`;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
exports.MemoryMonitor = MemoryMonitor;
|
|
143
|
+
//# sourceMappingURL=MemoryMonitor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MemoryMonitor.js","sourceRoot":"","sources":["../../src/utils/MemoryMonitor.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,qCAAkC;AAuBlC,MAAa,aAAa;IACP,OAAO,CAAS;IACzB,MAAM,GAAuB,IAAI,CAAC;IAClC,UAAU,GAAqB,EAAE,CAAC;IAClC,aAAa,G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