correctover 2.0.1__tar.gz → 2.0.2__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.
- {correctover-2.0.1 → correctover-2.0.2}/PKG-INFO +1 -1
- {correctover-2.0.1 → correctover-2.0.2}/correctover/__init__.py +1 -1
- {correctover-2.0.1 → correctover-2.0.2}/correctover/validator.py +5 -18
- {correctover-2.0.1 → correctover-2.0.2}/correctover.egg-info/PKG-INFO +1 -1
- {correctover-2.0.1 → correctover-2.0.2}/setup.py +1 -1
- {correctover-2.0.1 → correctover-2.0.2}/LICENSE +0 -0
- {correctover-2.0.1 → correctover-2.0.2}/README.md +0 -0
- {correctover-2.0.1 → correctover-2.0.2}/correctover.egg-info/SOURCES.txt +0 -0
- {correctover-2.0.1 → correctover-2.0.2}/correctover.egg-info/dependency_links.txt +0 -0
- {correctover-2.0.1 → correctover-2.0.2}/correctover.egg-info/requires.txt +0 -0
- {correctover-2.0.1 → correctover-2.0.2}/correctover.egg-info/top_level.txt +0 -0
- {correctover-2.0.1 → correctover-2.0.2}/setup.cfg +0 -0
|
@@ -8,6 +8,7 @@ from pydantic import BaseModel, Field
|
|
|
8
8
|
from datetime import datetime
|
|
9
9
|
import hashlib
|
|
10
10
|
import hmac
|
|
11
|
+
import json
|
|
11
12
|
|
|
12
13
|
|
|
13
14
|
class ValidationResult(BaseModel):
|
|
@@ -41,37 +42,24 @@ class CCSValidator:
|
|
|
41
42
|
self.integrity_key = integrity_key or "default-key"
|
|
42
43
|
|
|
43
44
|
def validate(self, output: Dict[str, Any], trace_id: str = None) -> ValidationResult:
|
|
44
|
-
"""
|
|
45
|
-
Validate LLM output against CCS schema
|
|
46
|
-
|
|
47
|
-
Args:
|
|
48
|
-
output: LLM output dictionary
|
|
49
|
-
trace_id: Optional trace ID for audit logging
|
|
50
|
-
|
|
51
|
-
Returns:
|
|
52
|
-
ValidationResult with is_valid flag and errors/warnings
|
|
53
|
-
"""
|
|
45
|
+
"""Validate LLM output against CCS schema"""
|
|
54
46
|
errors = []
|
|
55
47
|
warnings = []
|
|
56
48
|
|
|
57
|
-
# Check required fields
|
|
58
49
|
for field in self.required_fields:
|
|
59
50
|
if field not in output:
|
|
60
51
|
errors.append(f"Missing required field: {field}")
|
|
61
52
|
|
|
62
|
-
# Check forbidden fields
|
|
63
53
|
for field in self.forbidden_fields:
|
|
64
54
|
if field in output:
|
|
65
55
|
errors.append(f"Forbidden field present: {field}")
|
|
66
56
|
|
|
67
|
-
# Check supported fields (warning only)
|
|
68
57
|
output_fields = set(output.keys())
|
|
69
58
|
all_allowed = self.required_fields | self.supported_fields
|
|
70
59
|
unexpected = output_fields - all_allowed - self.forbidden_fields
|
|
71
60
|
for field in unexpected:
|
|
72
61
|
warnings.append(f"Unexpected field: {field}")
|
|
73
62
|
|
|
74
|
-
# Integrity check (if enabled)
|
|
75
63
|
if self.enable_integrity:
|
|
76
64
|
stored_hash = output.get("integrity_hash")
|
|
77
65
|
computed_hash = self._compute_integrity(output)
|
|
@@ -89,13 +77,12 @@ class CCSValidator:
|
|
|
89
77
|
)
|
|
90
78
|
|
|
91
79
|
def _compute_integrity(self, output: Dict[str, Any]) -> str:
|
|
92
|
-
"""Compute HMAC-based integrity hash
|
|
80
|
+
"""Compute HMAC-based integrity hash using JSON serialization"""
|
|
93
81
|
# Exclude integrity_hash from computation
|
|
94
82
|
filtered = {k: v for k, v in output.items() if k != "integrity_hash"}
|
|
95
|
-
|
|
96
|
-
data_str =
|
|
83
|
+
# Use JSON serialization (sorted keys, no extra spaces)
|
|
84
|
+
data_str = json.dumps(filtered, sort_keys=True, separators=(',', ':'))
|
|
97
85
|
|
|
98
|
-
# Compute HMAC
|
|
99
86
|
signature = hmac.new(
|
|
100
87
|
self.integrity_key.encode(),
|
|
101
88
|
data_str.encode(),
|
|
@@ -5,7 +5,7 @@ with open("README.md", "r", encoding="utf-8") as fh:
|
|
|
5
5
|
|
|
6
6
|
setup(
|
|
7
7
|
name="correctover",
|
|
8
|
-
version="2.0.
|
|
8
|
+
version="2.0.2",
|
|
9
9
|
author="Guigui Wang",
|
|
10
10
|
author_email="wangguigui@correctover.com",
|
|
11
11
|
description="CCS v1.0 - Conformance Protocol for Agentic Runtime Systems",
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|