truthound-dashboard 1.3.1__py3-none-any.whl → 1.4.1__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.
- truthound_dashboard/api/alerts.py +258 -0
- truthound_dashboard/api/anomaly.py +1302 -0
- truthound_dashboard/api/cross_alerts.py +352 -0
- truthound_dashboard/api/deps.py +143 -0
- truthound_dashboard/api/drift_monitor.py +540 -0
- truthound_dashboard/api/lineage.py +1151 -0
- truthound_dashboard/api/maintenance.py +363 -0
- truthound_dashboard/api/middleware.py +373 -1
- truthound_dashboard/api/model_monitoring.py +805 -0
- truthound_dashboard/api/notifications_advanced.py +2452 -0
- truthound_dashboard/api/plugins.py +2096 -0
- truthound_dashboard/api/profile.py +211 -14
- truthound_dashboard/api/reports.py +853 -0
- truthound_dashboard/api/router.py +147 -0
- truthound_dashboard/api/rule_suggestions.py +310 -0
- truthound_dashboard/api/schema_evolution.py +231 -0
- truthound_dashboard/api/sources.py +47 -3
- truthound_dashboard/api/triggers.py +190 -0
- truthound_dashboard/api/validations.py +13 -0
- truthound_dashboard/api/validators.py +333 -4
- truthound_dashboard/api/versioning.py +309 -0
- truthound_dashboard/api/websocket.py +301 -0
- truthound_dashboard/core/__init__.py +27 -0
- truthound_dashboard/core/anomaly.py +1395 -0
- truthound_dashboard/core/anomaly_explainer.py +633 -0
- truthound_dashboard/core/cache.py +206 -0
- truthound_dashboard/core/cached_services.py +422 -0
- truthound_dashboard/core/charts.py +352 -0
- truthound_dashboard/core/connections.py +1069 -42
- truthound_dashboard/core/cross_alerts.py +837 -0
- truthound_dashboard/core/drift_monitor.py +1477 -0
- truthound_dashboard/core/drift_sampling.py +669 -0
- truthound_dashboard/core/i18n/__init__.py +42 -0
- truthound_dashboard/core/i18n/detector.py +173 -0
- truthound_dashboard/core/i18n/messages.py +564 -0
- truthound_dashboard/core/lineage.py +971 -0
- truthound_dashboard/core/maintenance.py +443 -5
- truthound_dashboard/core/model_monitoring.py +1043 -0
- truthound_dashboard/core/notifications/channels.py +1020 -1
- truthound_dashboard/core/notifications/deduplication/__init__.py +143 -0
- truthound_dashboard/core/notifications/deduplication/policies.py +274 -0
- truthound_dashboard/core/notifications/deduplication/service.py +400 -0
- truthound_dashboard/core/notifications/deduplication/stores.py +2365 -0
- truthound_dashboard/core/notifications/deduplication/strategies.py +422 -0
- truthound_dashboard/core/notifications/dispatcher.py +43 -0
- truthound_dashboard/core/notifications/escalation/__init__.py +149 -0
- truthound_dashboard/core/notifications/escalation/backends.py +1384 -0
- truthound_dashboard/core/notifications/escalation/engine.py +429 -0
- truthound_dashboard/core/notifications/escalation/models.py +336 -0
- truthound_dashboard/core/notifications/escalation/scheduler.py +1187 -0
- truthound_dashboard/core/notifications/escalation/state_machine.py +330 -0
- truthound_dashboard/core/notifications/escalation/stores.py +2896 -0
- truthound_dashboard/core/notifications/events.py +49 -0
- truthound_dashboard/core/notifications/metrics/__init__.py +115 -0
- truthound_dashboard/core/notifications/metrics/base.py +528 -0
- truthound_dashboard/core/notifications/metrics/collectors.py +583 -0
- truthound_dashboard/core/notifications/routing/__init__.py +169 -0
- truthound_dashboard/core/notifications/routing/combinators.py +184 -0
- truthound_dashboard/core/notifications/routing/config.py +375 -0
- truthound_dashboard/core/notifications/routing/config_parser.py +867 -0
- truthound_dashboard/core/notifications/routing/engine.py +382 -0
- truthound_dashboard/core/notifications/routing/expression_engine.py +1269 -0
- truthound_dashboard/core/notifications/routing/jinja2_engine.py +774 -0
- truthound_dashboard/core/notifications/routing/rules.py +625 -0
- truthound_dashboard/core/notifications/routing/validator.py +678 -0
- truthound_dashboard/core/notifications/service.py +2 -0
- truthound_dashboard/core/notifications/stats_aggregator.py +850 -0
- truthound_dashboard/core/notifications/throttling/__init__.py +83 -0
- truthound_dashboard/core/notifications/throttling/builder.py +311 -0
- truthound_dashboard/core/notifications/throttling/stores.py +1859 -0
- truthound_dashboard/core/notifications/throttling/throttlers.py +633 -0
- truthound_dashboard/core/openlineage.py +1028 -0
- truthound_dashboard/core/plugins/__init__.py +39 -0
- truthound_dashboard/core/plugins/docs/__init__.py +39 -0
- truthound_dashboard/core/plugins/docs/extractor.py +703 -0
- truthound_dashboard/core/plugins/docs/renderers.py +804 -0
- truthound_dashboard/core/plugins/hooks/__init__.py +63 -0
- truthound_dashboard/core/plugins/hooks/decorators.py +367 -0
- truthound_dashboard/core/plugins/hooks/manager.py +403 -0
- truthound_dashboard/core/plugins/hooks/protocols.py +265 -0
- truthound_dashboard/core/plugins/lifecycle/__init__.py +41 -0
- truthound_dashboard/core/plugins/lifecycle/hot_reload.py +584 -0
- truthound_dashboard/core/plugins/lifecycle/machine.py +419 -0
- truthound_dashboard/core/plugins/lifecycle/states.py +266 -0
- truthound_dashboard/core/plugins/loader.py +504 -0
- truthound_dashboard/core/plugins/registry.py +810 -0
- truthound_dashboard/core/plugins/reporter_executor.py +588 -0
- truthound_dashboard/core/plugins/sandbox/__init__.py +59 -0
- truthound_dashboard/core/plugins/sandbox/code_validator.py +243 -0
- truthound_dashboard/core/plugins/sandbox/engines.py +770 -0
- truthound_dashboard/core/plugins/sandbox/protocols.py +194 -0
- truthound_dashboard/core/plugins/sandbox.py +617 -0
- truthound_dashboard/core/plugins/security/__init__.py +68 -0
- truthound_dashboard/core/plugins/security/analyzer.py +535 -0
- truthound_dashboard/core/plugins/security/policies.py +311 -0
- truthound_dashboard/core/plugins/security/protocols.py +296 -0
- truthound_dashboard/core/plugins/security/signing.py +842 -0
- truthound_dashboard/core/plugins/security.py +446 -0
- truthound_dashboard/core/plugins/validator_executor.py +401 -0
- truthound_dashboard/core/plugins/versioning/__init__.py +51 -0
- truthound_dashboard/core/plugins/versioning/constraints.py +377 -0
- truthound_dashboard/core/plugins/versioning/dependencies.py +541 -0
- truthound_dashboard/core/plugins/versioning/semver.py +266 -0
- truthound_dashboard/core/profile_comparison.py +601 -0
- truthound_dashboard/core/report_history.py +570 -0
- truthound_dashboard/core/reporters/__init__.py +57 -0
- truthound_dashboard/core/reporters/base.py +296 -0
- truthound_dashboard/core/reporters/csv_reporter.py +155 -0
- truthound_dashboard/core/reporters/html_reporter.py +598 -0
- truthound_dashboard/core/reporters/i18n/__init__.py +65 -0
- truthound_dashboard/core/reporters/i18n/base.py +494 -0
- truthound_dashboard/core/reporters/i18n/catalogs.py +930 -0
- truthound_dashboard/core/reporters/json_reporter.py +160 -0
- truthound_dashboard/core/reporters/junit_reporter.py +233 -0
- truthound_dashboard/core/reporters/markdown_reporter.py +207 -0
- truthound_dashboard/core/reporters/pdf_reporter.py +209 -0
- truthound_dashboard/core/reporters/registry.py +272 -0
- truthound_dashboard/core/rule_generator.py +2088 -0
- truthound_dashboard/core/scheduler.py +822 -12
- truthound_dashboard/core/schema_evolution.py +858 -0
- truthound_dashboard/core/services.py +152 -9
- truthound_dashboard/core/statistics.py +718 -0
- truthound_dashboard/core/streaming_anomaly.py +883 -0
- truthound_dashboard/core/triggers/__init__.py +45 -0
- truthound_dashboard/core/triggers/base.py +226 -0
- truthound_dashboard/core/triggers/evaluators.py +609 -0
- truthound_dashboard/core/triggers/factory.py +363 -0
- truthound_dashboard/core/unified_alerts.py +870 -0
- truthound_dashboard/core/validation_limits.py +509 -0
- truthound_dashboard/core/versioning.py +709 -0
- truthound_dashboard/core/websocket/__init__.py +59 -0
- truthound_dashboard/core/websocket/manager.py +512 -0
- truthound_dashboard/core/websocket/messages.py +130 -0
- truthound_dashboard/db/__init__.py +30 -0
- truthound_dashboard/db/models.py +3375 -3
- truthound_dashboard/main.py +22 -0
- truthound_dashboard/schemas/__init__.py +396 -1
- truthound_dashboard/schemas/anomaly.py +1258 -0
- truthound_dashboard/schemas/base.py +4 -0
- truthound_dashboard/schemas/cross_alerts.py +334 -0
- truthound_dashboard/schemas/drift_monitor.py +890 -0
- truthound_dashboard/schemas/lineage.py +428 -0
- truthound_dashboard/schemas/maintenance.py +154 -0
- truthound_dashboard/schemas/model_monitoring.py +374 -0
- truthound_dashboard/schemas/notifications_advanced.py +1363 -0
- truthound_dashboard/schemas/openlineage.py +704 -0
- truthound_dashboard/schemas/plugins.py +1293 -0
- truthound_dashboard/schemas/profile.py +420 -34
- truthound_dashboard/schemas/profile_comparison.py +242 -0
- truthound_dashboard/schemas/reports.py +285 -0
- truthound_dashboard/schemas/rule_suggestion.py +434 -0
- truthound_dashboard/schemas/schema_evolution.py +164 -0
- truthound_dashboard/schemas/source.py +117 -2
- truthound_dashboard/schemas/triggers.py +511 -0
- truthound_dashboard/schemas/unified_alerts.py +223 -0
- truthound_dashboard/schemas/validation.py +25 -1
- truthound_dashboard/schemas/validators/__init__.py +11 -0
- truthound_dashboard/schemas/validators/base.py +151 -0
- truthound_dashboard/schemas/versioning.py +152 -0
- truthound_dashboard/static/index.html +2 -2
- {truthound_dashboard-1.3.1.dist-info → truthound_dashboard-1.4.1.dist-info}/METADATA +147 -23
- truthound_dashboard-1.4.1.dist-info/RECORD +239 -0
- truthound_dashboard/static/assets/index-BZG20KuF.js +0 -586
- truthound_dashboard/static/assets/index-D_HyZ3pb.css +0 -1
- truthound_dashboard/static/assets/unmerged_dictionaries-CtpqQBm0.js +0 -1
- truthound_dashboard-1.3.1.dist-info/RECORD +0 -110
- {truthound_dashboard-1.3.1.dist-info → truthound_dashboard-1.4.1.dist-info}/WHEEL +0 -0
- {truthound_dashboard-1.3.1.dist-info → truthound_dashboard-1.4.1.dist-info}/entry_points.txt +0 -0
- {truthound_dashboard-1.3.1.dist-info → truthound_dashboard-1.4.1.dist-info}/licenses/LICENSE +0 -0
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
"""Sandbox Protocol Definitions.
|
|
2
|
+
|
|
3
|
+
This module defines the core protocols and data types for the
|
|
4
|
+
plugin sandbox system.
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
from __future__ import annotations
|
|
8
|
+
|
|
9
|
+
from dataclasses import dataclass, field
|
|
10
|
+
from typing import Any
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class SandboxError(Exception):
|
|
14
|
+
"""Base exception for sandbox errors."""
|
|
15
|
+
pass
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
class SandboxTimeoutError(SandboxError):
|
|
19
|
+
"""Raised when sandbox execution times out."""
|
|
20
|
+
pass
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
class SandboxMemoryError(SandboxError):
|
|
24
|
+
"""Raised when sandbox memory limit is exceeded."""
|
|
25
|
+
pass
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
class SandboxSecurityError(SandboxError):
|
|
29
|
+
"""Raised when sandbox security is violated."""
|
|
30
|
+
pass
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
@dataclass
|
|
34
|
+
class SandboxConfig:
|
|
35
|
+
"""Configuration for sandbox execution.
|
|
36
|
+
|
|
37
|
+
Attributes:
|
|
38
|
+
enabled: Whether sandbox is enabled.
|
|
39
|
+
isolation_level: Isolation level (none, process, container).
|
|
40
|
+
memory_limit_mb: Memory limit in MB.
|
|
41
|
+
cpu_time_limit_sec: CPU time limit in seconds.
|
|
42
|
+
wall_time_limit_sec: Wall clock time limit in seconds.
|
|
43
|
+
max_file_size_mb: Maximum file size in MB.
|
|
44
|
+
max_open_files: Maximum number of open files.
|
|
45
|
+
max_processes: Maximum number of processes.
|
|
46
|
+
network_enabled: Whether network access is allowed.
|
|
47
|
+
filesystem_read: Whether filesystem read is allowed.
|
|
48
|
+
filesystem_write: Whether filesystem write is allowed.
|
|
49
|
+
allowed_modules: List of allowed Python modules (empty = default safe).
|
|
50
|
+
blocked_modules: List of blocked Python modules.
|
|
51
|
+
allowed_builtins: List of allowed builtin functions.
|
|
52
|
+
container_image: Container image for container isolation.
|
|
53
|
+
working_dir: Working directory for execution.
|
|
54
|
+
environment: Environment variables.
|
|
55
|
+
"""
|
|
56
|
+
|
|
57
|
+
enabled: bool = True
|
|
58
|
+
isolation_level: str = "process" # none, process, container
|
|
59
|
+
memory_limit_mb: int = 256
|
|
60
|
+
cpu_time_limit_sec: int = 30
|
|
61
|
+
wall_time_limit_sec: int = 60
|
|
62
|
+
max_file_size_mb: int = 10
|
|
63
|
+
max_open_files: int = 10
|
|
64
|
+
max_processes: int = 1
|
|
65
|
+
network_enabled: bool = False
|
|
66
|
+
filesystem_read: bool = False
|
|
67
|
+
filesystem_write: bool = False
|
|
68
|
+
allowed_modules: list[str] = field(default_factory=list)
|
|
69
|
+
blocked_modules: list[str] = field(
|
|
70
|
+
default_factory=lambda: [
|
|
71
|
+
"os", "subprocess", "sys", "shutil", "socket",
|
|
72
|
+
"http", "urllib", "requests", "httpx",
|
|
73
|
+
"multiprocessing", "threading", "ctypes",
|
|
74
|
+
"pickle", "shelve", "sqlite3", "importlib",
|
|
75
|
+
"builtins", "__builtin__",
|
|
76
|
+
]
|
|
77
|
+
)
|
|
78
|
+
allowed_builtins: list[str] = field(
|
|
79
|
+
default_factory=lambda: [
|
|
80
|
+
"abs", "all", "any", "ascii", "bin", "bool",
|
|
81
|
+
"bytearray", "bytes", "callable", "chr", "classmethod",
|
|
82
|
+
"complex", "dict", "dir", "divmod", "enumerate",
|
|
83
|
+
"filter", "float", "format", "frozenset", "getattr",
|
|
84
|
+
"hasattr", "hash", "hex", "id", "int", "isinstance",
|
|
85
|
+
"issubclass", "iter", "len", "list", "map", "max",
|
|
86
|
+
"min", "next", "object", "oct", "ord", "pow",
|
|
87
|
+
"print", "property", "range", "repr", "reversed",
|
|
88
|
+
"round", "set", "setattr", "slice", "sorted",
|
|
89
|
+
"staticmethod", "str", "sum", "super", "tuple",
|
|
90
|
+
"type", "vars", "zip",
|
|
91
|
+
]
|
|
92
|
+
)
|
|
93
|
+
container_image: str = "python:3.11-slim"
|
|
94
|
+
working_dir: str | None = None
|
|
95
|
+
environment: dict[str, str] = field(default_factory=dict)
|
|
96
|
+
|
|
97
|
+
def to_dict(self) -> dict[str, Any]:
|
|
98
|
+
"""Convert to dictionary."""
|
|
99
|
+
return {
|
|
100
|
+
"enabled": self.enabled,
|
|
101
|
+
"isolation_level": self.isolation_level,
|
|
102
|
+
"memory_limit_mb": self.memory_limit_mb,
|
|
103
|
+
"cpu_time_limit_sec": self.cpu_time_limit_sec,
|
|
104
|
+
"wall_time_limit_sec": self.wall_time_limit_sec,
|
|
105
|
+
"max_file_size_mb": self.max_file_size_mb,
|
|
106
|
+
"max_open_files": self.max_open_files,
|
|
107
|
+
"max_processes": self.max_processes,
|
|
108
|
+
"network_enabled": self.network_enabled,
|
|
109
|
+
"filesystem_read": self.filesystem_read,
|
|
110
|
+
"filesystem_write": self.filesystem_write,
|
|
111
|
+
"allowed_modules": self.allowed_modules,
|
|
112
|
+
"blocked_modules": self.blocked_modules,
|
|
113
|
+
"container_image": self.container_image,
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
@classmethod
|
|
117
|
+
def from_dict(cls, data: dict[str, Any]) -> "SandboxConfig":
|
|
118
|
+
"""Create from dictionary."""
|
|
119
|
+
return cls(
|
|
120
|
+
enabled=data.get("enabled", True),
|
|
121
|
+
isolation_level=data.get("isolation_level", "process"),
|
|
122
|
+
memory_limit_mb=data.get("memory_limit_mb", 256),
|
|
123
|
+
cpu_time_limit_sec=data.get("cpu_time_limit_sec", 30),
|
|
124
|
+
wall_time_limit_sec=data.get("wall_time_limit_sec", 60),
|
|
125
|
+
max_file_size_mb=data.get("max_file_size_mb", 10),
|
|
126
|
+
max_open_files=data.get("max_open_files", 10),
|
|
127
|
+
max_processes=data.get("max_processes", 1),
|
|
128
|
+
network_enabled=data.get("network_enabled", False),
|
|
129
|
+
filesystem_read=data.get("filesystem_read", False),
|
|
130
|
+
filesystem_write=data.get("filesystem_write", False),
|
|
131
|
+
allowed_modules=data.get("allowed_modules", []),
|
|
132
|
+
blocked_modules=data.get("blocked_modules", []),
|
|
133
|
+
container_image=data.get("container_image", "python:3.11-slim"),
|
|
134
|
+
)
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
@dataclass
|
|
138
|
+
class SandboxResult:
|
|
139
|
+
"""Result of sandbox execution.
|
|
140
|
+
|
|
141
|
+
Attributes:
|
|
142
|
+
success: Whether execution succeeded.
|
|
143
|
+
result: Return value if any.
|
|
144
|
+
error: Error message if failed.
|
|
145
|
+
error_type: Type of error if failed.
|
|
146
|
+
stdout: Captured stdout.
|
|
147
|
+
stderr: Captured stderr.
|
|
148
|
+
execution_time_ms: Execution time in milliseconds.
|
|
149
|
+
memory_used_mb: Memory used in MB.
|
|
150
|
+
cpu_time_sec: CPU time used in seconds.
|
|
151
|
+
exit_code: Process exit code (for process/container isolation).
|
|
152
|
+
warnings: List of warnings.
|
|
153
|
+
metadata: Additional metadata.
|
|
154
|
+
"""
|
|
155
|
+
|
|
156
|
+
success: bool
|
|
157
|
+
result: Any = None
|
|
158
|
+
error: str | None = None
|
|
159
|
+
error_type: str | None = None
|
|
160
|
+
stdout: str = ""
|
|
161
|
+
stderr: str = ""
|
|
162
|
+
execution_time_ms: float = 0
|
|
163
|
+
memory_used_mb: float | None = None
|
|
164
|
+
cpu_time_sec: float | None = None
|
|
165
|
+
exit_code: int | None = None
|
|
166
|
+
warnings: list[str] = field(default_factory=list)
|
|
167
|
+
metadata: dict[str, Any] = field(default_factory=dict)
|
|
168
|
+
|
|
169
|
+
def to_dict(self) -> dict[str, Any]:
|
|
170
|
+
"""Convert to dictionary."""
|
|
171
|
+
return {
|
|
172
|
+
"success": self.success,
|
|
173
|
+
"result": self.result if self._is_serializable(self.result) else str(self.result),
|
|
174
|
+
"error": self.error,
|
|
175
|
+
"error_type": self.error_type,
|
|
176
|
+
"stdout": self.stdout,
|
|
177
|
+
"stderr": self.stderr,
|
|
178
|
+
"execution_time_ms": self.execution_time_ms,
|
|
179
|
+
"memory_used_mb": self.memory_used_mb,
|
|
180
|
+
"cpu_time_sec": self.cpu_time_sec,
|
|
181
|
+
"exit_code": self.exit_code,
|
|
182
|
+
"warnings": self.warnings,
|
|
183
|
+
"metadata": self.metadata,
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
@staticmethod
|
|
187
|
+
def _is_serializable(obj: Any) -> bool:
|
|
188
|
+
"""Check if object is JSON serializable."""
|
|
189
|
+
try:
|
|
190
|
+
import json
|
|
191
|
+
json.dumps(obj)
|
|
192
|
+
return True
|
|
193
|
+
except (TypeError, ValueError):
|
|
194
|
+
return False
|