xproof 0.2.1__tar.gz → 0.2.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.
Files changed (25) hide show
  1. {xproof-0.2.1 → xproof-0.2.2}/PKG-INFO +1 -1
  2. {xproof-0.2.1 → xproof-0.2.2}/pyproject.toml +1 -1
  3. {xproof-0.2.1 → xproof-0.2.2}/xproof/__init__.py +1 -1
  4. {xproof-0.2.1 → xproof-0.2.2}/xproof/client.py +97 -0
  5. {xproof-0.2.1 → xproof-0.2.2}/xproof.egg-info/PKG-INFO +1 -1
  6. {xproof-0.2.1 → xproof-0.2.2}/LICENSE +0 -0
  7. {xproof-0.2.1 → xproof-0.2.2}/README.md +0 -0
  8. {xproof-0.2.1 → xproof-0.2.2}/setup.cfg +0 -0
  9. {xproof-0.2.1 → xproof-0.2.2}/tests/test_client.py +0 -0
  10. {xproof-0.2.1 → xproof-0.2.2}/tests/test_integration.py +0 -0
  11. {xproof-0.2.1 → xproof-0.2.2}/xproof/exceptions.py +0 -0
  12. {xproof-0.2.1 → xproof-0.2.2}/xproof/integrations/__init__.py +0 -0
  13. {xproof-0.2.1 → xproof-0.2.2}/xproof/integrations/autogen.py +0 -0
  14. {xproof-0.2.1 → xproof-0.2.2}/xproof/integrations/crewai.py +0 -0
  15. {xproof-0.2.1 → xproof-0.2.2}/xproof/integrations/deerflow.py +0 -0
  16. {xproof-0.2.1 → xproof-0.2.2}/xproof/integrations/langchain.py +0 -0
  17. {xproof-0.2.1 → xproof-0.2.2}/xproof/integrations/llamaindex.py +0 -0
  18. {xproof-0.2.1 → xproof-0.2.2}/xproof/integrations/openai_agents.py +0 -0
  19. {xproof-0.2.1 → xproof-0.2.2}/xproof/models.py +0 -0
  20. {xproof-0.2.1 → xproof-0.2.2}/xproof/py.typed +0 -0
  21. {xproof-0.2.1 → xproof-0.2.2}/xproof/utils.py +0 -0
  22. {xproof-0.2.1 → xproof-0.2.2}/xproof.egg-info/SOURCES.txt +0 -0
  23. {xproof-0.2.1 → xproof-0.2.2}/xproof.egg-info/dependency_links.txt +0 -0
  24. {xproof-0.2.1 → xproof-0.2.2}/xproof.egg-info/requires.txt +0 -0
  25. {xproof-0.2.1 → xproof-0.2.2}/xproof.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: xproof
3
- Version: 0.2.1
3
+ Version: 0.2.2
4
4
  Summary: Python SDK for xProof — blockchain-anchored proof-of-existence for AI agents on MultiversX
5
5
  Author-email: xProof <contact@xproof.app>
6
6
  License-Expression: MIT
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "xproof"
7
- version = "0.2.1"
7
+ version = "0.2.2"
8
8
  description = "Python SDK for xProof — blockchain-anchored proof-of-existence for AI agents on MultiversX"
9
9
  readme = "README.md"
10
10
  license = "MIT"
@@ -21,7 +21,7 @@ from .models import (
21
21
  )
22
22
  from .utils import hash_bytes, hash_file
23
23
 
24
- __version__ = "0.2.0"
24
+ __version__ = "0.2.2"
25
25
 
26
26
  __all__ = [
27
27
  "XProofClient",
@@ -281,6 +281,103 @@ class XProofClient:
281
281
  data = self._request("POST", "/api/proof", json=payload)
282
282
  return Certification.from_dict(data)
283
283
 
284
+ VALID_THRESHOLD_STAGES = ("initial", "partial", "pre-commitment", "final")
285
+
286
+ def certify_with_confidence(
287
+ self,
288
+ file_hash: str,
289
+ file_name: str,
290
+ author: str,
291
+ confidence_level: float,
292
+ threshold_stage: str,
293
+ decision_id: str,
294
+ *,
295
+ who: Optional[str] = None,
296
+ what: Optional[str] = None,
297
+ when: Optional[str] = None,
298
+ why: Optional[str] = None,
299
+ metadata: Optional[Dict[str, Any]] = None,
300
+ ) -> Certification:
301
+ """Certify a file hash with confidence-level anchoring.
302
+
303
+ Creates a forensic trail by anchoring proofs at different confidence
304
+ thresholds, linked by a shared ``decision_id``. An agent trading at
305
+ 60%, 80%, then final creates an immutable trail that distinguishes
306
+ real reasoning from post-hoc reconstruction.
307
+
308
+ Args:
309
+ file_hash: 64-character lowercase hex SHA-256 digest.
310
+ file_name: Original file name.
311
+ author: Author / owner name.
312
+ confidence_level: Confidence between 0.0 and 1.0.
313
+ threshold_stage: One of ``initial``, ``partial``,
314
+ ``pre-commitment``, ``final``.
315
+ decision_id: Shared identifier linking all proofs in the
316
+ same decision chain.
317
+ who: 4W -- agent identity.
318
+ what: 4W -- action hash or description.
319
+ when: 4W -- ISO-8601 timestamp.
320
+ why: 4W -- instruction or reason.
321
+ metadata: Extra key-value metadata stored alongside the proof.
322
+
323
+ Returns:
324
+ A :class:`Certification` with the on-chain proof details.
325
+
326
+ Raises:
327
+ ValueError: If confidence_level or threshold_stage is invalid.
328
+ """
329
+ if not self.api_key:
330
+ raise ValueError("api_key is required — call register() or pass an api_key")
331
+ if not 0.0 <= confidence_level <= 1.0:
332
+ raise ValueError("confidence_level must be between 0.0 and 1.0")
333
+ if threshold_stage not in self.VALID_THRESHOLD_STAGES:
334
+ raise ValueError(
335
+ f"threshold_stage must be one of: {', '.join(self.VALID_THRESHOLD_STAGES)}"
336
+ )
337
+ if not decision_id or not decision_id.strip():
338
+ raise ValueError("decision_id is required")
339
+
340
+ proof_metadata: Dict[str, Any] = dict(metadata) if metadata else {}
341
+ proof_metadata["confidence_level"] = confidence_level
342
+ proof_metadata["threshold_stage"] = threshold_stage
343
+ proof_metadata["decision_id"] = decision_id
344
+ if who is not None:
345
+ proof_metadata["who"] = who
346
+ if what is not None:
347
+ proof_metadata["what"] = what
348
+ if when is not None:
349
+ proof_metadata["when"] = when
350
+ if why is not None:
351
+ proof_metadata["why"] = why
352
+
353
+ payload: Dict[str, Any] = {
354
+ "filename": file_name,
355
+ "file_hash": file_hash,
356
+ "author_name": author,
357
+ "metadata": proof_metadata,
358
+ }
359
+ data = self._request("POST", "/api/proof", json=payload)
360
+ return Certification.from_dict(data)
361
+
362
+ def get_confidence_trail(self, decision_id: str) -> Dict[str, Any]:
363
+ """Retrieve the full confidence trail for a decision chain.
364
+
365
+ Args:
366
+ decision_id: The shared identifier linking proofs in the chain.
367
+
368
+ Returns:
369
+ A dictionary with ``decision_id``, ``total_anchors``,
370
+ ``current_confidence``, ``current_stage``, ``is_finalized``,
371
+ and ``stages`` (list of anchor details sorted by confidence).
372
+ """
373
+ from urllib.parse import quote
374
+ data = self._request(
375
+ "GET",
376
+ f"/api/confidence-trail/{quote(decision_id, safe='')}",
377
+ auth_required=False,
378
+ )
379
+ return data
380
+
284
381
  def batch_certify(
285
382
  self,
286
383
  files: List[Dict[str, Any]],
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: xproof
3
- Version: 0.2.1
3
+ Version: 0.2.2
4
4
  Summary: Python SDK for xProof — blockchain-anchored proof-of-existence for AI agents on MultiversX
5
5
  Author-email: xProof <contact@xproof.app>
6
6
  License-Expression: MIT
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes