eve-coreguard 0.1.1__tar.gz

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.
@@ -0,0 +1,196 @@
1
+ # Python
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+ *.so
6
+ *.egg
7
+ *.egg-info/
8
+ dist/
9
+ build/
10
+ eggs/
11
+ .eggs/
12
+ lib/
13
+ lib64/
14
+ parts/
15
+ sdist/
16
+ var/
17
+ wheels/
18
+ pip-wheel-metadata/
19
+ share/python-wheels/
20
+ *.manifest
21
+ *.spec
22
+
23
+ # Virtual Environments
24
+ venv/
25
+ ENV/
26
+ env/
27
+ .venv
28
+
29
+ # PyCharm
30
+ .idea/
31
+
32
+ # VS Code
33
+ .vscode/
34
+ *.code-workspace
35
+
36
+ # Jupyter Notebook
37
+ .ipynb_checkpoints
38
+ *.ipynb
39
+
40
+ # Data and Models
41
+ data/backups/
42
+ data/temp/
43
+ data/cache/
44
+ *.pkl
45
+ *.h5
46
+ *.pth
47
+ *.ckpt
48
+ *.safetensors
49
+ models/
50
+ # saas/models contains Python source, not ML weights — un-ignore it
51
+ !saas/models/
52
+ !saas/models/**
53
+
54
+ # Logs
55
+ logs/
56
+ *.log
57
+ *.out
58
+ *.err
59
+
60
+ # Testing
61
+ .coverage
62
+ .pytest_cache/
63
+ htmlcov/
64
+ .tox/
65
+ .nox/
66
+ coverage.xml
67
+ *.cover
68
+ .hypothesis/
69
+ test_results/
70
+
71
+ # Documentation
72
+ docs/_build/
73
+ site/
74
+
75
+ # Environment files
76
+ .env
77
+ .env.local
78
+ .env.*.local
79
+ *.env
80
+
81
+ # System files
82
+ .DS_Store
83
+ Thumbs.db
84
+ desktop.ini
85
+
86
+ # Temporary files
87
+ *.tmp
88
+ *.temp
89
+ *.swp
90
+ *.swo
91
+ *~
92
+ .tmp/
93
+
94
+ # Database
95
+ *.db
96
+ *.sqlite
97
+ *.sqlite3
98
+
99
+ # Secrets and credentials
100
+ *.key
101
+ *.pem
102
+ *.crt
103
+ *.pfx
104
+ secrets/
105
+ credentials/
106
+
107
+ # Performance profiling
108
+ *.prof
109
+ *.lprof
110
+
111
+ # Memory dumps
112
+ *.hprof
113
+ *.dump
114
+
115
+ # Claude
116
+ .claude/
117
+
118
+ # Local configuration overrides
119
+ config.local.yaml
120
+ settings.local.json
121
+
122
+ # Node modules
123
+ node_modules/
124
+
125
+ # FFmpeg binaries
126
+ ffmpeg.exe
127
+ ffprobe.exe
128
+ ffmpeg.zip
129
+ ffmpeg/
130
+
131
+ # Large binary files
132
+ *.exe
133
+ *.zip
134
+ *.wav
135
+
136
+ # Runtime data files
137
+ # Deployment-time generated files (written by CI, never committed)
138
+ data/deployment_manifest.json
139
+ data/logs/
140
+
141
+ # Autonomous-agent runtime outputs (confined here by core/autonomy/safe_output.py)
142
+ # and per-deployment status recorder state. Runtime artifacts, never committed.
143
+ data/runtime/
144
+ data/status/uptime_daily.json
145
+ data/*.db
146
+ data/*.sqlite
147
+
148
+ data/saas.db-shm
149
+ data/saas.db-wal
150
+
151
+ # --- P0-1: Audit chain durability ---
152
+ # The signed audit chain and governance evidence are EVE's store of record.
153
+ # They MUST NOT be git-tracked: git operations (checkout/reset/stash/merge)
154
+ # could silently rewrite the chain of custody. See scripts/migrate_audit_store.py
155
+ # and core/audit/store_guard.py. Relocate via EVE_AUDIT_STORE in production.
156
+ data/audit/
157
+ data/governance/
158
+ .chain_seal.json
159
+ **/.chain_seal.json
160
+ **/chain_seal.json
161
+ audit_migration_report.json
162
+
163
+ # P0-2: DR backup / restore drill artifacts (contain DB + audit copies — never commit)
164
+ /backups/
165
+ /restore_drills/
166
+ /restore_target/
167
+ restore_report.json
168
+
169
+ # P0-3: generated migration reconciliation artifact (regenerated each run)
170
+ POSTGRES_MIGRATION_RECONCILIATION.json
171
+ ALERT_VERIFICATION_REPORT.md
172
+
173
+ data/tts_cache/
174
+ data/voice_cache/
175
+ data/voice_events_log.json
176
+ data/ui_preferences_cache.json
177
+ data/uploads/
178
+ data/chroma/
179
+ data/test/
180
+ data/deep_integration_test_report.json
181
+ data/subsystem_config.json
182
+ data/sentience_calibration_knobs.json
183
+ load_test_results/
184
+ eve_log.txt
185
+ test_output.wav
186
+ static_deploy.zip
187
+ nul
188
+
189
+ # Temp JS files
190
+ tmp_*.js
191
+
192
+ # OS / editor artifacts
193
+ extglob.FullName
194
+ *.lnk
195
+ MiroShark/
196
+ ruflo/
@@ -0,0 +1,217 @@
1
+ Metadata-Version: 2.4
2
+ Name: eve-coreguard
3
+ Version: 0.1.1
4
+ Summary: EVE CoreGuard SDK — AI Governance Enforcement in One API Call
5
+ Project-URL: Homepage, https://eveaicore.com
6
+ Project-URL: Documentation, https://docs.eveaicore.com/sdk
7
+ Author: EVE NeuroSystems LLC
8
+ License-Expression: LicenseRef-Proprietary
9
+ Classifier: Development Status :: 4 - Beta
10
+ Classifier: Intended Audience :: Developers
11
+ Classifier: License :: Other/Proprietary License
12
+ Classifier: Programming Language :: Python :: 3
13
+ Classifier: Programming Language :: Python :: 3.9
14
+ Classifier: Programming Language :: Python :: 3.10
15
+ Classifier: Programming Language :: Python :: 3.11
16
+ Classifier: Programming Language :: Python :: 3.12
17
+ Classifier: Programming Language :: Python :: 3.13
18
+ Classifier: Topic :: Security
19
+ Classifier: Topic :: Software Development :: Libraries
20
+ Classifier: Typing :: Typed
21
+ Requires-Python: >=3.9
22
+ Provides-Extra: async
23
+ Requires-Dist: aiohttp>=3.8; extra == 'async'
24
+ Description-Content-Type: text/markdown
25
+
26
+ # EVE CoreGuard SDK
27
+
28
+ **AI Governance Enforcement in One API Call.**
29
+
30
+ CoreGuard intercepts AI-generated decisions before execution, evaluates them against policy, and returns an auditable enforcement verdict.
31
+
32
+ ## Install
33
+
34
+ ```bash
35
+ pip install eve-coreguard
36
+ ```
37
+
38
+ ## Quick Start
39
+
40
+ ```python
41
+ from eve_coreguard import CoreGuardClient
42
+
43
+ client = CoreGuardClient(
44
+ api_key="eve_sk_...",
45
+ base_url="https://api.eveaicore.com", # or http://localhost:8000
46
+ )
47
+
48
+ # Evaluate a proposed lending decision against policy
49
+ result = client.evaluate(
50
+ tenant_id="bank_001",
51
+ proposed_action={"type": "loan_approval", "amount": 250000, "currency": "USD"},
52
+ model_output={"decision": "approve", "confidence": 0.91},
53
+ context={
54
+ "credit_score": 580,
55
+ "debt_to_income": 0.52,
56
+ "employment_verified": False,
57
+ },
58
+ policy_set="lending_v1",
59
+ )
60
+
61
+ if result.blocked:
62
+ print(f"BLOCKED: {result.decision.action}")
63
+ print(f"Risk: {result.risk.score} ({result.risk.level})")
64
+ for v in result.policy_violations:
65
+ print(f" - {v.policy_id}: {v.description}")
66
+ if result.liability_prevented:
67
+ print(f"Exposure prevented: {result.liability_prevented.estimated_exposure}")
68
+ ```
69
+
70
+ ## Core Methods
71
+
72
+ ### Decision Enforcement
73
+
74
+ ```python
75
+ result = client.evaluate(
76
+ tenant_id="org_001",
77
+ proposed_action={"type": "loan_approval", "amount": 250000},
78
+ model_output={"decision": "approve", "confidence": 0.91},
79
+ context={"credit_score": 580, "debt_to_income": 0.52},
80
+ policy_set="lending_v1",
81
+ )
82
+ # result.decision.status: ALLOWED | BLOCKED | MODIFIED
83
+ # result.risk.score: 0.0-1.0
84
+ # result.policy_violations: list of violated rules
85
+ # result.regulatory_impact: ECOA, TILA, etc.
86
+ # result.counterfactual: what would have passed
87
+ # result.liability_prevented: estimated exposure
88
+ # result.audit: cryptographic audit trail
89
+ ```
90
+
91
+ ### AI Output Verification
92
+
93
+ ```python
94
+ vr = client.verify(
95
+ ai_output="The capital of France is Paris.",
96
+ confidence=0.9,
97
+ domain="factual",
98
+ )
99
+ # vr.passed / vr.blocked
100
+ # vr.crd — Confidence-Reality Divergence score
101
+ # vr.veto.type — pass | soft_veto | hard_veto | charter
102
+ # vr.evidence — step-by-step audit chain
103
+ ```
104
+
105
+ ### Audit & Compliance
106
+
107
+ ```python
108
+ # Retrieve cryptographic proof of a governance decision
109
+ proof = client.get_proof("proof_abc123")
110
+ # proof.content_hash, proof.signature, proof.chain_position
111
+
112
+ # Export decision history
113
+ export = client.export_audit(since="2026-01-01T00:00:00Z", limit=100)
114
+ for record in export.records:
115
+ print(f"{record.decision_type}: {record.decision}")
116
+
117
+ # Verify hash chain integrity
118
+ status = client.verify_chain()
119
+ ```
120
+
121
+ ## Configuration
122
+
123
+ | Parameter | Default | Description |
124
+ |-----------|---------|-------------|
125
+ | `api_key` | *required* | EVE API key (`eve_sk_...`) |
126
+ | `base_url` | `https://api.eveaicore.com` | API endpoint |
127
+ | `timeout` | `30.0` | Request timeout (seconds) |
128
+ | `max_retries` | `3` | Retry count for 5xx errors |
129
+ | `raise_on_veto` | `False` | Raise `VetoError` on governance blocks |
130
+
131
+ ## Error Handling
132
+
133
+ ```python
134
+ from eve_coreguard import CoreGuardClient, AuthError, RateLimitError, VetoError
135
+
136
+ try:
137
+ result = client.evaluate(...)
138
+ except AuthError:
139
+ print("Invalid API key")
140
+ except RateLimitError as e:
141
+ print(f"Rate limited — retry in {e.retry_after}s")
142
+ except VetoError as e:
143
+ print(f"Governance veto: {e.veto_type}")
144
+ ```
145
+
146
+ ## Response Metadata (subscription + rate limits)
147
+
148
+ Every call captures the response's billing and rate-limit headers. Read them
149
+ after a call (or after catching an error):
150
+
151
+ ```python
152
+ result = client.evaluate(tenant_id="bank_001", ...)
153
+
154
+ client.subscription_state # 'active' | 'past_due' | 'restricted' | ...
155
+ client.access_state # 'full_access' | 'warning' | 'read_only' | ...
156
+ client.quota_warning # 'payment_past_due' when degraded-but-allowed, else None
157
+ client.rate_limit_limit # '330' | 'unlimited'
158
+ client.rate_limit_remaining # calls left in the current 60s window (int | None)
159
+ client.retry_after # seconds to wait after a 429 (int | None)
160
+ ```
161
+
162
+ The decision endpoint is rate-limited per org by plan tier (Free 10/min,
163
+ Pro 330/min, Team 1150/min, Enterprise/Sovereign unlimited). On exhaustion it
164
+ returns `429` with `Retry-After`. See
165
+ [Response-Header Contract](../../docs/sdk/RESPONSE_HEADER_CONTRACT.md).
166
+
167
+ ## Live Demo (Local)
168
+
169
+ Run a full end-to-end enforcement decision in 3 steps:
170
+
171
+ **Step 1: Start the server**
172
+
173
+ ```bash
174
+ cd /path/to/EVE
175
+ python -m uvicorn saas.app:app --port 8000
176
+ ```
177
+
178
+ **Step 2: Install the SDK**
179
+
180
+ ```bash
181
+ cd sdks/coreguard
182
+ pip install -e .
183
+ ```
184
+
185
+ **Step 3: Run the demo**
186
+
187
+ ```bash
188
+ python run_demo.py
189
+ ```
190
+
191
+ **Expected output:**
192
+
193
+ ```
194
+ Decision: BLOCKED
195
+ Action: deny_loan_approval
196
+ Risk: 0.6284 (HIGH)
197
+ Violations: 3
198
+ - CREDIT_SCORE_MIN: Credit score 580 is below the minimum threshold of 620
199
+ - DTI_LIMIT: Debt-to-income ratio 0.52 exceeds the maximum threshold of 0.45
200
+ - EMPLOYMENT_REQUIRED: Employment verification is missing or unverified
201
+ Regulatory: 3 impact(s)
202
+ - ECOA [CRITICAL]: Potential discriminatory lending decision based on credit criteria
203
+ - ECOA [CRITICAL]: DTI threshold may disproportionately affect protected classes
204
+ - TILA [CRITICAL]: Incomplete underwriting verification
205
+ Liability: $125,000 - $625,000
206
+ Audit: audit_8e6db687d87d
207
+ ```
208
+
209
+ ## Requirements
210
+
211
+ - Python 3.9+
212
+ - Zero required dependencies (stdlib `urllib` only)
213
+ - Optional: `aiohttp` for async support (`pip install eve-coreguard[async]`)
214
+
215
+ ## License
216
+
217
+ Proprietary. See LICENSE for details.
@@ -0,0 +1,192 @@
1
+ # EVE CoreGuard SDK
2
+
3
+ **AI Governance Enforcement in One API Call.**
4
+
5
+ CoreGuard intercepts AI-generated decisions before execution, evaluates them against policy, and returns an auditable enforcement verdict.
6
+
7
+ ## Install
8
+
9
+ ```bash
10
+ pip install eve-coreguard
11
+ ```
12
+
13
+ ## Quick Start
14
+
15
+ ```python
16
+ from eve_coreguard import CoreGuardClient
17
+
18
+ client = CoreGuardClient(
19
+ api_key="eve_sk_...",
20
+ base_url="https://api.eveaicore.com", # or http://localhost:8000
21
+ )
22
+
23
+ # Evaluate a proposed lending decision against policy
24
+ result = client.evaluate(
25
+ tenant_id="bank_001",
26
+ proposed_action={"type": "loan_approval", "amount": 250000, "currency": "USD"},
27
+ model_output={"decision": "approve", "confidence": 0.91},
28
+ context={
29
+ "credit_score": 580,
30
+ "debt_to_income": 0.52,
31
+ "employment_verified": False,
32
+ },
33
+ policy_set="lending_v1",
34
+ )
35
+
36
+ if result.blocked:
37
+ print(f"BLOCKED: {result.decision.action}")
38
+ print(f"Risk: {result.risk.score} ({result.risk.level})")
39
+ for v in result.policy_violations:
40
+ print(f" - {v.policy_id}: {v.description}")
41
+ if result.liability_prevented:
42
+ print(f"Exposure prevented: {result.liability_prevented.estimated_exposure}")
43
+ ```
44
+
45
+ ## Core Methods
46
+
47
+ ### Decision Enforcement
48
+
49
+ ```python
50
+ result = client.evaluate(
51
+ tenant_id="org_001",
52
+ proposed_action={"type": "loan_approval", "amount": 250000},
53
+ model_output={"decision": "approve", "confidence": 0.91},
54
+ context={"credit_score": 580, "debt_to_income": 0.52},
55
+ policy_set="lending_v1",
56
+ )
57
+ # result.decision.status: ALLOWED | BLOCKED | MODIFIED
58
+ # result.risk.score: 0.0-1.0
59
+ # result.policy_violations: list of violated rules
60
+ # result.regulatory_impact: ECOA, TILA, etc.
61
+ # result.counterfactual: what would have passed
62
+ # result.liability_prevented: estimated exposure
63
+ # result.audit: cryptographic audit trail
64
+ ```
65
+
66
+ ### AI Output Verification
67
+
68
+ ```python
69
+ vr = client.verify(
70
+ ai_output="The capital of France is Paris.",
71
+ confidence=0.9,
72
+ domain="factual",
73
+ )
74
+ # vr.passed / vr.blocked
75
+ # vr.crd — Confidence-Reality Divergence score
76
+ # vr.veto.type — pass | soft_veto | hard_veto | charter
77
+ # vr.evidence — step-by-step audit chain
78
+ ```
79
+
80
+ ### Audit & Compliance
81
+
82
+ ```python
83
+ # Retrieve cryptographic proof of a governance decision
84
+ proof = client.get_proof("proof_abc123")
85
+ # proof.content_hash, proof.signature, proof.chain_position
86
+
87
+ # Export decision history
88
+ export = client.export_audit(since="2026-01-01T00:00:00Z", limit=100)
89
+ for record in export.records:
90
+ print(f"{record.decision_type}: {record.decision}")
91
+
92
+ # Verify hash chain integrity
93
+ status = client.verify_chain()
94
+ ```
95
+
96
+ ## Configuration
97
+
98
+ | Parameter | Default | Description |
99
+ |-----------|---------|-------------|
100
+ | `api_key` | *required* | EVE API key (`eve_sk_...`) |
101
+ | `base_url` | `https://api.eveaicore.com` | API endpoint |
102
+ | `timeout` | `30.0` | Request timeout (seconds) |
103
+ | `max_retries` | `3` | Retry count for 5xx errors |
104
+ | `raise_on_veto` | `False` | Raise `VetoError` on governance blocks |
105
+
106
+ ## Error Handling
107
+
108
+ ```python
109
+ from eve_coreguard import CoreGuardClient, AuthError, RateLimitError, VetoError
110
+
111
+ try:
112
+ result = client.evaluate(...)
113
+ except AuthError:
114
+ print("Invalid API key")
115
+ except RateLimitError as e:
116
+ print(f"Rate limited — retry in {e.retry_after}s")
117
+ except VetoError as e:
118
+ print(f"Governance veto: {e.veto_type}")
119
+ ```
120
+
121
+ ## Response Metadata (subscription + rate limits)
122
+
123
+ Every call captures the response's billing and rate-limit headers. Read them
124
+ after a call (or after catching an error):
125
+
126
+ ```python
127
+ result = client.evaluate(tenant_id="bank_001", ...)
128
+
129
+ client.subscription_state # 'active' | 'past_due' | 'restricted' | ...
130
+ client.access_state # 'full_access' | 'warning' | 'read_only' | ...
131
+ client.quota_warning # 'payment_past_due' when degraded-but-allowed, else None
132
+ client.rate_limit_limit # '330' | 'unlimited'
133
+ client.rate_limit_remaining # calls left in the current 60s window (int | None)
134
+ client.retry_after # seconds to wait after a 429 (int | None)
135
+ ```
136
+
137
+ The decision endpoint is rate-limited per org by plan tier (Free 10/min,
138
+ Pro 330/min, Team 1150/min, Enterprise/Sovereign unlimited). On exhaustion it
139
+ returns `429` with `Retry-After`. See
140
+ [Response-Header Contract](../../docs/sdk/RESPONSE_HEADER_CONTRACT.md).
141
+
142
+ ## Live Demo (Local)
143
+
144
+ Run a full end-to-end enforcement decision in 3 steps:
145
+
146
+ **Step 1: Start the server**
147
+
148
+ ```bash
149
+ cd /path/to/EVE
150
+ python -m uvicorn saas.app:app --port 8000
151
+ ```
152
+
153
+ **Step 2: Install the SDK**
154
+
155
+ ```bash
156
+ cd sdks/coreguard
157
+ pip install -e .
158
+ ```
159
+
160
+ **Step 3: Run the demo**
161
+
162
+ ```bash
163
+ python run_demo.py
164
+ ```
165
+
166
+ **Expected output:**
167
+
168
+ ```
169
+ Decision: BLOCKED
170
+ Action: deny_loan_approval
171
+ Risk: 0.6284 (HIGH)
172
+ Violations: 3
173
+ - CREDIT_SCORE_MIN: Credit score 580 is below the minimum threshold of 620
174
+ - DTI_LIMIT: Debt-to-income ratio 0.52 exceeds the maximum threshold of 0.45
175
+ - EMPLOYMENT_REQUIRED: Employment verification is missing or unverified
176
+ Regulatory: 3 impact(s)
177
+ - ECOA [CRITICAL]: Potential discriminatory lending decision based on credit criteria
178
+ - ECOA [CRITICAL]: DTI threshold may disproportionately affect protected classes
179
+ - TILA [CRITICAL]: Incomplete underwriting verification
180
+ Liability: $125,000 - $625,000
181
+ Audit: audit_8e6db687d87d
182
+ ```
183
+
184
+ ## Requirements
185
+
186
+ - Python 3.9+
187
+ - Zero required dependencies (stdlib `urllib` only)
188
+ - Optional: `aiohttp` for async support (`pip install eve-coreguard[async]`)
189
+
190
+ ## License
191
+
192
+ Proprietary. See LICENSE for details.
@@ -0,0 +1,62 @@
1
+ """
2
+ EVE CoreGuard SDK — AI Governance Enforcement in One API Call.
3
+
4
+ Usage::
5
+
6
+ from eve_coreguard import CoreGuardClient
7
+
8
+ client = CoreGuardClient(api_key="eve_sk_...")
9
+
10
+ # Decision enforcement (pre-execution policy check)
11
+ result = client.evaluate(
12
+ request_id="req-001",
13
+ tenant_id="bank_001",
14
+ proposed_action={"type": "loan_approval", "amount": 250000},
15
+ model_output={"decision": "approve", "confidence": 0.91},
16
+ context={"credit_score": 580, "debt_to_income": 0.52},
17
+ policy_set="lending_v1",
18
+ )
19
+ if result.decision.status == "BLOCKED":
20
+ print(f"Blocked: {result.decision.action}")
21
+ print(f"Risk: {result.risk.score} ({result.risk.level})")
22
+
23
+ # AI output verification (8-stage governance pipeline)
24
+ vr = client.verify(ai_output="The capital of France is Paris.")
25
+ print(f"CRD: {vr.crd:.2f}, Blocked: {vr.blocked}")
26
+ """
27
+
28
+ __version__ = "0.1.1"
29
+
30
+ from eve_coreguard.client import CoreGuardClient
31
+ from eve_coreguard.exceptions import (
32
+ AuthError,
33
+ CoreGuardError,
34
+ PaymentRequiredError,
35
+ PolicySetNotFoundError,
36
+ RateLimitError,
37
+ VetoError,
38
+ )
39
+ from eve_coreguard.models import (
40
+ AuditRecord,
41
+ EvaluationResult,
42
+ ProofBundle,
43
+ VerifyResult,
44
+ )
45
+
46
+ __all__ = [
47
+ "CoreGuardClient",
48
+ "CoreGuardError",
49
+ "AuthError",
50
+ "PaymentRequiredError",
51
+ "PolicySetNotFoundError",
52
+ "RateLimitError",
53
+ "VetoError",
54
+ "EvaluationResult",
55
+ "VerifyResult",
56
+ "AuditRecord",
57
+ "ProofBundle",
58
+ "verify_proof",
59
+ ]
60
+
61
+ # Convenience alias at package level
62
+ verify_proof = CoreGuardClient.verify_proof