omnesight 1.1.0__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.
- omnesight/__init__.py +40 -0
- omnesight/client.py +181 -0
- omnesight/exceptions.py +31 -0
- omnesight/models.py +157 -0
- omnesight/resources/__init__.py +18 -0
- omnesight/resources/actions.py +37 -0
- omnesight/resources/hackmalim.py +194 -0
- omnesight/resources/reconciliation.py +45 -0
- omnesight/resources/sandalfon.py +123 -0
- omnesight/resources/telemetry.py +33 -0
- omnesight-1.1.0.dist-info/METADATA +220 -0
- omnesight-1.1.0.dist-info/RECORD +14 -0
- omnesight-1.1.0.dist-info/WHEEL +4 -0
- omnesight-1.1.0.dist-info/licenses/LICENSE +87 -0
omnesight/__init__.py
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Omnesight Python SDK
|
|
3
|
+
Sovereign Operational Intelligence & Autonomous Execution Infrastructure
|
|
4
|
+
"""
|
|
5
|
+
|
|
6
|
+
from .client import AsyncOmnesight, Omnesight
|
|
7
|
+
from .exceptions import (
|
|
8
|
+
AuthenticationError,
|
|
9
|
+
InternalServerError,
|
|
10
|
+
NotFoundError,
|
|
11
|
+
OmnesightError,
|
|
12
|
+
PolicyViolationError,
|
|
13
|
+
RateLimitError,
|
|
14
|
+
)
|
|
15
|
+
from .models import (
|
|
16
|
+
HackmalimInferRequest,
|
|
17
|
+
HackmalimInferResponse,
|
|
18
|
+
SandalfonChatRequest,
|
|
19
|
+
SandalfonChatResponse,
|
|
20
|
+
SandalfonDiscoverRequest,
|
|
21
|
+
SandalfonDiscoverResponse,
|
|
22
|
+
)
|
|
23
|
+
|
|
24
|
+
__version__ = "1.1.0"
|
|
25
|
+
__all__ = [
|
|
26
|
+
"AsyncOmnesight",
|
|
27
|
+
"AuthenticationError",
|
|
28
|
+
"HackmalimInferRequest",
|
|
29
|
+
"HackmalimInferResponse",
|
|
30
|
+
"InternalServerError",
|
|
31
|
+
"NotFoundError",
|
|
32
|
+
"Omnesight",
|
|
33
|
+
"OmnesightError",
|
|
34
|
+
"PolicyViolationError",
|
|
35
|
+
"RateLimitError",
|
|
36
|
+
"SandalfonChatRequest",
|
|
37
|
+
"SandalfonChatResponse",
|
|
38
|
+
"SandalfonDiscoverRequest",
|
|
39
|
+
"SandalfonDiscoverResponse",
|
|
40
|
+
]
|
omnesight/client.py
ADDED
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Omnesight Client Implementation
|
|
3
|
+
Supports synchronous and asynchronous execution, sovereign MLOps gateways,
|
|
4
|
+
custom VPC endpoints, and automatic transport retries.
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
from __future__ import annotations
|
|
8
|
+
|
|
9
|
+
import os
|
|
10
|
+
from typing import Any
|
|
11
|
+
|
|
12
|
+
import httpx
|
|
13
|
+
|
|
14
|
+
from .exceptions import (
|
|
15
|
+
AuthenticationError,
|
|
16
|
+
InternalServerError,
|
|
17
|
+
NotFoundError,
|
|
18
|
+
OmnesightError,
|
|
19
|
+
PolicyViolationError,
|
|
20
|
+
RateLimitError,
|
|
21
|
+
)
|
|
22
|
+
from .resources.actions import ActionsResource, AsyncActionsResource
|
|
23
|
+
from .resources.hackmalim import AsyncHackmalimResource, HackmalimResource
|
|
24
|
+
from .resources.reconciliation import (
|
|
25
|
+
AsyncReconciliationResource,
|
|
26
|
+
ReconciliationResource,
|
|
27
|
+
)
|
|
28
|
+
from .resources.sandalfon import AsyncSandalfonResource, SandalfonResource
|
|
29
|
+
from .resources.telemetry import AsyncTelemetryResource, TelemetryResource
|
|
30
|
+
|
|
31
|
+
DEFAULT_BASE_URL = "http://127.0.0.1:8001"
|
|
32
|
+
SDK_USER_AGENT = "omnesight-python-sdk/1.1.0"
|
|
33
|
+
|
|
34
|
+
_STATUS_EXCEPTIONS = {
|
|
35
|
+
401: AuthenticationError,
|
|
36
|
+
403: AuthenticationError,
|
|
37
|
+
404: NotFoundError,
|
|
38
|
+
422: PolicyViolationError,
|
|
39
|
+
429: RateLimitError,
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
def _resolve_client_settings(
|
|
44
|
+
api_key: str | None,
|
|
45
|
+
base_url: str | None,
|
|
46
|
+
) -> tuple[str, str, dict[str, str]]:
|
|
47
|
+
"""Resolve API credentials, gateway base URL, and standard Omnesight headers."""
|
|
48
|
+
resolved_key = api_key or os.environ.get("OMNESIGHT_API_KEY")
|
|
49
|
+
if not resolved_key:
|
|
50
|
+
raise AuthenticationError(
|
|
51
|
+
"API key must be provided or set via OMNESIGHT_API_KEY environment variable."
|
|
52
|
+
)
|
|
53
|
+
env_url = os.environ.get("OMNESIGHT_BASE_URL")
|
|
54
|
+
resolved_url = (base_url or env_url or DEFAULT_BASE_URL).rstrip("/")
|
|
55
|
+
headers = {
|
|
56
|
+
"Authorization": f"Bearer {resolved_key}",
|
|
57
|
+
"X-API-Key": resolved_key,
|
|
58
|
+
"Content-Type": "application/json",
|
|
59
|
+
"User-Agent": SDK_USER_AGENT,
|
|
60
|
+
}
|
|
61
|
+
return resolved_key, resolved_url, headers
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
def _parse_response(response: httpx.Response) -> dict[str, Any]:
|
|
65
|
+
"""Decode successful JSON payloads or raise the typed Omnesight SDK exception."""
|
|
66
|
+
if 200 <= response.status_code < 300:
|
|
67
|
+
return response.json()
|
|
68
|
+
|
|
69
|
+
error_msg = response.text
|
|
70
|
+
try:
|
|
71
|
+
error_data = response.json()
|
|
72
|
+
error_msg = error_data.get("message", error_data.get("detail", error_msg))
|
|
73
|
+
except ValueError:
|
|
74
|
+
error_msg = response.text
|
|
75
|
+
|
|
76
|
+
exc_cls = _STATUS_EXCEPTIONS.get(response.status_code, InternalServerError)
|
|
77
|
+
raise exc_cls(error_msg, status_code=response.status_code)
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
class Omnesight:
|
|
81
|
+
"""Synchronous enterprise client for Omnesight Sovereign MLOps Infrastructure."""
|
|
82
|
+
|
|
83
|
+
def __init__(
|
|
84
|
+
self,
|
|
85
|
+
api_key: str | None = None,
|
|
86
|
+
base_url: str | None = None,
|
|
87
|
+
timeout: float = 30.0,
|
|
88
|
+
max_retries: int = 3,
|
|
89
|
+
transport: httpx.BaseTransport | None = None,
|
|
90
|
+
):
|
|
91
|
+
resolved = _resolve_client_settings(api_key, base_url)
|
|
92
|
+
self.api_key, self.base_url, headers = resolved
|
|
93
|
+
self.timeout = timeout
|
|
94
|
+
self.max_retries = max_retries
|
|
95
|
+
|
|
96
|
+
client_kwargs: dict[str, Any] = {
|
|
97
|
+
"base_url": self.base_url,
|
|
98
|
+
"headers": headers,
|
|
99
|
+
"timeout": self.timeout,
|
|
100
|
+
}
|
|
101
|
+
if transport is not None:
|
|
102
|
+
client_kwargs["transport"] = transport
|
|
103
|
+
self._http_client = httpx.Client(**client_kwargs)
|
|
104
|
+
|
|
105
|
+
self.telemetry = TelemetryResource(self)
|
|
106
|
+
self.reconciliation = ReconciliationResource(self)
|
|
107
|
+
self.actions = ActionsResource(self)
|
|
108
|
+
self.hackmalim = HackmalimResource(self)
|
|
109
|
+
self.sandalfon = SandalfonResource(self)
|
|
110
|
+
|
|
111
|
+
def _request(self, method: str, path: str, **kwargs: Any) -> dict[str, Any]:
|
|
112
|
+
for attempt in range(self.max_retries + 1):
|
|
113
|
+
try:
|
|
114
|
+
resp = self._http_client.request(method, path, **kwargs)
|
|
115
|
+
return _parse_response(resp)
|
|
116
|
+
except httpx.TransportError as exc:
|
|
117
|
+
if attempt == self.max_retries:
|
|
118
|
+
msg = f"Connection to Omnesight infrastructure failed: {exc}"
|
|
119
|
+
raise InternalServerError(msg) from exc
|
|
120
|
+
raise OmnesightError("Request failed after retries.")
|
|
121
|
+
|
|
122
|
+
def close(self):
|
|
123
|
+
self._http_client.close()
|
|
124
|
+
|
|
125
|
+
def __enter__(self):
|
|
126
|
+
return self
|
|
127
|
+
|
|
128
|
+
def __exit__(self, exc_type, exc_val, exc_tb):
|
|
129
|
+
self.close()
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
class AsyncOmnesight:
|
|
133
|
+
"""Asynchronous enterprise client for Omnesight Sovereign MLOps Infrastructure."""
|
|
134
|
+
|
|
135
|
+
def __init__(
|
|
136
|
+
self,
|
|
137
|
+
api_key: str | None = None,
|
|
138
|
+
base_url: str | None = None,
|
|
139
|
+
timeout: float = 30.0,
|
|
140
|
+
max_retries: int = 3,
|
|
141
|
+
transport: httpx.AsyncBaseTransport | None = None,
|
|
142
|
+
):
|
|
143
|
+
resolved = _resolve_client_settings(api_key, base_url)
|
|
144
|
+
self.api_key, self.base_url, headers = resolved
|
|
145
|
+
self.timeout = timeout
|
|
146
|
+
self.max_retries = max_retries
|
|
147
|
+
|
|
148
|
+
client_kwargs: dict[str, Any] = {
|
|
149
|
+
"base_url": self.base_url,
|
|
150
|
+
"headers": headers,
|
|
151
|
+
"timeout": self.timeout,
|
|
152
|
+
}
|
|
153
|
+
if transport is not None:
|
|
154
|
+
client_kwargs["transport"] = transport
|
|
155
|
+
self._http_client = httpx.AsyncClient(**client_kwargs)
|
|
156
|
+
|
|
157
|
+
self.telemetry = AsyncTelemetryResource(self)
|
|
158
|
+
self.reconciliation = AsyncReconciliationResource(self)
|
|
159
|
+
self.actions = AsyncActionsResource(self)
|
|
160
|
+
self.hackmalim = AsyncHackmalimResource(self)
|
|
161
|
+
self.sandalfon = AsyncSandalfonResource(self)
|
|
162
|
+
|
|
163
|
+
async def _request(self, method: str, path: str, **kwargs: Any) -> dict[str, Any]:
|
|
164
|
+
for attempt in range(self.max_retries + 1):
|
|
165
|
+
try:
|
|
166
|
+
resp = await self._http_client.request(method, path, **kwargs)
|
|
167
|
+
return _parse_response(resp)
|
|
168
|
+
except httpx.TransportError as exc:
|
|
169
|
+
if attempt == self.max_retries:
|
|
170
|
+
msg = f"Connection to Omnesight infrastructure failed: {exc}"
|
|
171
|
+
raise InternalServerError(msg) from exc
|
|
172
|
+
raise OmnesightError("Request failed after retries.")
|
|
173
|
+
|
|
174
|
+
async def aclose(self):
|
|
175
|
+
await self._http_client.aclose()
|
|
176
|
+
|
|
177
|
+
async def __aenter__(self):
|
|
178
|
+
return self
|
|
179
|
+
|
|
180
|
+
async def __aexit__(self, exc_type, exc_val, exc_tb):
|
|
181
|
+
await self.aclose()
|
omnesight/exceptions.py
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Omnesight SDK Exceptions
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
class OmnesightError(Exception):
|
|
6
|
+
"""Base exception for all Omnesight SDK errors."""
|
|
7
|
+
def __init__(self, message: str, status_code: int = None, details: dict = None):
|
|
8
|
+
super().__init__(message)
|
|
9
|
+
self.message = message
|
|
10
|
+
self.status_code = status_code
|
|
11
|
+
self.details = details or {}
|
|
12
|
+
|
|
13
|
+
class AuthenticationError(OmnesightError):
|
|
14
|
+
"""Raised when the provided API key or cryptographic token is invalid or expired."""
|
|
15
|
+
pass
|
|
16
|
+
|
|
17
|
+
class PolicyViolationError(OmnesightError):
|
|
18
|
+
"""Raised when an action violates enterprise governance, policy limits, or requires escalation."""
|
|
19
|
+
pass
|
|
20
|
+
|
|
21
|
+
class RateLimitError(OmnesightError):
|
|
22
|
+
"""Raised when telemetry throughput exceeds contracted tier rate limits."""
|
|
23
|
+
pass
|
|
24
|
+
|
|
25
|
+
class NotFoundError(OmnesightError):
|
|
26
|
+
"""Raised when a requested entity, pipeline, or action does not exist."""
|
|
27
|
+
pass
|
|
28
|
+
|
|
29
|
+
class InternalServerError(OmnesightError):
|
|
30
|
+
"""Raised when the sovereign backend encounters an unhandled infrastructure error."""
|
|
31
|
+
pass
|
omnesight/models.py
ADDED
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Omnesight SDK Models & Schemas (Pydantic v2)
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
from __future__ import annotations
|
|
6
|
+
|
|
7
|
+
from datetime import datetime
|
|
8
|
+
from typing import Any, Literal
|
|
9
|
+
|
|
10
|
+
from pydantic import BaseModel, ConfigDict, Field
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class TelemetryRecord(BaseModel):
|
|
14
|
+
timestamp: datetime = Field(default_factory=datetime.utcnow)
|
|
15
|
+
device_id: str
|
|
16
|
+
metric: str
|
|
17
|
+
value: float
|
|
18
|
+
unit: str | None = None
|
|
19
|
+
metadata: dict[str, Any] = Field(default_factory=dict)
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
class TelemetryIngestResponse(BaseModel):
|
|
23
|
+
batch_id: str
|
|
24
|
+
records_received: int
|
|
25
|
+
records_committed: int
|
|
26
|
+
duration_ms: float
|
|
27
|
+
status: str
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
class DiscrepancyReport(BaseModel):
|
|
31
|
+
discrepancy_id: str
|
|
32
|
+
entity_a_type: str
|
|
33
|
+
entity_a_id: str
|
|
34
|
+
entity_b_type: str
|
|
35
|
+
entity_b_id: str
|
|
36
|
+
variance_amount_usd: float
|
|
37
|
+
variance_pct: float
|
|
38
|
+
status: str
|
|
39
|
+
detected_at: datetime
|
|
40
|
+
recommended_action_id: str | None = None
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
class ActionApprovalRequest(BaseModel):
|
|
44
|
+
action_id: str
|
|
45
|
+
action_type: str
|
|
46
|
+
target_entity: str
|
|
47
|
+
decision: str # "APPROVE" | "REJECT" | "MODIFIED"
|
|
48
|
+
supervisor_id: str
|
|
49
|
+
supervisor_notes: str | None = None
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
class ActionStatusResponse(BaseModel):
|
|
53
|
+
action_id: str
|
|
54
|
+
state: str # "PROPOSED", "SUPERVISED_APPROVAL", "COMMITTED", "REVERTED"
|
|
55
|
+
action_type: str
|
|
56
|
+
financial_impact_usd: float
|
|
57
|
+
sha256_audit_hash: str
|
|
58
|
+
executed_at: datetime | None = None
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
class HackmalimInferRequest(BaseModel):
|
|
62
|
+
"""Request payload for Hackmalim v1.0 closed-loop 3-layer inference."""
|
|
63
|
+
|
|
64
|
+
shock_amplitude: float = Field(default=1.45, ge=0.0, le=5.0)
|
|
65
|
+
jitter_severity: float = Field(default=1.0, ge=0.0, le=2.0)
|
|
66
|
+
inlet_n0: float = Field(default=60.0, ge=10.0, le=150.0)
|
|
67
|
+
inlet_n1: float = Field(default=50.0, ge=10.0, le=150.0)
|
|
68
|
+
leak_node: int = Field(default=2, ge=1, le=5)
|
|
69
|
+
leak_magnitude: float = Field(default=22.5, ge=0.0, le=50.0)
|
|
70
|
+
p_max_kw: float = Field(default=55.0, ge=10.0, le=200.0)
|
|
71
|
+
t_max_c: float = Field(default=72.0, ge=30.0, le=130.0)
|
|
72
|
+
autonomous_budget_usd: float = Field(default=4200.0, ge=0.0, le=1_000_000.0)
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
class HackmalimInferResponse(BaseModel):
|
|
76
|
+
"""Closed-loop response from Hackmalim v1.0 sovereign inference."""
|
|
77
|
+
|
|
78
|
+
model_config = ConfigDict(extra="allow")
|
|
79
|
+
|
|
80
|
+
model: str
|
|
81
|
+
version: str
|
|
82
|
+
latency_ms: float | None = None
|
|
83
|
+
inference_latency_ms: float | None = None
|
|
84
|
+
computed_stress_z: float | None = None
|
|
85
|
+
target_entity_id: str | None = None
|
|
86
|
+
liquid_ode: dict[str, Any] | None = None
|
|
87
|
+
stage_1_liquid_ode: dict[str, Any] | None = None
|
|
88
|
+
pignn: dict[str, Any] | None = None
|
|
89
|
+
stage_2_pignn: dict[str, Any] | None = None
|
|
90
|
+
causal: dict[str, Any] | None = None
|
|
91
|
+
stage_3_causal_symbolic: dict[str, Any] | None = None
|
|
92
|
+
action_policy: dict[str, Any] | None = None
|
|
93
|
+
guardrails: dict[str, Any] | None = None
|
|
94
|
+
enterprise_guardrail: dict[str, Any] | None = None
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
class SandalfonDiscoverRequest(BaseModel):
|
|
98
|
+
"""Request payload for Sandalfon v1.0 SINDy + FFT + Popperian discovery."""
|
|
99
|
+
|
|
100
|
+
preset: Literal[
|
|
101
|
+
"coupled_oscillator",
|
|
102
|
+
"predator_prey_grid",
|
|
103
|
+
"thermal_runaway",
|
|
104
|
+
] = "coupled_oscillator"
|
|
105
|
+
noise_level: float = Field(default=0.02, ge=0.0, le=0.20)
|
|
106
|
+
sparsity_threshold: float = Field(default=0.10, ge=0.001, le=1.0)
|
|
107
|
+
precursor_amp: float = Field(default=0.18, ge=0.0, le=1.0)
|
|
108
|
+
hypothesis_text: str | None = Field(default=None, max_length=1000)
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
class SandalfonDiscoverResponse(BaseModel):
|
|
112
|
+
"""Response payload with discovered ODEs, FFT spectrum, and Popperian p-value."""
|
|
113
|
+
|
|
114
|
+
model_config = ConfigDict(extra="allow")
|
|
115
|
+
|
|
116
|
+
model: str
|
|
117
|
+
version: str
|
|
118
|
+
latency_ms: float
|
|
119
|
+
hypothesis_text: str
|
|
120
|
+
sindy: dict[str, Any]
|
|
121
|
+
spectrum: dict[str, Any]
|
|
122
|
+
hypothesis_test: dict[str, Any]
|
|
123
|
+
discovery_proof_sha256: str
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
class SandalfonChatRequest(BaseModel):
|
|
127
|
+
"""Conversational scientific research hypothesis payload for Sandalfon v1.0."""
|
|
128
|
+
|
|
129
|
+
message: str = Field(..., min_length=1, max_length=2000)
|
|
130
|
+
preset: Literal[
|
|
131
|
+
"coupled_oscillator",
|
|
132
|
+
"predator_prey_grid",
|
|
133
|
+
"thermal_runaway",
|
|
134
|
+
] = "coupled_oscillator"
|
|
135
|
+
noise_level: float = Field(default=0.02, ge=0.0, le=0.20)
|
|
136
|
+
sparsity_threshold: float = Field(default=0.10, ge=0.001, le=1.0)
|
|
137
|
+
precursor_amp: float = Field(default=0.18, ge=0.0, le=1.0)
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
class SandalfonChatResponse(BaseModel):
|
|
141
|
+
"""Structured scientific response with spoken explanation and verified SINDy run."""
|
|
142
|
+
|
|
143
|
+
model_config = ConfigDict(extra="allow")
|
|
144
|
+
|
|
145
|
+
model: str
|
|
146
|
+
version: str
|
|
147
|
+
query: str | None = None
|
|
148
|
+
preset_used: str | None = None
|
|
149
|
+
parameters_used: dict[str, Any] | None = None
|
|
150
|
+
applied_controls: dict[str, Any] | None = None
|
|
151
|
+
spoken_reply: str
|
|
152
|
+
voice_lang: str | None = "fr-FR"
|
|
153
|
+
experiment: dict[str, Any] | None = None
|
|
154
|
+
sindy: dict[str, Any] | None = None
|
|
155
|
+
spectrum: dict[str, Any] | None = None
|
|
156
|
+
hypothesis_test: dict[str, Any] | None = None
|
|
157
|
+
discovery_proof_sha256: str | None = None
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
from .actions import ActionsResource, AsyncActionsResource
|
|
2
|
+
from .hackmalim import AsyncHackmalimResource, HackmalimResource
|
|
3
|
+
from .reconciliation import AsyncReconciliationResource, ReconciliationResource
|
|
4
|
+
from .sandalfon import AsyncSandalfonResource, SandalfonResource
|
|
5
|
+
from .telemetry import AsyncTelemetryResource, TelemetryResource
|
|
6
|
+
|
|
7
|
+
__all__ = [
|
|
8
|
+
"ActionsResource",
|
|
9
|
+
"AsyncActionsResource",
|
|
10
|
+
"AsyncHackmalimResource",
|
|
11
|
+
"AsyncReconciliationResource",
|
|
12
|
+
"AsyncSandalfonResource",
|
|
13
|
+
"AsyncTelemetryResource",
|
|
14
|
+
"HackmalimResource",
|
|
15
|
+
"ReconciliationResource",
|
|
16
|
+
"SandalfonResource",
|
|
17
|
+
"TelemetryResource",
|
|
18
|
+
]
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Supervised Action Protocol (SAP) Resource
|
|
3
|
+
Governs automated policy execution with cryptographic provenance.
|
|
4
|
+
"""
|
|
5
|
+
|
|
6
|
+
from typing import Dict, Any, Optional
|
|
7
|
+
from ..models import ActionApprovalRequest, ActionStatusResponse
|
|
8
|
+
|
|
9
|
+
class ActionsResource:
|
|
10
|
+
def __init__(self, client):
|
|
11
|
+
self._client = client
|
|
12
|
+
|
|
13
|
+
def get_status(self, action_id: str) -> ActionStatusResponse:
|
|
14
|
+
"""
|
|
15
|
+
Retrieve state, cryptographic SHA-256 hash, and execution log of an action.
|
|
16
|
+
"""
|
|
17
|
+
res = self._client._request("GET", f"/api/v1/actions/{action_id}")
|
|
18
|
+
return ActionStatusResponse(**res)
|
|
19
|
+
|
|
20
|
+
def submit_decision(self, approval: ActionApprovalRequest) -> ActionStatusResponse:
|
|
21
|
+
"""
|
|
22
|
+
Submit a human supervisor decision (APPROVE, REJECT, MODIFIED) for a staged action.
|
|
23
|
+
"""
|
|
24
|
+
res = self._client._request("POST", f"/api/v1/actions/{approval.action_id}/decision", json=approval.model_dump())
|
|
25
|
+
return ActionStatusResponse(**res)
|
|
26
|
+
|
|
27
|
+
class AsyncActionsResource:
|
|
28
|
+
def __init__(self, client):
|
|
29
|
+
self._client = client
|
|
30
|
+
|
|
31
|
+
async def get_status(self, action_id: str) -> ActionStatusResponse:
|
|
32
|
+
res = await self._client._request("GET", f"/api/v1/actions/{action_id}")
|
|
33
|
+
return ActionStatusResponse(**res)
|
|
34
|
+
|
|
35
|
+
async def submit_decision(self, approval: ActionApprovalRequest) -> ActionStatusResponse:
|
|
36
|
+
res = await self._client._request("POST", f"/api/v1/actions/{approval.action_id}/decision", json=approval.model_dump())
|
|
37
|
+
return ActionStatusResponse(**res)
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Hackmalim v1.0 Sovereign Non-LLM Engine Resource
|
|
3
|
+
Continuous-Time Liquid Neural ODE + Physics-Informed GNN + Causal SAT Verifier.
|
|
4
|
+
"""
|
|
5
|
+
|
|
6
|
+
from __future__ import annotations
|
|
7
|
+
|
|
8
|
+
from typing import Any
|
|
9
|
+
|
|
10
|
+
from ..models import HackmalimInferRequest, HackmalimInferResponse
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class HackmalimResource:
|
|
14
|
+
"""Synchronous client resource for Hackmalim v1.0."""
|
|
15
|
+
|
|
16
|
+
def __init__(self, client):
|
|
17
|
+
self._client = client
|
|
18
|
+
|
|
19
|
+
def info(self) -> dict[str, Any]:
|
|
20
|
+
"""Retrieve Hackmalim v1.0 model card, parameter counts, and layer metrics."""
|
|
21
|
+
return self._client._request("GET", "/api/v1/hackmalim/info")
|
|
22
|
+
|
|
23
|
+
def infer(
|
|
24
|
+
self,
|
|
25
|
+
shock_amplitude: float = 1.45,
|
|
26
|
+
jitter_severity: float = 1.0,
|
|
27
|
+
inlet_n0: float = 60.0,
|
|
28
|
+
inlet_n1: float = 50.0,
|
|
29
|
+
leak_node: int = 2,
|
|
30
|
+
leak_magnitude: float = 22.5,
|
|
31
|
+
p_max_kw: float = 55.0,
|
|
32
|
+
t_max_c: float = 72.0,
|
|
33
|
+
autonomous_budget_usd: float = 4200.0,
|
|
34
|
+
) -> HackmalimInferResponse:
|
|
35
|
+
"""Run full closed-loop 3-layer inference with EnterpriseGuardrailsEngine."""
|
|
36
|
+
req = HackmalimInferRequest(
|
|
37
|
+
shock_amplitude=shock_amplitude,
|
|
38
|
+
jitter_severity=jitter_severity,
|
|
39
|
+
inlet_n0=inlet_n0,
|
|
40
|
+
inlet_n1=inlet_n1,
|
|
41
|
+
leak_node=leak_node,
|
|
42
|
+
leak_magnitude=leak_magnitude,
|
|
43
|
+
p_max_kw=p_max_kw,
|
|
44
|
+
t_max_c=t_max_c,
|
|
45
|
+
autonomous_budget_usd=autonomous_budget_usd,
|
|
46
|
+
)
|
|
47
|
+
res = self._client._request(
|
|
48
|
+
"POST", "/api/v1/hackmalim/infer", json=req.model_dump()
|
|
49
|
+
)
|
|
50
|
+
return HackmalimInferResponse(**res)
|
|
51
|
+
|
|
52
|
+
def liquid(
|
|
53
|
+
self,
|
|
54
|
+
shock_idx: int = 160,
|
|
55
|
+
shock_amplitude: float = 1.45,
|
|
56
|
+
jitter_severity: float = 1.0,
|
|
57
|
+
) -> dict[str, Any]:
|
|
58
|
+
"""Run Layer 1 Continuous-Time Liquid Neural ODE shock detection."""
|
|
59
|
+
payload = {
|
|
60
|
+
"shock_idx": shock_idx,
|
|
61
|
+
"shock_amplitude": shock_amplitude,
|
|
62
|
+
"jitter_severity": jitter_severity,
|
|
63
|
+
}
|
|
64
|
+
return self._client._request("POST", "/api/v1/hackmalim/liquid", json=payload)
|
|
65
|
+
|
|
66
|
+
def pignn(
|
|
67
|
+
self,
|
|
68
|
+
inlet_n0: float = 60.0,
|
|
69
|
+
inlet_n1: float = 50.0,
|
|
70
|
+
leak_node: int = 2,
|
|
71
|
+
leak_magnitude: float = 22.5,
|
|
72
|
+
) -> dict[str, Any]:
|
|
73
|
+
"""Run Layer 2 Kirchhoff PI-GNN flow reconstruction and leak pinpointing."""
|
|
74
|
+
payload = {
|
|
75
|
+
"inlet_n0": inlet_n0,
|
|
76
|
+
"inlet_n1": inlet_n1,
|
|
77
|
+
"leak_node": leak_node,
|
|
78
|
+
"leak_magnitude": leak_magnitude,
|
|
79
|
+
}
|
|
80
|
+
return self._client._request("POST", "/api/v1/hackmalim/pignn", json=payload)
|
|
81
|
+
|
|
82
|
+
def causal(
|
|
83
|
+
self,
|
|
84
|
+
z_load_shift: float = 0.0,
|
|
85
|
+
stress_z: float = 0.95,
|
|
86
|
+
p_max_kw: float = 55.0,
|
|
87
|
+
t_max_c: float = 72.0,
|
|
88
|
+
neural_proposal: tuple[int, int, int, int] | None = None,
|
|
89
|
+
) -> dict[str, Any]:
|
|
90
|
+
"""Run Layer 3 Pearl Do-Calculus backdoor adjustment and SAT axiom verifier."""
|
|
91
|
+
payload: dict[str, Any] = {
|
|
92
|
+
"z_load_shift": z_load_shift,
|
|
93
|
+
"stress_z": stress_z,
|
|
94
|
+
"p_max_kw": p_max_kw,
|
|
95
|
+
"t_max_c": t_max_c,
|
|
96
|
+
}
|
|
97
|
+
if neural_proposal is not None:
|
|
98
|
+
payload["neural_proposal"] = list(neural_proposal)
|
|
99
|
+
return self._client._request("POST", "/api/v1/hackmalim/causal", json=payload)
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
class AsyncHackmalimResource:
|
|
103
|
+
"""Asynchronous client resource for Hackmalim v1.0."""
|
|
104
|
+
|
|
105
|
+
def __init__(self, client):
|
|
106
|
+
self._client = client
|
|
107
|
+
|
|
108
|
+
async def info(self) -> dict[str, Any]:
|
|
109
|
+
"""Retrieve Hackmalim v1.0 model card asynchronously."""
|
|
110
|
+
return await self._client._request("GET", "/api/v1/hackmalim/info")
|
|
111
|
+
|
|
112
|
+
async def infer(
|
|
113
|
+
self,
|
|
114
|
+
shock_amplitude: float = 1.45,
|
|
115
|
+
jitter_severity: float = 1.0,
|
|
116
|
+
inlet_n0: float = 60.0,
|
|
117
|
+
inlet_n1: float = 50.0,
|
|
118
|
+
leak_node: int = 2,
|
|
119
|
+
leak_magnitude: float = 22.5,
|
|
120
|
+
p_max_kw: float = 55.0,
|
|
121
|
+
t_max_c: float = 72.0,
|
|
122
|
+
autonomous_budget_usd: float = 4200.0,
|
|
123
|
+
) -> HackmalimInferResponse:
|
|
124
|
+
"""Run closed-loop 3-layer Hackmalim inference asynchronously."""
|
|
125
|
+
req = HackmalimInferRequest(
|
|
126
|
+
shock_amplitude=shock_amplitude,
|
|
127
|
+
jitter_severity=jitter_severity,
|
|
128
|
+
inlet_n0=inlet_n0,
|
|
129
|
+
inlet_n1=inlet_n1,
|
|
130
|
+
leak_node=leak_node,
|
|
131
|
+
leak_magnitude=leak_magnitude,
|
|
132
|
+
p_max_kw=p_max_kw,
|
|
133
|
+
t_max_c=t_max_c,
|
|
134
|
+
autonomous_budget_usd=autonomous_budget_usd,
|
|
135
|
+
)
|
|
136
|
+
res = await self._client._request(
|
|
137
|
+
"POST", "/api/v1/hackmalim/infer", json=req.model_dump()
|
|
138
|
+
)
|
|
139
|
+
return HackmalimInferResponse(**res)
|
|
140
|
+
|
|
141
|
+
async def liquid(
|
|
142
|
+
self,
|
|
143
|
+
shock_idx: int = 160,
|
|
144
|
+
shock_amplitude: float = 1.45,
|
|
145
|
+
jitter_severity: float = 1.0,
|
|
146
|
+
) -> dict[str, Any]:
|
|
147
|
+
"""Run Layer 1 Liquid ODE inference asynchronously."""
|
|
148
|
+
payload = {
|
|
149
|
+
"shock_idx": shock_idx,
|
|
150
|
+
"shock_amplitude": shock_amplitude,
|
|
151
|
+
"jitter_severity": jitter_severity,
|
|
152
|
+
}
|
|
153
|
+
return await self._client._request(
|
|
154
|
+
"POST", "/api/v1/hackmalim/liquid", json=payload
|
|
155
|
+
)
|
|
156
|
+
|
|
157
|
+
async def pignn(
|
|
158
|
+
self,
|
|
159
|
+
inlet_n0: float = 60.0,
|
|
160
|
+
inlet_n1: float = 50.0,
|
|
161
|
+
leak_node: int = 2,
|
|
162
|
+
leak_magnitude: float = 22.5,
|
|
163
|
+
) -> dict[str, Any]:
|
|
164
|
+
"""Run Layer 2 PI-GNN inference asynchronously."""
|
|
165
|
+
payload = {
|
|
166
|
+
"inlet_n0": inlet_n0,
|
|
167
|
+
"inlet_n1": inlet_n1,
|
|
168
|
+
"leak_node": leak_node,
|
|
169
|
+
"leak_magnitude": leak_magnitude,
|
|
170
|
+
}
|
|
171
|
+
return await self._client._request(
|
|
172
|
+
"POST", "/api/v1/hackmalim/pignn", json=payload
|
|
173
|
+
)
|
|
174
|
+
|
|
175
|
+
async def causal(
|
|
176
|
+
self,
|
|
177
|
+
z_load_shift: float = 0.0,
|
|
178
|
+
stress_z: float = 0.95,
|
|
179
|
+
p_max_kw: float = 55.0,
|
|
180
|
+
t_max_c: float = 72.0,
|
|
181
|
+
neural_proposal: tuple[int, int, int, int] | None = None,
|
|
182
|
+
) -> dict[str, Any]:
|
|
183
|
+
"""Run Layer 3 Pearl Do-Calculus + SAT verifier asynchronously."""
|
|
184
|
+
payload: dict[str, Any] = {
|
|
185
|
+
"z_load_shift": z_load_shift,
|
|
186
|
+
"stress_z": stress_z,
|
|
187
|
+
"p_max_kw": p_max_kw,
|
|
188
|
+
"t_max_c": t_max_c,
|
|
189
|
+
}
|
|
190
|
+
if neural_proposal is not None:
|
|
191
|
+
payload["neural_proposal"] = list(neural_proposal)
|
|
192
|
+
return await self._client._request(
|
|
193
|
+
"POST", "/api/v1/hackmalim/causal", json=payload
|
|
194
|
+
)
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"""
|
|
2
|
+
ERP vs Ledger Closed-Loop Reconciliation Resource
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
from typing import List, Dict, Any, Optional
|
|
6
|
+
from ..models import DiscrepancyReport
|
|
7
|
+
|
|
8
|
+
class ReconciliationResource:
|
|
9
|
+
def __init__(self, client):
|
|
10
|
+
self._client = client
|
|
11
|
+
|
|
12
|
+
def scan_discrepancies(
|
|
13
|
+
self,
|
|
14
|
+
erp_system: str = "SAP",
|
|
15
|
+
entity_type: str = "PURCHASE_ORDERS",
|
|
16
|
+
lookback_days: int = 7
|
|
17
|
+
) -> List[DiscrepancyReport]:
|
|
18
|
+
"""
|
|
19
|
+
Trigger reconciliation scan across enterprise ERP and telemetry ledgers.
|
|
20
|
+
"""
|
|
21
|
+
params = {
|
|
22
|
+
"erp_system": erp_system,
|
|
23
|
+
"entity_type": entity_type,
|
|
24
|
+
"lookback_days": lookback_days
|
|
25
|
+
}
|
|
26
|
+
res = self._client._request("GET", "/api/v1/reconciliation/discrepancies", params=params)
|
|
27
|
+
return [DiscrepancyReport(**item) for item in res.get("discrepancies", [])]
|
|
28
|
+
|
|
29
|
+
class AsyncReconciliationResource:
|
|
30
|
+
def __init__(self, client):
|
|
31
|
+
self._client = client
|
|
32
|
+
|
|
33
|
+
async def scan_discrepancies(
|
|
34
|
+
self,
|
|
35
|
+
erp_system: str = "SAP",
|
|
36
|
+
entity_type: str = "PURCHASE_ORDERS",
|
|
37
|
+
lookback_days: int = 7
|
|
38
|
+
) -> List[DiscrepancyReport]:
|
|
39
|
+
params = {
|
|
40
|
+
"erp_system": erp_system,
|
|
41
|
+
"entity_type": entity_type,
|
|
42
|
+
"lookback_days": lookback_days
|
|
43
|
+
}
|
|
44
|
+
res = await self._client._request("GET", "/api/v1/reconciliation/discrepancies", params=params)
|
|
45
|
+
return [DiscrepancyReport(**item) for item in res.get("discrepancies", [])]
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Sandalfon v1.0 Scientific Equation Discovery & Spectral AI Engine Resource
|
|
3
|
+
SINDy Sparse Discovery (STLSQ) + FFT Spectral Precursor Explorer + Popperian Test.
|
|
4
|
+
"""
|
|
5
|
+
|
|
6
|
+
from __future__ import annotations
|
|
7
|
+
|
|
8
|
+
from typing import Any, Literal
|
|
9
|
+
|
|
10
|
+
from ..models import (
|
|
11
|
+
SandalfonChatRequest,
|
|
12
|
+
SandalfonChatResponse,
|
|
13
|
+
SandalfonDiscoverRequest,
|
|
14
|
+
SandalfonDiscoverResponse,
|
|
15
|
+
)
|
|
16
|
+
|
|
17
|
+
SandalfonPreset = Literal["coupled_oscillator", "predator_prey_grid", "thermal_runaway"]
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
class SandalfonResource:
|
|
21
|
+
"""Synchronous client resource for Sandalfon v1.0."""
|
|
22
|
+
|
|
23
|
+
def __init__(self, client):
|
|
24
|
+
self._client = client
|
|
25
|
+
|
|
26
|
+
def info(self) -> dict[str, Any]:
|
|
27
|
+
"""Retrieve Sandalfon v1.0 model card and candidate monomial library."""
|
|
28
|
+
return self._client._request("GET", "/api/v1/sandalfon/info")
|
|
29
|
+
|
|
30
|
+
def discover(
|
|
31
|
+
self,
|
|
32
|
+
preset: SandalfonPreset = "coupled_oscillator",
|
|
33
|
+
noise_level: float = 0.02,
|
|
34
|
+
sparsity_threshold: float = 0.10,
|
|
35
|
+
precursor_amp: float = 0.18,
|
|
36
|
+
hypothesis_text: str | None = None,
|
|
37
|
+
) -> SandalfonDiscoverResponse:
|
|
38
|
+
"""Discover sparse ODEs, FFT wave precursors, and Popperian significance."""
|
|
39
|
+
req = SandalfonDiscoverRequest(
|
|
40
|
+
preset=preset,
|
|
41
|
+
noise_level=noise_level,
|
|
42
|
+
sparsity_threshold=sparsity_threshold,
|
|
43
|
+
precursor_amp=precursor_amp,
|
|
44
|
+
hypothesis_text=hypothesis_text,
|
|
45
|
+
)
|
|
46
|
+
res = self._client._request(
|
|
47
|
+
"POST", "/api/v1/sandalfon/discover", json=req.model_dump()
|
|
48
|
+
)
|
|
49
|
+
return SandalfonDiscoverResponse(**res)
|
|
50
|
+
|
|
51
|
+
def chat(
|
|
52
|
+
self,
|
|
53
|
+
message: str,
|
|
54
|
+
preset: SandalfonPreset = "coupled_oscillator",
|
|
55
|
+
noise_level: float = 0.02,
|
|
56
|
+
sparsity_threshold: float = 0.10,
|
|
57
|
+
precursor_amp: float = 0.18,
|
|
58
|
+
) -> SandalfonChatResponse:
|
|
59
|
+
"""Interact in natural language with Sandalfon to test hypotheses."""
|
|
60
|
+
req = SandalfonChatRequest(
|
|
61
|
+
message=message,
|
|
62
|
+
preset=preset,
|
|
63
|
+
noise_level=noise_level,
|
|
64
|
+
sparsity_threshold=sparsity_threshold,
|
|
65
|
+
precursor_amp=precursor_amp,
|
|
66
|
+
)
|
|
67
|
+
res = self._client._request(
|
|
68
|
+
"POST", "/api/v1/sandalfon/chat", json=req.model_dump()
|
|
69
|
+
)
|
|
70
|
+
return SandalfonChatResponse(**res)
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
class AsyncSandalfonResource:
|
|
74
|
+
"""Asynchronous client resource for Sandalfon v1.0."""
|
|
75
|
+
|
|
76
|
+
def __init__(self, client):
|
|
77
|
+
self._client = client
|
|
78
|
+
|
|
79
|
+
async def info(self) -> dict[str, Any]:
|
|
80
|
+
"""Retrieve Sandalfon v1.0 model card asynchronously."""
|
|
81
|
+
return await self._client._request("GET", "/api/v1/sandalfon/info")
|
|
82
|
+
|
|
83
|
+
async def discover(
|
|
84
|
+
self,
|
|
85
|
+
preset: SandalfonPreset = "coupled_oscillator",
|
|
86
|
+
noise_level: float = 0.02,
|
|
87
|
+
sparsity_threshold: float = 0.10,
|
|
88
|
+
precursor_amp: float = 0.18,
|
|
89
|
+
hypothesis_text: str | None = None,
|
|
90
|
+
) -> SandalfonDiscoverResponse:
|
|
91
|
+
"""Discover sparse ODEs and spectral precursors asynchronously."""
|
|
92
|
+
req = SandalfonDiscoverRequest(
|
|
93
|
+
preset=preset,
|
|
94
|
+
noise_level=noise_level,
|
|
95
|
+
sparsity_threshold=sparsity_threshold,
|
|
96
|
+
precursor_amp=precursor_amp,
|
|
97
|
+
hypothesis_text=hypothesis_text,
|
|
98
|
+
)
|
|
99
|
+
res = await self._client._request(
|
|
100
|
+
"POST", "/api/v1/sandalfon/discover", json=req.model_dump()
|
|
101
|
+
)
|
|
102
|
+
return SandalfonDiscoverResponse(**res)
|
|
103
|
+
|
|
104
|
+
async def chat(
|
|
105
|
+
self,
|
|
106
|
+
message: str,
|
|
107
|
+
preset: SandalfonPreset = "coupled_oscillator",
|
|
108
|
+
noise_level: float = 0.02,
|
|
109
|
+
sparsity_threshold: float = 0.10,
|
|
110
|
+
precursor_amp: float = 0.18,
|
|
111
|
+
) -> SandalfonChatResponse:
|
|
112
|
+
"""Query Sandalfon research dialogue asynchronously."""
|
|
113
|
+
req = SandalfonChatRequest(
|
|
114
|
+
message=message,
|
|
115
|
+
preset=preset,
|
|
116
|
+
noise_level=noise_level,
|
|
117
|
+
sparsity_threshold=sparsity_threshold,
|
|
118
|
+
precursor_amp=precursor_amp,
|
|
119
|
+
)
|
|
120
|
+
res = await self._client._request(
|
|
121
|
+
"POST", "/api/v1/sandalfon/chat", json=req.model_dump()
|
|
122
|
+
)
|
|
123
|
+
return SandalfonChatResponse(**res)
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Telemetry Ingestion & Stream Resource
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
from typing import List, Union, Dict, Any
|
|
6
|
+
from ..models import TelemetryRecord, TelemetryIngestResponse
|
|
7
|
+
|
|
8
|
+
class TelemetryResource:
|
|
9
|
+
def __init__(self, client):
|
|
10
|
+
self._client = client
|
|
11
|
+
|
|
12
|
+
def ingest(self, stream_id: str, records: List[Union[TelemetryRecord, Dict[str, Any]]]) -> TelemetryIngestResponse:
|
|
13
|
+
"""
|
|
14
|
+
Ingest a batch of operational telemetry records into Omnesight real-time pipelines.
|
|
15
|
+
"""
|
|
16
|
+
payload = {
|
|
17
|
+
"stream_id": stream_id,
|
|
18
|
+
"records": [r.model_dump() if isinstance(r, TelemetryRecord) else r for r in records]
|
|
19
|
+
}
|
|
20
|
+
res = self._client._request("POST", "/api/v1/telemetry/ingest", json=payload)
|
|
21
|
+
return TelemetryIngestResponse(**res)
|
|
22
|
+
|
|
23
|
+
class AsyncTelemetryResource:
|
|
24
|
+
def __init__(self, client):
|
|
25
|
+
self._client = client
|
|
26
|
+
|
|
27
|
+
async def ingest(self, stream_id: str, records: List[Union[TelemetryRecord, Dict[str, Any]]]) -> TelemetryIngestResponse:
|
|
28
|
+
payload = {
|
|
29
|
+
"stream_id": stream_id,
|
|
30
|
+
"records": [r.model_dump() if isinstance(r, TelemetryRecord) else r for r in records]
|
|
31
|
+
}
|
|
32
|
+
res = await self._client._request("POST", "/api/v1/telemetry/ingest", json=payload)
|
|
33
|
+
return TelemetryIngestResponse(**res)
|
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: omnesight
|
|
3
|
+
Version: 1.1.0
|
|
4
|
+
Summary: Official Python SDK for Omnesight Sovereign Operational Intelligence & Autonomous Execution Infrastructure
|
|
5
|
+
Project-URL: Homepage, https://omnesight.com
|
|
6
|
+
Project-URL: Documentation, https://omnesight.com/docs
|
|
7
|
+
Project-URL: Repository, https://github.com/Omnesight/omnesight-python
|
|
8
|
+
Project-URL: Security Policy, https://github.com/Omnesight/.github/blob/main/SECURITY.md
|
|
9
|
+
Author-email: Omnesight Infrastructure Team <solutions@omnesight.com>
|
|
10
|
+
License-Expression: Apache-2.0
|
|
11
|
+
License-File: LICENSE
|
|
12
|
+
Keywords: autonomous-execution,enterprise-ai,erp-reconciliation,omnesight,operational-intelligence,sovereign-ai,telemetry
|
|
13
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
14
|
+
Classifier: Intended Audience :: Developers
|
|
15
|
+
Classifier: Intended Audience :: Information Technology
|
|
16
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
17
|
+
Classifier: Programming Language :: Python :: 3
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
22
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
23
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
24
|
+
Requires-Python: >=3.9
|
|
25
|
+
Requires-Dist: httpx>=0.25.0
|
|
26
|
+
Requires-Dist: pydantic>=2.5.0
|
|
27
|
+
Requires-Dist: typing-extensions>=4.8.0
|
|
28
|
+
Provides-Extra: dev
|
|
29
|
+
Requires-Dist: pytest-asyncio>=0.21.0; extra == 'dev'
|
|
30
|
+
Requires-Dist: pytest>=7.4.0; extra == 'dev'
|
|
31
|
+
Requires-Dist: ruff>=0.1.0; extra == 'dev'
|
|
32
|
+
Description-Content-Type: text/markdown
|
|
33
|
+
|
|
34
|
+
<div align="center">
|
|
35
|
+
|
|
36
|
+
# Omnesight Python SDK
|
|
37
|
+
|
|
38
|
+
**The official Python client library for Omnesight Sovereign Operational Intelligence & Autonomous Execution Infrastructure.**
|
|
39
|
+
|
|
40
|
+
[](https://pypi.org/project/omnesight/)
|
|
41
|
+
[](https://pypi.org/project/omnesight/)
|
|
42
|
+
[](LICENSE)
|
|
43
|
+
[](https://github.com/Omnesight/.github/blob/main/SECURITY.md)
|
|
44
|
+
|
|
45
|
+
[Website](https://omnesight.com) • [Documentation](https://omnesight.com/docs) • [Security & Compliance](https://github.com/Omnesight/.github/blob/main/SECURITY.md) • [Support](https://github.com/Omnesight/.github/blob/main/SUPPORT.md)
|
|
46
|
+
|
|
47
|
+
</div>
|
|
48
|
+
|
|
49
|
+
---
|
|
50
|
+
|
|
51
|
+
## Overview
|
|
52
|
+
|
|
53
|
+
The **Omnesight Python SDK** provides typed access to Omnesight's sovereign Non-LLM scientific engines (**Hackmalim v1.0**, **Sandalfon v1.0**) alongside enterprise operational intelligence gateways:
|
|
54
|
+
|
|
55
|
+
* **Hackmalim v1.0 (`client.hackmalim`):** 3-layer Non-LLM control combining Continuous-Time Liquid Neural ODEs, Kirchhoff Physics-Informed GNNs, and Pearl Do-Calculus + SAT Axiom Verification.
|
|
56
|
+
* **Sandalfon v1.0 (`client.sandalfon`):** Sparse differential equation discovery (SINDy/STLSQ), FFT spectral wave precursor extraction, and Popperian permutation falsification.
|
|
57
|
+
* **Ingest Multi-Source Telemetry:** Stream telemetry from SCADA, IoT sensors, GPS fleets, and warehouse terminals in sub-second latency.
|
|
58
|
+
* **Closed-Loop ERP Reconciliation:** Automatically detect and resolve transactional variances across SAP S/4HANA, Oracle NetSuite, Microsoft Dynamics 365, and financial ledgers.
|
|
59
|
+
* **Supervised Action Protocol (SAP):** Execute automated operational interventions under deterministic governance policies and cryptographic audit trails.
|
|
60
|
+
|
|
61
|
+
---
|
|
62
|
+
|
|
63
|
+
## Installation
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
pip install omnesight
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
---
|
|
70
|
+
|
|
71
|
+
## Quickstart
|
|
72
|
+
|
|
73
|
+
### 1. Sovereign Scientific & Control Engines (`Hackmalim` & `Sandalfon`)
|
|
74
|
+
|
|
75
|
+
```python
|
|
76
|
+
from omnesight import Omnesight
|
|
77
|
+
|
|
78
|
+
# Reads OMNESIGHT_API_KEY and OMNESIGHT_BASE_URL (defaults to http://127.0.0.1:8001)
|
|
79
|
+
client = Omnesight(
|
|
80
|
+
api_key="omne_live_your_secret_key",
|
|
81
|
+
base_url="https://mlops-api.omnesight.com",
|
|
82
|
+
)
|
|
83
|
+
|
|
84
|
+
# Sandalfon v1.0: Extract sparse ODEs + spectral FFT wave precursors
|
|
85
|
+
discovery = client.sandalfon.discover(
|
|
86
|
+
preset="thermal_runaway",
|
|
87
|
+
noise_level=0.02,
|
|
88
|
+
sparsity_threshold=0.10,
|
|
89
|
+
precursor_amp=0.18,
|
|
90
|
+
hypothesis_text="Cable thermal overload precursor detection",
|
|
91
|
+
)
|
|
92
|
+
print(discovery.sindy["discovered_eq_x"], discovery.hypothesis_test["z_score"])
|
|
93
|
+
|
|
94
|
+
dialogue = client.sandalfon.chat(
|
|
95
|
+
message="Analyse les précurseurs thermiques sur les câbles",
|
|
96
|
+
preset="thermal_runaway",
|
|
97
|
+
)
|
|
98
|
+
print(dialogue.spoken_reply)
|
|
99
|
+
|
|
100
|
+
# Hackmalim v1.0: Closed-loop Liquid ODE + PI-GNN + Causal SAT Verifier
|
|
101
|
+
res = client.hackmalim.infer(
|
|
102
|
+
shock_amplitude=1.45,
|
|
103
|
+
leak_node=2,
|
|
104
|
+
leak_magnitude=22.5,
|
|
105
|
+
p_max_kw=55.0,
|
|
106
|
+
t_max_c=72.0,
|
|
107
|
+
)
|
|
108
|
+
print(res.target_entity_id, res.enterprise_guardrail)
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
### 2. Synchronous Enterprise Telemetry Client
|
|
112
|
+
|
|
113
|
+
```python
|
|
114
|
+
from omnesight import Omnesight
|
|
115
|
+
|
|
116
|
+
# Initialize the client (reads OMNESIGHT_API_KEY & OMNESIGHT_BASE_URL from environment if omitted)
|
|
117
|
+
client = Omnesight(
|
|
118
|
+
api_key="your_api_key_here",
|
|
119
|
+
base_url="https://omnesight.internal.company.com" # Your private VPC or dedicated sovereign gateway
|
|
120
|
+
)
|
|
121
|
+
|
|
122
|
+
# 1. Ingest asset telemetry
|
|
123
|
+
response = client.telemetry.ingest(
|
|
124
|
+
stream_id="freight-corridor-lagos-kano",
|
|
125
|
+
records=[
|
|
126
|
+
{
|
|
127
|
+
"device_id": "TRUCK-GPS-104",
|
|
128
|
+
"metric": "cargo_seal_integrity",
|
|
129
|
+
"value": 1.0,
|
|
130
|
+
"metadata": {"driver": "ID-992", "cargo": "Refined Petroleum"}
|
|
131
|
+
}
|
|
132
|
+
]
|
|
133
|
+
)
|
|
134
|
+
print(f"Batch {response.batch_id} ingested in {response.duration_ms}ms")
|
|
135
|
+
|
|
136
|
+
# 2. Scan ERP vs Ledger Discrepancies
|
|
137
|
+
discrepancies = client.reconciliation.scan_discrepancies(
|
|
138
|
+
erp_system="SAP",
|
|
139
|
+
entity_type="PURCHASE_ORDERS",
|
|
140
|
+
lookback_days=7
|
|
141
|
+
)
|
|
142
|
+
|
|
143
|
+
for d in discrepancies:
|
|
144
|
+
print(f"Discrepancy #{d.discrepancy_id}: Variance ${d.variance_amount_usd:,.2f} ({d.status})")
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
---
|
|
148
|
+
|
|
149
|
+
### 2. Asynchronous Client (AsyncIO / High Concurrency)
|
|
150
|
+
|
|
151
|
+
For data engineering pipelines or FastAPI backends handling thousands of events per second:
|
|
152
|
+
|
|
153
|
+
```python
|
|
154
|
+
import asyncio
|
|
155
|
+
from omnesight import AsyncOmnesight
|
|
156
|
+
|
|
157
|
+
async def main():
|
|
158
|
+
async with AsyncOmnesight(api_key="your_api_key_here") as client:
|
|
159
|
+
response = await client.telemetry.ingest(
|
|
160
|
+
stream_id="scada-compressor-alpha",
|
|
161
|
+
records=[
|
|
162
|
+
{"device_id": "CMP-01", "metric": "vibration_hz", "value": 44.2}
|
|
163
|
+
]
|
|
164
|
+
)
|
|
165
|
+
print(f"Ingested batch: {response.batch_id}")
|
|
166
|
+
|
|
167
|
+
asyncio.run(main())
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
---
|
|
171
|
+
|
|
172
|
+
## Enterprise VPC & Sovereign Deployments
|
|
173
|
+
|
|
174
|
+
For single-tenant institutional customers running Omnesight within a private VPC (AWS, Azure, GCP, Alibaba Cloud) or air-gapped on-premise Kubernetes cluster:
|
|
175
|
+
|
|
176
|
+
```python
|
|
177
|
+
client = Omnesight(
|
|
178
|
+
api_key="your_sovereign_vpc_token",
|
|
179
|
+
base_url="https://omnesight.internal.company.com", # Private VPC endpoint
|
|
180
|
+
timeout=60.0
|
|
181
|
+
)
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
---
|
|
185
|
+
|
|
186
|
+
## Supervised Action Protocol (SAP)
|
|
187
|
+
|
|
188
|
+
Automated write-backs to core ERPs and ledger reconciliations require policy validation:
|
|
189
|
+
|
|
190
|
+
```python
|
|
191
|
+
from omnesight.models import ActionApprovalRequest
|
|
192
|
+
|
|
193
|
+
# Retrieve status of an automated action staged by the cognitive engine
|
|
194
|
+
action = client.actions.get_status("ACT-88492")
|
|
195
|
+
print(f"Action: {action.action_type} | Impact: ${action.financial_impact_usd} | State: {action.state}")
|
|
196
|
+
|
|
197
|
+
# Submit human-in-the-loop supervisor approval
|
|
198
|
+
client.actions.submit_decision(ActionApprovalRequest(
|
|
199
|
+
action_id="ACT-88492",
|
|
200
|
+
action_type="ERP_LEDGER_WRITE",
|
|
201
|
+
target_entity="PO-77189",
|
|
202
|
+
decision="APPROVE",
|
|
203
|
+
supervisor_id="SUP-MAV-01",
|
|
204
|
+
supervisor_notes="Validated with physical bill of lading #BL-9921"
|
|
205
|
+
))
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
---
|
|
209
|
+
|
|
210
|
+
## Security & Data Sovereignty
|
|
211
|
+
|
|
212
|
+
* **Zero Frontier Model Training:** Omnesight never ingests customer transactional payloads or telemetry into public foundation model weights.
|
|
213
|
+
* **Cryptographic Traceability:** Every staged action is signed with a SHA-256 audit hash.
|
|
214
|
+
* **Security Advisories:** For vulnerability disclosure, see [SECURITY.md](https://github.com/Omnesight/.github/blob/main/SECURITY.md) or email `security@omnesight.com`.
|
|
215
|
+
|
|
216
|
+
---
|
|
217
|
+
|
|
218
|
+
## License
|
|
219
|
+
|
|
220
|
+
Apache License 2.0. See [LICENSE](LICENSE) for details.
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
omnesight/__init__.py,sha256=6zsBLaNYZDnfIb3Fstyi-qMMW4gviuScFWrQ2U52yiI,909
|
|
2
|
+
omnesight/client.py,sha256=tBt30PcUsk5SMhKlNw0Z0Xa-MWkVwaUcydFtLT5CyGA,6183
|
|
3
|
+
omnesight/exceptions.py,sha256=ubJy--dgR9d9V4MkCHbjfDmol117pqDWZgdIUXiv-wM,1043
|
|
4
|
+
omnesight/models.py,sha256=YuexEUx3fgPhVWezIXedpECBElOwYt4z5Bl6hcVShEc,4935
|
|
5
|
+
omnesight/resources/__init__.py,sha256=2gwMu3qv3--o0cD30FXs6YfViI5z22jdTmDDmbMMgwA,630
|
|
6
|
+
omnesight/resources/actions.py,sha256=zRKvYTl8CefoIvk2pF4h7atMwv4x2ascvqLnq8Z-2L4,1524
|
|
7
|
+
omnesight/resources/hackmalim.py,sha256=GI-fVTv6WTvduCJE1__ho_AWYavz10M45AdcnP_L3fM,6522
|
|
8
|
+
omnesight/resources/reconciliation.py,sha256=zX2WSROs3gKe6IyGkjxPillu5BN1veJeQRZg8R-iMis,1489
|
|
9
|
+
omnesight/resources/sandalfon.py,sha256=xf3ycx4S1A7FgMbGFCMPMiYwIYThJrPNXZBjTDvi2w4,4157
|
|
10
|
+
omnesight/resources/telemetry.py,sha256=yUd9XGt8Nbp1qH6hAdTteruXSG-Mi0EP4z2V1ZhDfHQ,1294
|
|
11
|
+
omnesight-1.1.0.dist-info/METADATA,sha256=qhw9HKtej1-jVbB-RwwdntYGRJaY9ctR-qP1JvFvAuc,8163
|
|
12
|
+
omnesight-1.1.0.dist-info/WHEEL,sha256=2iZrJkDIkeDh0k9SikKMqFuRP-ua6mb4Ir1AsER4BEw,87
|
|
13
|
+
omnesight-1.1.0.dist-info/licenses/LICENSE,sha256=_uDRmBuozFO_P59gE4FF11cdRMujChrEloTCIaGelnM,4513
|
|
14
|
+
omnesight-1.1.0.dist-info/RECORD,,
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work.
|
|
38
|
+
|
|
39
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
40
|
+
form, that is based on (or derived from) the Work and for which the
|
|
41
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
42
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
43
|
+
of this License, Derivative Works shall not include works that remain
|
|
44
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
45
|
+
the Work and Derivative Works thereof.
|
|
46
|
+
|
|
47
|
+
"Contribution" shall mean any work of authorship, including
|
|
48
|
+
the original version of the Work and any modifications or additions
|
|
49
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
50
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
51
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
52
|
+
the copyright owner.
|
|
53
|
+
|
|
54
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
55
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
56
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
57
|
+
copyright license to use, reproduce, modify, display, perform,
|
|
58
|
+
sublicense, and distribute the Work and such Derivative Works.
|
|
59
|
+
|
|
60
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
61
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
62
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
63
|
+
patent license to make, have made, use, sell, offer to sell,
|
|
64
|
+
import, and otherwise transfer the Work.
|
|
65
|
+
|
|
66
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
67
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
68
|
+
modifications, provided that You meet the following conditions:
|
|
69
|
+
(a) You must give any other recipients of the Work a copy of this License; and
|
|
70
|
+
(b) You must cause any modified files to carry prominent notices stating
|
|
71
|
+
that You changed the files; and
|
|
72
|
+
(c) You must retain, in the Source form of any Derivative Works, all
|
|
73
|
+
copyright, patent, trademark, and attribution notices from the Source form.
|
|
74
|
+
|
|
75
|
+
Copyright 2026 Omnesight
|
|
76
|
+
|
|
77
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
78
|
+
you may not use this file except in compliance with the License.
|
|
79
|
+
You may obtain a copy of the License at
|
|
80
|
+
|
|
81
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
82
|
+
|
|
83
|
+
Unless required by applicable law or agreed to in writing, software
|
|
84
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
85
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
86
|
+
See the License for the specific language governing permissions and
|
|
87
|
+
limitations under the License.
|