cortexhub 0.5.7__tar.gz → 0.5.9__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 (63) hide show
  1. {cortexhub-0.5.7 → cortexhub-0.5.9}/PKG-INFO +1 -1
  2. {cortexhub-0.5.7 → cortexhub-0.5.9}/pyproject.toml +1 -1
  3. {cortexhub-0.5.7 → cortexhub-0.5.9}/src/cortexhub/client.py +34 -0
  4. {cortexhub-0.5.7 → cortexhub-0.5.9}/src/cortexhub/version.py +1 -1
  5. {cortexhub-0.5.7 → cortexhub-0.5.9}/.gitignore +0 -0
  6. {cortexhub-0.5.7 → cortexhub-0.5.9}/LICENSE +0 -0
  7. {cortexhub-0.5.7 → cortexhub-0.5.9}/README.md +0 -0
  8. {cortexhub-0.5.7 → cortexhub-0.5.9}/src/cortexhub/__init__.py +0 -0
  9. {cortexhub-0.5.7 → cortexhub-0.5.9}/src/cortexhub/audit/__init__.py +0 -0
  10. {cortexhub-0.5.7 → cortexhub-0.5.9}/src/cortexhub/audit/events.py +0 -0
  11. {cortexhub-0.5.7 → cortexhub-0.5.9}/src/cortexhub/backend/__init__.py +0 -0
  12. {cortexhub-0.5.7 → cortexhub-0.5.9}/src/cortexhub/backend/client.py +0 -0
  13. {cortexhub-0.5.7 → cortexhub-0.5.9}/src/cortexhub/config.py +0 -0
  14. {cortexhub-0.5.7 → cortexhub-0.5.9}/src/cortexhub/constants.py +0 -0
  15. {cortexhub-0.5.7 → cortexhub-0.5.9}/src/cortexhub/context/__init__.py +0 -0
  16. {cortexhub-0.5.7 → cortexhub-0.5.9}/src/cortexhub/context/enricher.py +0 -0
  17. {cortexhub-0.5.7 → cortexhub-0.5.9}/src/cortexhub/errors.py +0 -0
  18. {cortexhub-0.5.7 → cortexhub-0.5.9}/src/cortexhub/guardrails/__init__.py +0 -0
  19. {cortexhub-0.5.7 → cortexhub-0.5.9}/src/cortexhub/guardrails/injection.py +0 -0
  20. {cortexhub-0.5.7 → cortexhub-0.5.9}/src/cortexhub/guardrails/models/en_core_web_sm/__init__.py +0 -0
  21. {cortexhub-0.5.7 → cortexhub-0.5.9}/src/cortexhub/guardrails/models/en_core_web_sm/en_core_web_sm-3.8.0/LICENSE +0 -0
  22. {cortexhub-0.5.7 → cortexhub-0.5.9}/src/cortexhub/guardrails/models/en_core_web_sm/en_core_web_sm-3.8.0/LICENSES_SOURCES +0 -0
  23. {cortexhub-0.5.7 → cortexhub-0.5.9}/src/cortexhub/guardrails/models/en_core_web_sm/en_core_web_sm-3.8.0/README.md +0 -0
  24. {cortexhub-0.5.7 → cortexhub-0.5.9}/src/cortexhub/guardrails/models/en_core_web_sm/en_core_web_sm-3.8.0/accuracy.json +0 -0
  25. {cortexhub-0.5.7 → cortexhub-0.5.9}/src/cortexhub/guardrails/models/en_core_web_sm/en_core_web_sm-3.8.0/attribute_ruler/patterns +0 -0
  26. {cortexhub-0.5.7 → cortexhub-0.5.9}/src/cortexhub/guardrails/models/en_core_web_sm/en_core_web_sm-3.8.0/config.cfg +0 -0
  27. {cortexhub-0.5.7 → cortexhub-0.5.9}/src/cortexhub/guardrails/models/en_core_web_sm/en_core_web_sm-3.8.0/lemmatizer/lookups/lookups.bin +0 -0
  28. {cortexhub-0.5.7 → cortexhub-0.5.9}/src/cortexhub/guardrails/models/en_core_web_sm/en_core_web_sm-3.8.0/meta.json +0 -0
  29. {cortexhub-0.5.7 → cortexhub-0.5.9}/src/cortexhub/guardrails/models/en_core_web_sm/en_core_web_sm-3.8.0/ner/cfg +0 -0
  30. {cortexhub-0.5.7 → cortexhub-0.5.9}/src/cortexhub/guardrails/models/en_core_web_sm/en_core_web_sm-3.8.0/ner/model +0 -0
  31. {cortexhub-0.5.7 → cortexhub-0.5.9}/src/cortexhub/guardrails/models/en_core_web_sm/en_core_web_sm-3.8.0/ner/moves +0 -0
  32. {cortexhub-0.5.7 → cortexhub-0.5.9}/src/cortexhub/guardrails/models/en_core_web_sm/en_core_web_sm-3.8.0/parser/cfg +0 -0
  33. {cortexhub-0.5.7 → cortexhub-0.5.9}/src/cortexhub/guardrails/models/en_core_web_sm/en_core_web_sm-3.8.0/parser/model +0 -0
  34. {cortexhub-0.5.7 → cortexhub-0.5.9}/src/cortexhub/guardrails/models/en_core_web_sm/en_core_web_sm-3.8.0/parser/moves +0 -0
  35. {cortexhub-0.5.7 → cortexhub-0.5.9}/src/cortexhub/guardrails/models/en_core_web_sm/en_core_web_sm-3.8.0/senter/cfg +0 -0
  36. {cortexhub-0.5.7 → cortexhub-0.5.9}/src/cortexhub/guardrails/models/en_core_web_sm/en_core_web_sm-3.8.0/senter/model +0 -0
  37. {cortexhub-0.5.7 → cortexhub-0.5.9}/src/cortexhub/guardrails/models/en_core_web_sm/en_core_web_sm-3.8.0/tagger/cfg +0 -0
  38. {cortexhub-0.5.7 → cortexhub-0.5.9}/src/cortexhub/guardrails/models/en_core_web_sm/en_core_web_sm-3.8.0/tagger/model +0 -0
  39. {cortexhub-0.5.7 → cortexhub-0.5.9}/src/cortexhub/guardrails/models/en_core_web_sm/en_core_web_sm-3.8.0/tok2vec/cfg +0 -0
  40. {cortexhub-0.5.7 → cortexhub-0.5.9}/src/cortexhub/guardrails/models/en_core_web_sm/en_core_web_sm-3.8.0/tok2vec/model +0 -0
  41. {cortexhub-0.5.7 → cortexhub-0.5.9}/src/cortexhub/guardrails/models/en_core_web_sm/en_core_web_sm-3.8.0/tokenizer +0 -0
  42. {cortexhub-0.5.7 → cortexhub-0.5.9}/src/cortexhub/guardrails/models/en_core_web_sm/en_core_web_sm-3.8.0/vocab/key2row +0 -0
  43. {cortexhub-0.5.7 → cortexhub-0.5.9}/src/cortexhub/guardrails/models/en_core_web_sm/en_core_web_sm-3.8.0/vocab/lookups.bin +0 -0
  44. {cortexhub-0.5.7 → cortexhub-0.5.9}/src/cortexhub/guardrails/models/en_core_web_sm/en_core_web_sm-3.8.0/vocab/strings.json +0 -0
  45. {cortexhub-0.5.7 → cortexhub-0.5.9}/src/cortexhub/guardrails/models/en_core_web_sm/en_core_web_sm-3.8.0/vocab/vectors +0 -0
  46. {cortexhub-0.5.7 → cortexhub-0.5.9}/src/cortexhub/guardrails/models/en_core_web_sm/en_core_web_sm-3.8.0/vocab/vectors.cfg +0 -0
  47. {cortexhub-0.5.7 → cortexhub-0.5.9}/src/cortexhub/guardrails/models/en_core_web_sm/meta.json +0 -0
  48. {cortexhub-0.5.7 → cortexhub-0.5.9}/src/cortexhub/guardrails/pii.py +0 -0
  49. {cortexhub-0.5.7 → cortexhub-0.5.9}/src/cortexhub/guardrails/secrets.py +0 -0
  50. {cortexhub-0.5.7 → cortexhub-0.5.9}/src/cortexhub/interceptors/__init__.py +0 -0
  51. {cortexhub-0.5.7 → cortexhub-0.5.9}/src/cortexhub/interceptors/mcp.py +0 -0
  52. {cortexhub-0.5.7 → cortexhub-0.5.9}/src/cortexhub/logging.py +0 -0
  53. {cortexhub-0.5.7 → cortexhub-0.5.9}/src/cortexhub/policy/__init__.py +0 -0
  54. {cortexhub-0.5.7 → cortexhub-0.5.9}/src/cortexhub/policy/absence.py +0 -0
  55. {cortexhub-0.5.7 → cortexhub-0.5.9}/src/cortexhub/policy/effects.py +0 -0
  56. {cortexhub-0.5.7 → cortexhub-0.5.9}/src/cortexhub/policy/evaluator.py +0 -0
  57. {cortexhub-0.5.7 → cortexhub-0.5.9}/src/cortexhub/policy/loader.py +0 -0
  58. {cortexhub-0.5.7 → cortexhub-0.5.9}/src/cortexhub/policy/models.py +0 -0
  59. {cortexhub-0.5.7 → cortexhub-0.5.9}/src/cortexhub/policy/sync.py +0 -0
  60. {cortexhub-0.5.7 → cortexhub-0.5.9}/src/cortexhub/signing.py +0 -0
  61. {cortexhub-0.5.7 → cortexhub-0.5.9}/src/cortexhub/telemetry/__init__.py +0 -0
  62. {cortexhub-0.5.7 → cortexhub-0.5.9}/src/cortexhub/telemetry/otel.py +0 -0
  63. {cortexhub-0.5.7 → cortexhub-0.5.9}/src/cortexhub/tool.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cortexhub
3
- Version: 0.5.7
3
+ Version: 0.5.9
4
4
  Summary: CortexHub Python SDK — Runtime governance for AI systems. One decorator, any tool, any framework.
5
5
  Project-URL: Homepage, https://cortexhub.ai
6
6
  Project-URL: Documentation, https://docs.cortexhub.ai
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "cortexhub"
3
- version = "0.5.7"
3
+ version = "0.5.9"
4
4
  description = "CortexHub Python SDK — Runtime governance for AI systems. One decorator, any tool, any framework."
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.10,<3.13"
@@ -1365,6 +1365,14 @@ class CortexHub:
1365
1365
  "agent_id": self.agent_id,
1366
1366
  "source": tool.get("source") or source,
1367
1367
  "source_ref": tool.get("source_ref") or source_ref,
1368
+ # Classification declared on ``@cx.tool(classification=...)``.
1369
+ # Shipped at registration so the Tool Inventory page shows
1370
+ # the correct Type badge from the moment the SDK boots,
1371
+ # not only after the first invocation. Optional — framework
1372
+ # adapters that synthesize tool inventory without a
1373
+ # decorator (e.g. an MCP client interceptor) won't have
1374
+ # this, and the backend accepts null gracefully.
1375
+ "classification": tool.get("classification"),
1368
1376
  }
1369
1377
  sanitized_payload = self._sanitize_schema(tool_payload)
1370
1378
  if isinstance(sanitized_payload, dict):
@@ -1445,6 +1453,7 @@ class CortexHub:
1445
1453
  parameters_schema=parameters_schema,
1446
1454
  principal=principal,
1447
1455
  resource_type=resource_type,
1456
+ classification=classification,
1448
1457
  )
1449
1458
  except CortexHubError:
1450
1459
  raise # all governance decisions — always propagate
@@ -1468,6 +1477,7 @@ class CortexHub:
1468
1477
  parameters_schema: dict[str, Any] | None = None,
1469
1478
  principal: "Principal | dict[str, str] | None" = None,
1470
1479
  resource_type: str = "Tool",
1480
+ classification: str | None = None,
1471
1481
  ) -> Any:
1472
1482
  """Internal governance pipeline — called from execute_governed_tool."""
1473
1483
  # Ensure policies and enforcement mode are fresh before evaluating.
@@ -1484,6 +1494,12 @@ class CortexHub:
1484
1494
  "tool_name": tool_name,
1485
1495
  "tool_description": tool_description,
1486
1496
  "parameters_schema": parameters_schema,
1497
+ # Propagate the decorator's classification so
1498
+ # framework-driven re-registration (e.g. LangGraph
1499
+ # handing a fresh parameters_schema at first call)
1500
+ # doesn't wipe ``classification_bucket`` back to
1501
+ # null on the backend row.
1502
+ "classification": classification,
1487
1503
  }
1488
1504
  ],
1489
1505
  source="framework",
@@ -1960,6 +1976,19 @@ class CortexHub:
1960
1976
  # Ensure policies are fresh before evaluating (same as sync path).
1961
1977
  self._ensure_fresh_policies()
1962
1978
  expected_types = self._extract_expected_arg_types(parameters_schema)
1979
+ # Async interceptor path doesn't receive a decorator's
1980
+ # classification (the caller is a runtime MCP interceptor, not
1981
+ # a ``@cx.tool``), but we can look it up in the bundle the
1982
+ # same way we do later for the span. If the bundle already
1983
+ # knows about this tool, ship the classification with the
1984
+ # registration so the row is never left unclassified.
1985
+ _bundle_cls = None
1986
+ _tp = getattr(getattr(self, "_sdk_config", None), "policies", None)
1987
+ _classifications = getattr(_tp, "tool_classifications", None) if _tp else None
1988
+ if isinstance(_classifications, dict):
1989
+ _cls_entry = _classifications.get(tool_name)
1990
+ if isinstance(_cls_entry, dict):
1991
+ _bundle_cls = _cls_entry.get("bucket")
1963
1992
  if parameters_schema:
1964
1993
  self.register_tools(
1965
1994
  [
@@ -1967,6 +1996,7 @@ class CortexHub:
1967
1996
  "tool_name": tool_name,
1968
1997
  "tool_description": tool_description,
1969
1998
  "parameters_schema": parameters_schema,
1999
+ "classification": _bundle_cls,
1970
2000
  }
1971
2001
  ],
1972
2002
  source="framework",
@@ -3555,6 +3585,10 @@ class CortexHub:
3555
3585
  "tool_description": getattr(governed_tool, "description", "") or "",
3556
3586
  "parameters_schema": params_schema or {},
3557
3587
  "framework": "native",
3588
+ # Classification travels with the tool the moment it's
3589
+ # decorated so the dashboard can render the Type badge
3590
+ # before the first invocation.
3591
+ "classification": getattr(governed_tool, "classification", None),
3558
3592
  }
3559
3593
  ],
3560
3594
  source="sdk",
@@ -12,7 +12,7 @@ incorrectly in those environments.
12
12
 
13
13
  from importlib.metadata import PackageNotFoundError, version
14
14
 
15
- __fallback_version__ = "0.5.7"
15
+ __fallback_version__ = "0.5.9"
16
16
 
17
17
 
18
18
  def _resolve_version() -> str:
File without changes
File without changes
File without changes