ct-toolkit 0.3.40__tar.gz → 0.4.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.
Files changed (76) hide show
  1. {ct_toolkit-0.3.40/ct_toolkit.egg-info → ct_toolkit-0.4.1}/PKG-INFO +100 -25
  2. ct_toolkit-0.3.40/PKG-INFO → ct_toolkit-0.4.1/README.md +67 -64
  3. {ct_toolkit-0.3.40 → ct_toolkit-0.4.1}/ct_toolkit/__init__.py +3 -2
  4. {ct_toolkit-0.3.40 → ct_toolkit-0.4.1}/ct_toolkit/cli.py +169 -6
  5. {ct_toolkit-0.3.40 → ct_toolkit-0.4.1}/ct_toolkit/core/kernel.py +105 -4
  6. {ct_toolkit-0.3.40 → ct_toolkit-0.4.1}/ct_toolkit/core/wrapper.py +853 -37
  7. ct_toolkit-0.4.1/ct_toolkit/divergence/engine.py +722 -0
  8. {ct_toolkit-0.3.40 → ct_toolkit-0.4.1}/ct_toolkit/divergence/l2_judge.py +122 -27
  9. {ct_toolkit-0.3.40 → ct_toolkit-0.4.1}/ct_toolkit/divergence/l3_icm.py +94 -5
  10. ct_toolkit-0.4.1/ct_toolkit/identity/embedding.py +445 -0
  11. {ct_toolkit-0.3.40 → ct_toolkit-0.4.1}/ct_toolkit/middleware/langchain.py +59 -0
  12. ct_toolkit-0.4.1/ct_toolkit/provenance/log.py +753 -0
  13. ct_toolkit-0.4.1/ct_toolkit/server.py +1198 -0
  14. ct_toolkit-0.4.1/ct_toolkit/utils/telemetry.py +272 -0
  15. ct_toolkit-0.4.1/ct_toolkit.egg-info/PKG-INFO +253 -0
  16. {ct_toolkit-0.3.40 → ct_toolkit-0.4.1}/ct_toolkit.egg-info/SOURCES.txt +7 -0
  17. {ct_toolkit-0.3.40 → ct_toolkit-0.4.1}/ct_toolkit.egg-info/requires.txt +33 -7
  18. {ct_toolkit-0.3.40 → ct_toolkit-0.4.1}/pyproject.toml +43 -13
  19. ct_toolkit-0.4.1/tests/test_async_and_streaming.py +196 -0
  20. ct_toolkit-0.4.1/tests/test_background_latency.py +248 -0
  21. ct_toolkit-0.4.1/tests/test_distributed_headers_and_cli.py +331 -0
  22. ct_toolkit-0.4.1/tests/test_enterprise_db_and_otel.py +226 -0
  23. ct_toolkit-0.4.1/tests/test_l1_semantic.py +147 -0
  24. ct_toolkit-0.4.1/tests/test_optional_dependencies.py +57 -0
  25. ct_toolkit-0.3.40/README.md +0 -129
  26. ct_toolkit-0.3.40/ct_toolkit/divergence/engine.py +0 -361
  27. ct_toolkit-0.3.40/ct_toolkit/identity/embedding.py +0 -223
  28. ct_toolkit-0.3.40/ct_toolkit/provenance/log.py +0 -436
  29. ct_toolkit-0.3.40/ct_toolkit/server.py +0 -186
  30. {ct_toolkit-0.3.40 → ct_toolkit-0.4.1}/LICENSE +0 -0
  31. {ct_toolkit-0.3.40 → ct_toolkit-0.4.1}/ct_toolkit/__main__.py +0 -0
  32. {ct_toolkit-0.3.40 → ct_toolkit-0.4.1}/ct_toolkit/core/__init__.py +0 -0
  33. {ct_toolkit-0.3.40 → ct_toolkit-0.4.1}/ct_toolkit/core/async_wrapper.py +0 -0
  34. {ct_toolkit-0.3.40 → ct_toolkit-0.4.1}/ct_toolkit/core/circuit_breaker.py +0 -0
  35. {ct_toolkit-0.3.40 → ct_toolkit-0.4.1}/ct_toolkit/core/compatibility.py +0 -0
  36. {ct_toolkit-0.3.40 → ct_toolkit-0.4.1}/ct_toolkit/core/compression_guard.py +0 -0
  37. {ct_toolkit-0.3.40 → ct_toolkit-0.4.1}/ct_toolkit/core/exceptions.py +0 -0
  38. {ct_toolkit-0.3.40 → ct_toolkit-0.4.1}/ct_toolkit/core/integrity.py +0 -0
  39. {ct_toolkit-0.3.40 → ct_toolkit-0.4.1}/ct_toolkit/divergence/__init__.py +0 -0
  40. {ct_toolkit-0.3.40 → ct_toolkit-0.4.1}/ct_toolkit/divergence/analysis.py +0 -0
  41. {ct_toolkit-0.3.40 → ct_toolkit-0.4.1}/ct_toolkit/divergence/loss.py +0 -0
  42. {ct_toolkit-0.3.40 → ct_toolkit-0.4.1}/ct_toolkit/divergence/scheduler.py +0 -0
  43. {ct_toolkit-0.3.40 → ct_toolkit-0.4.1}/ct_toolkit/endorsement/__init__.py +0 -0
  44. {ct_toolkit-0.3.40 → ct_toolkit-0.4.1}/ct_toolkit/endorsement/probes/__init__.py +0 -0
  45. {ct_toolkit-0.3.40 → ct_toolkit-0.4.1}/ct_toolkit/endorsement/reflective.py +0 -0
  46. {ct_toolkit-0.3.40 → ct_toolkit-0.4.1}/ct_toolkit/identity/__init__.py +0 -0
  47. {ct_toolkit-0.3.40 → ct_toolkit-0.4.1}/ct_toolkit/identity/templates/__init__.py +0 -0
  48. {ct_toolkit-0.3.40 → ct_toolkit-0.4.1}/ct_toolkit/identity/templates/defense.yaml +0 -0
  49. {ct_toolkit-0.3.40 → ct_toolkit-0.4.1}/ct_toolkit/identity/templates/finance.yaml +0 -0
  50. {ct_toolkit-0.3.40 → ct_toolkit-0.4.1}/ct_toolkit/identity/templates/general.yaml +0 -0
  51. {ct_toolkit-0.3.40 → ct_toolkit-0.4.1}/ct_toolkit/identity/templates/medical.yaml +0 -0
  52. {ct_toolkit-0.3.40 → ct_toolkit-0.4.1}/ct_toolkit/kernels/__init__.py +0 -0
  53. {ct_toolkit-0.3.40 → ct_toolkit-0.4.1}/ct_toolkit/kernels/default.yaml +0 -0
  54. {ct_toolkit-0.3.40 → ct_toolkit-0.4.1}/ct_toolkit/kernels/defense.yaml +0 -0
  55. {ct_toolkit-0.3.40 → ct_toolkit-0.4.1}/ct_toolkit/middleware/__init__.py +0 -0
  56. {ct_toolkit-0.3.40 → ct_toolkit-0.4.1}/ct_toolkit/middleware/autogen.py +0 -0
  57. {ct_toolkit-0.3.40 → ct_toolkit-0.4.1}/ct_toolkit/middleware/crewai.py +0 -0
  58. {ct_toolkit-0.3.40 → ct_toolkit-0.4.1}/ct_toolkit/middleware/deepagents.py +0 -0
  59. {ct_toolkit-0.3.40 → ct_toolkit-0.4.1}/ct_toolkit/middleware/litellm.py +0 -0
  60. {ct_toolkit-0.3.40 → ct_toolkit-0.4.1}/ct_toolkit/profile_checksums.sha256 +0 -0
  61. {ct_toolkit-0.3.40 → ct_toolkit-0.4.1}/ct_toolkit/provenance/__init__.py +0 -0
  62. {ct_toolkit-0.3.40 → ct_toolkit-0.4.1}/ct_toolkit/provenance/vault/__init__.py +0 -0
  63. {ct_toolkit-0.3.40 → ct_toolkit-0.4.1}/ct_toolkit/utils/__init__.py +0 -0
  64. {ct_toolkit-0.3.40 → ct_toolkit-0.4.1}/ct_toolkit/utils/logger.py +0 -0
  65. {ct_toolkit-0.3.40 → ct_toolkit-0.4.1}/ct_toolkit/utils/metrics.py +0 -0
  66. {ct_toolkit-0.3.40 → ct_toolkit-0.4.1}/ct_toolkit/utils/sensitive_masker.py +0 -0
  67. {ct_toolkit-0.3.40 → ct_toolkit-0.4.1}/ct_toolkit.egg-info/dependency_links.txt +0 -0
  68. {ct_toolkit-0.3.40 → ct_toolkit-0.4.1}/ct_toolkit.egg-info/entry_points.txt +0 -0
  69. {ct_toolkit-0.3.40 → ct_toolkit-0.4.1}/ct_toolkit.egg-info/top_level.txt +0 -0
  70. {ct_toolkit-0.3.40 → ct_toolkit-0.4.1}/setup.cfg +0 -0
  71. {ct_toolkit-0.3.40 → ct_toolkit-0.4.1}/tests/test_analysis.py +0 -0
  72. {ct_toolkit-0.3.40 → ct_toolkit-0.4.1}/tests/test_cli.py +0 -0
  73. {ct_toolkit-0.3.40 → ct_toolkit-0.4.1}/tests/test_cli_extended.py +0 -0
  74. {ct_toolkit-0.3.40 → ct_toolkit-0.4.1}/tests/test_deep_agents_integration.py +0 -0
  75. {ct_toolkit-0.3.40 → ct_toolkit-0.4.1}/tests/test_loss.py +0 -0
  76. {ct_toolkit-0.3.40 → ct_toolkit-0.4.1}/tests/test_summarization_drift.py +0 -0
@@ -1,34 +1,47 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ct-toolkit
3
- Version: 0.3.40
3
+ Version: 0.4.1
4
4
  Summary: Computational Theseus Toolkit — Identity Continuity Guardrails for Agentic Systems
5
5
  Author: Hakan Damar
6
6
  License: Apache-2.0
7
+ Project-URL: Homepage, https://theseus-guard.github.io/ct-toolkit/
8
+ Project-URL: Documentation, https://theseus-guard.github.io/ct-toolkit/
9
+ Project-URL: Repository, https://github.com/Theseus-Guard/ct-toolkit
10
+ Project-URL: Issues, https://github.com/Theseus-Guard/ct-toolkit/issues
7
11
  Keywords: llm,ai-safety,identity-continuity,guardrails,alignment
8
12
  Requires-Python: <3.14,>=3.11
9
13
  Description-Content-Type: text/markdown
10
14
  License-File: LICENSE
11
- Requires-Dist: instructor>=1.3.0
12
15
  Requires-Dist: anyio>=4.14.2
13
16
  Requires-Dist: litellm>=1.104.0
14
- Requires-Dist: aiohttp>=3.14.3
15
- Requires-Dist: pillow>=11.3.0
17
+ Requires-Dist: aiohttp>=3.14.4
16
18
  Requires-Dist: numpy>=1.26.0
17
19
  Requires-Dist: pyyaml>=6.0
18
20
  Requires-Dist: pydantic>=2.5.0
19
21
  Requires-Dist: cryptography>=48.0.1
20
22
  Requires-Dist: SQLAlchemy>=2.0.0
21
23
  Requires-Dist: httpx>=0.27.0
22
- Requires-Dist: rich>=13.0.0
23
24
  Requires-Dist: jinja2>=3.1.0
24
25
  Requires-Dist: pyasn1>=0.6.4
25
- Requires-Dist: typer[all]>=0.12.0
26
- Requires-Dist: fastapi>=0.110.0
27
- Requires-Dist: starlette>=1.3.1
28
- Requires-Dist: uvicorn>=0.29.0
29
- Requires-Dist: langsmith>=0.8.18
30
26
  Requires-Dist: urllib3>=2.8.0
31
27
  Requires-Dist: idna>=3.15
28
+ Provides-Extra: server
29
+ Requires-Dist: fastapi>=0.110.0; extra == "server"
30
+ Requires-Dist: starlette>=1.3.1; extra == "server"
31
+ Requires-Dist: uvicorn>=0.29.0; extra == "server"
32
+ Provides-Extra: cli
33
+ Requires-Dist: rich>=13.0.0; extra == "cli"
34
+ Requires-Dist: typer[all]>=0.12.0; extra == "cli"
35
+ Provides-Extra: observability
36
+ Requires-Dist: opentelemetry-api>=1.25.0; extra == "observability"
37
+ Requires-Dist: opentelemetry-sdk>=1.25.0; extra == "observability"
38
+ Requires-Dist: langsmith>=0.8.18; extra == "observability"
39
+ Provides-Extra: structured
40
+ Requires-Dist: instructor>=1.3.0; extra == "structured"
41
+ Provides-Extra: vision
42
+ Requires-Dist: pillow>=11.3.0; extra == "vision"
43
+ Provides-Extra: postgres
44
+ Requires-Dist: psycopg[binary]>=3.1.0; extra == "postgres"
32
45
  Provides-Extra: ollama
33
46
  Requires-Dist: ollama>=0.2.0; extra == "ollama"
34
47
  Provides-Extra: langchain
@@ -40,6 +53,16 @@ Requires-Dist: mkdocs-material>=9.7.7; extra == "docs"
40
53
  Requires-Dist: pymdown-extensions>=10.21.3; extra == "docs"
41
54
  Provides-Extra: ml
42
55
  Requires-Dist: torch>=2.13.0; extra == "ml"
56
+ Requires-Dist: fastembed>=0.3.0; extra == "ml"
57
+ Provides-Extra: all
58
+ Requires-Dist: fastapi>=0.110.0; extra == "all"
59
+ Requires-Dist: starlette>=1.3.1; extra == "all"
60
+ Requires-Dist: uvicorn>=0.29.0; extra == "all"
61
+ Requires-Dist: rich>=13.0.0; extra == "all"
62
+ Requires-Dist: typer[all]>=0.12.0; extra == "all"
63
+ Requires-Dist: instructor>=1.3.0; extra == "all"
64
+ Requires-Dist: pillow>=11.3.0; extra == "all"
65
+ Requires-Dist: langsmith>=0.8.18; extra == "all"
43
66
  Provides-Extra: dev
44
67
  Requires-Dist: pytest>=8.0; extra == "dev"
45
68
  Requires-Dist: pytest-asyncio>=0.23; extra == "dev"
@@ -54,20 +77,61 @@ Dynamic: license-file
54
77
  [![Python 3.11+](https://img.shields.io/badge/python-3.11+-blue.svg)](https://www.python.org/)
55
78
  [![License: Apache 2.0](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](LICENSE)
56
79
  [![PyPI version](https://img.shields.io/pypi/v/ct-toolkit.svg)](https://pypi.org/project/ct-toolkit/)
57
- [![Documentation](https://img.shields.io/badge/docs-GitHub%20Pages-blue.svg)](https://hakandamar.github.io/ct-toolkit/)
80
+ [![Documentation](https://img.shields.io/badge/docs-GitHub%20Pages-blue.svg)](https://theseus-guard.github.io/ct-toolkit/)
58
81
  [![PyPI Downloads](https://static.pepy.tech/personalized-badge/ct-toolkit?period=total&units=INTERNATIONAL_SYSTEM&left_color=BLACK&right_color=MAGENTA&left_text=downloads)](https://pepy.tech/projects/ct-toolkit)
59
- [![codecov](https://codecov.io/gh/hakandamar/ct-toolkit/graph/badge.svg?token=2OTO27N02C)](https://codecov.io/gh/hakandamar/ct-toolkit)
82
+ [![codecov](https://codecov.io/gh/Theseus-Guard/ct-toolkit/graph/badge.svg?token=2OTO27N02C)](https://codecov.io/gh/Theseus-Guard/ct-toolkit)
60
83
 
61
84
  CT Toolkit is an open-source security layer designed to preserve the **identity continuity** of AI agents over time. It implements the **Nested Agentic Architecture (NAA)** framework to prevent **Sequential Self-Compression (SSC)** in multi-agent hierarchies.
62
85
 
86
+ ```text
87
+ $ ct-toolkit status
88
+
89
+ _______ _ _ ______ _____ ______ _ _ _____ _____ _ _ _____ _____
90
+ |__ __| | | | ____|/ ____| ____| | | |/ ____| / ____| | | | /\ | __ \| __ \
91
+ | | | |__| | |__ | (___ | |__ | | | | (___ | | __| | | | / \ | |__) | | | |
92
+ | | | __ | __| \___ \| __| | | | |\___ \ | | |_ | | | | / /\ \ | _ /| | | |
93
+ | | | | | | |____ ____) | |____| |__| |____) | | |__| | |__| |/ ____ \| | \ \| |__| |
94
+ |_| |_| |_|______|_____/|______|_____/|_____/ \_____|\____//_/ \_\_| \_\_____/
95
+
96
+ Computational Theseus Toolkit (CT Toolkit) v0.4.1
97
+ Identity Continuity Guardrails for Agentic Systems
98
+
99
+ ╭──────────────────── CT Toolkit Audit & Telemetry Status ─────────────────────╮
100
+ │ Vault: ./ct_provenance.db (local) │
101
+ │ Chain Integrity: VALID (HMAC Verified) │
102
+ │ Verified Active Entries: 4 (showing last 4) │
103
+ │ Divergence Score (Avg / Max): 0.1525 / 0.3800 │
104
+ │ Head Hash: 9c64cb51a479c52c207b7fa8c3197a75... │
105
+ ╰──────────────────────────────────────────────────────────────────────────────╯
106
+
107
+ Divergence Tier Breakdown (L1 / L2 / L3)
108
+ ┏━━━━━━━━━━━━┳━━━━━━━┳━━━━━━━┓
109
+ ┃ Tier ┃ Count ┃ Share ┃
110
+ ┡━━━━━━━━━━━━╇━━━━━━━╇━━━━━━━┩
111
+ │ OK │ 1 │ 33.3% │
112
+ │ L1_WARNING │ 1 │ 33.3% │
113
+ │ L2_JUDGE │ 1 │ 33.3% │
114
+ │ L3_ICM │ 0 │ 0.0% │
115
+ └────────────┴───────┴───────┘
116
+
117
+ Staged Kernel Rules (Sandbox Cooldown)
118
+ ┏━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━┓
119
+ ┃ Endorsement ID ┃ Commitment ┃ Rule Text ┃ Status ┃
120
+ ┡━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━┩
121
+ │ end-9f8a7b6c │ fin_integrity_01 │ Require dual │ ACTIVE COOLDOWN │
122
+ │ │ │ sign-off for │ (1799s left) │
123
+ │ │ │ adjustments > $10k │ │
124
+ └────────────────┴──────────────────┴────────────────────┴─────────────────────┘
125
+ ```
126
+
63
127
  ---
64
128
 
65
129
  ## 📖 Official Documentation
66
130
 
67
131
  For full API reference, architecture details, examples, and integration guides, visit our documentation site:
68
- 👉 [**https://hakandamar.github.io/ct-toolkit/**](https://hakandamar.github.io/ct-toolkit/)
132
+ 👉 [**https://theseus-guard.github.io/ct-toolkit/**](https://theseus-guard.github.io/ct-toolkit/)
69
133
 
70
- - [**Live Examples & Case Studies**](https://hakandamar.github.io/ct-toolkit/examples/): Real-world scenarios like Financial Auditor Integrity.
134
+ - [**Live Examples & Case Studies**](https://theseus-guard.github.io/ct-toolkit/examples/): Real-world scenarios like Financial Auditor Integrity.
71
135
  - [**FastAPI Integration Test Project**](https://github.com/hakandamar/ct-toolkit-fastapi): Reference FastAPI app for validating CT Toolkit end-to-end across L1/L2/L3 guardrails and provenance logs with local model infrastructure.
72
136
  - [**Deep Agents Integration Test Project**](https://github.com/hakandamar/ct-toolkit-deep-agents): Reference Deep Agents app for validating CT Toolkit end-to-end with hierarchical agent workflows, L1/L2/L3 guardrails, and provenance logs.
73
137
 
@@ -77,21 +141,27 @@ For full API reference, architecture details, examples, and integration guides,
77
141
 
78
142
  In complex agentic workflows, LLMs tend to "drift" from their original instructions. CT Toolkit provides the mathematical and cryptographic guardrails to ensure your agents remain aligned with their core constitution, even across deep hierarchies.
79
143
 
144
+ - **Async & Streaming Guardrails (`achat`)**: Native `async/await` and streaming (`stream=True`) support with non-blocking background execution for shadow requests and L3 ICM probes.
145
+ - **Contrastive Semantic L1 Engine**: Provider-independent embeddings (`litellm`, `ollama`, local `fastembed`) with positive/negative anchor analysis and semantic rule conflict detection.
80
146
  - **Staged Approval (Cooldown)**: Verify risky kernel updates in a sandbox via shadow requests before production promotion.
81
147
  - **Passive Context Compression Detection**: Automatically detects silent provider-side history compression (e.g., OpenAI/Anthropic).
82
- - **Constitutional Kernels**: Axiomatic identity anchors.
83
- - **Standalone Auditor CLI**: Rapidly audit any LLM endpoint for identity drift without writing code.
148
+ - **Constitutional Kernels & Distributed Propagation**: Axiomatic identity anchors with HMAC-SHA256 signed HTTP header propagation (`propagate_headers` / `from_headers`).
149
+ - **Standalone Auditor & Status CLI**: Rapidly audit any LLM endpoint (`ct-toolkit audit`) and inspect provenance integrity & divergence tiers (`ct-toolkit status` / `dashboard`).
84
150
  - **Autonomous Self-Correction**: Active L2->L1 feedback loop that retries and corrects divergent responses before they reach the user.
85
- - **Divergence Engine**: Multi-tiered drift analysis (L1/L2/L3).
86
- - **Hierarchical Propagation**: Mother-to-child constraint inheritance.
87
- - **Provenance Log**: Immutable HMAC-signed interaction history.
151
+ - **Enterprise Provenance & Observability**: Immutable HMAC-signed hash chain supporting SQLite and PostgreSQL/SQLAlchemy with paginated verification and OpenTelemetry (OTel) spans/metrics.
152
+
153
+ ![CT Toolkit Web Audit & Telemetry Dashboard](docs/ct_toolkit_web_dashboard.png)
88
154
 
89
155
  ---
90
156
 
91
157
  ## Quick Start
92
158
 
93
159
  ```bash
160
+ # Core lightweight install
94
161
  pip install ct-toolkit
162
+
163
+ # Or install with optional extras (cli, server, enterprise, embeddings, observability, all)
164
+ pip install "ct-toolkit[all]"
95
165
  ```
96
166
 
97
167
  ```python
@@ -103,18 +173,24 @@ config = WrapperConfig(compression_passive_detection=True)
103
173
  # One-line injection for any LLM provider
104
174
  client = TheseusWrapper(provider="openai", config=config)
105
175
 
106
- # Guardrails and drift analysis applied automatically
176
+ # Sync or async (`await client.achat(...)`) with automatic drift analysis
107
177
  response = client.chat("What are your core security axioms?")
108
178
 
109
179
  print(response.content)
110
180
  print(f"Divergence Score: {response.divergence_score}")
111
181
  ```
112
182
 
113
- ### 🔍 Standalone Auditor (CLI)
183
+ ### 🔍 Standalone Auditor & Dashboard (CLI & Web UI)
114
184
 
115
- Audit any LLM endpoint (OpenAI, Ollama, LM Studio) directly from your terminal:
185
+ Audit any LLM endpoint (OpenAI, Ollama, LM Studio) and inspect your provenance chain directly from your terminal or in the interactive Web Audit Dashboard:
116
186
 
117
187
  ```bash
188
+ # View Provenance Chain integrity, L1/L2/L3 tier breakdown, and staged rules in terminal
189
+ ct-toolkit status --vault ./ct_provenance.db
190
+
191
+ # Launch the interactive Web Audit & Telemetry Dashboard at http://127.0.0.1:8001/dashboard
192
+ ct-toolkit dashboard --web --vault ./ct_provenance.db --port 8001
193
+
118
194
  # Audit a local Ollama model
119
195
  ct-toolkit audit --url http://localhost:11434/v1 --kernel defense
120
196
 
@@ -142,10 +218,9 @@ The L2 judge does not evaluate Jinja2 expressions in user requests or model resp
142
218
 
143
219
  | Metric | Status |
144
220
  | :--------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
145
- | **Tests** | ✅ 397 passed, 3 skipped (100% success rate, 90% coverage) |
221
+ | **Tests** | ✅ 426 passed, 3 skipped (100% success rate, 90%+ coverage) |
146
222
  | **Downloads** | [![PyPI Downloads](https://static.pepy.tech/personalized-badge/ct-toolkit?period=total&units=INTERNATIONAL_SYSTEM&left_color=BLACK&right_color=MAGENTA&left_text=downloads)](https://pepy.tech/projects/ct-toolkit) |
147
- | **Last Phase** | ✅ v0.3.40: fsspec 2026.9.0 fixes ReferenceFileSystem template-injection RCE and multidict 6.9.1 fixes items-view reference leak (Dependabot #72/#73) |
148
- | **Current Goal** | 🔶 Phase 7: Multi-Agent Synchronization (Integration) |
223
+ | **Last Phase** | ✅ v0.4.1: aiohttp 3.14.5 DoS/header-timeout/cookie-Secure fixes (Dependabot #74-76) |
149
224
 
150
225
  ### Framework & Model Support
151
226
 
@@ -1,52 +1,3 @@
1
- Metadata-Version: 2.4
2
- Name: ct-toolkit
3
- Version: 0.3.40
4
- Summary: Computational Theseus Toolkit — Identity Continuity Guardrails for Agentic Systems
5
- Author: Hakan Damar
6
- License: Apache-2.0
7
- Keywords: llm,ai-safety,identity-continuity,guardrails,alignment
8
- Requires-Python: <3.14,>=3.11
9
- Description-Content-Type: text/markdown
10
- License-File: LICENSE
11
- Requires-Dist: instructor>=1.3.0
12
- Requires-Dist: anyio>=4.14.2
13
- Requires-Dist: litellm>=1.104.0
14
- Requires-Dist: aiohttp>=3.14.3
15
- Requires-Dist: pillow>=11.3.0
16
- Requires-Dist: numpy>=1.26.0
17
- Requires-Dist: pyyaml>=6.0
18
- Requires-Dist: pydantic>=2.5.0
19
- Requires-Dist: cryptography>=48.0.1
20
- Requires-Dist: SQLAlchemy>=2.0.0
21
- Requires-Dist: httpx>=0.27.0
22
- Requires-Dist: rich>=13.0.0
23
- Requires-Dist: jinja2>=3.1.0
24
- Requires-Dist: pyasn1>=0.6.4
25
- Requires-Dist: typer[all]>=0.12.0
26
- Requires-Dist: fastapi>=0.110.0
27
- Requires-Dist: starlette>=1.3.1
28
- Requires-Dist: uvicorn>=0.29.0
29
- Requires-Dist: langsmith>=0.8.18
30
- Requires-Dist: urllib3>=2.8.0
31
- Requires-Dist: idna>=3.15
32
- Provides-Extra: ollama
33
- Requires-Dist: ollama>=0.2.0; extra == "ollama"
34
- Provides-Extra: langchain
35
- Requires-Dist: langchain-core>=1.3.3; extra == "langchain"
36
- Provides-Extra: autogen
37
- Requires-Dist: pyautogen>=0.4.0; extra == "autogen"
38
- Provides-Extra: docs
39
- Requires-Dist: mkdocs-material>=9.7.7; extra == "docs"
40
- Requires-Dist: pymdown-extensions>=10.21.3; extra == "docs"
41
- Provides-Extra: ml
42
- Requires-Dist: torch>=2.13.0; extra == "ml"
43
- Provides-Extra: dev
44
- Requires-Dist: pytest>=8.0; extra == "dev"
45
- Requires-Dist: pytest-asyncio>=0.23; extra == "dev"
46
- Requires-Dist: ruff>=0.4; extra == "dev"
47
- Requires-Dist: mypy>=1.10; extra == "dev"
48
- Dynamic: license-file
49
-
50
1
  # Computational Theseus Toolkit (CT Toolkit)
51
2
 
52
3
  > **Identity Continuity Guardrails for Agentic Systems**
@@ -54,20 +5,61 @@ Dynamic: license-file
54
5
  [![Python 3.11+](https://img.shields.io/badge/python-3.11+-blue.svg)](https://www.python.org/)
55
6
  [![License: Apache 2.0](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](LICENSE)
56
7
  [![PyPI version](https://img.shields.io/pypi/v/ct-toolkit.svg)](https://pypi.org/project/ct-toolkit/)
57
- [![Documentation](https://img.shields.io/badge/docs-GitHub%20Pages-blue.svg)](https://hakandamar.github.io/ct-toolkit/)
8
+ [![Documentation](https://img.shields.io/badge/docs-GitHub%20Pages-blue.svg)](https://theseus-guard.github.io/ct-toolkit/)
58
9
  [![PyPI Downloads](https://static.pepy.tech/personalized-badge/ct-toolkit?period=total&units=INTERNATIONAL_SYSTEM&left_color=BLACK&right_color=MAGENTA&left_text=downloads)](https://pepy.tech/projects/ct-toolkit)
59
- [![codecov](https://codecov.io/gh/hakandamar/ct-toolkit/graph/badge.svg?token=2OTO27N02C)](https://codecov.io/gh/hakandamar/ct-toolkit)
10
+ [![codecov](https://codecov.io/gh/Theseus-Guard/ct-toolkit/graph/badge.svg?token=2OTO27N02C)](https://codecov.io/gh/Theseus-Guard/ct-toolkit)
60
11
 
61
12
  CT Toolkit is an open-source security layer designed to preserve the **identity continuity** of AI agents over time. It implements the **Nested Agentic Architecture (NAA)** framework to prevent **Sequential Self-Compression (SSC)** in multi-agent hierarchies.
62
13
 
14
+ ```text
15
+ $ ct-toolkit status
16
+
17
+ _______ _ _ ______ _____ ______ _ _ _____ _____ _ _ _____ _____
18
+ |__ __| | | | ____|/ ____| ____| | | |/ ____| / ____| | | | /\ | __ \| __ \
19
+ | | | |__| | |__ | (___ | |__ | | | | (___ | | __| | | | / \ | |__) | | | |
20
+ | | | __ | __| \___ \| __| | | | |\___ \ | | |_ | | | | / /\ \ | _ /| | | |
21
+ | | | | | | |____ ____) | |____| |__| |____) | | |__| | |__| |/ ____ \| | \ \| |__| |
22
+ |_| |_| |_|______|_____/|______|_____/|_____/ \_____|\____//_/ \_\_| \_\_____/
23
+
24
+ Computational Theseus Toolkit (CT Toolkit) v0.4.1
25
+ Identity Continuity Guardrails for Agentic Systems
26
+
27
+ ╭──────────────────── CT Toolkit Audit & Telemetry Status ─────────────────────╮
28
+ │ Vault: ./ct_provenance.db (local) │
29
+ │ Chain Integrity: VALID (HMAC Verified) │
30
+ │ Verified Active Entries: 4 (showing last 4) │
31
+ │ Divergence Score (Avg / Max): 0.1525 / 0.3800 │
32
+ │ Head Hash: 9c64cb51a479c52c207b7fa8c3197a75... │
33
+ ╰──────────────────────────────────────────────────────────────────────────────╯
34
+
35
+ Divergence Tier Breakdown (L1 / L2 / L3)
36
+ ┏━━━━━━━━━━━━┳━━━━━━━┳━━━━━━━┓
37
+ ┃ Tier ┃ Count ┃ Share ┃
38
+ ┡━━━━━━━━━━━━╇━━━━━━━╇━━━━━━━┩
39
+ │ OK │ 1 │ 33.3% │
40
+ │ L1_WARNING │ 1 │ 33.3% │
41
+ │ L2_JUDGE │ 1 │ 33.3% │
42
+ │ L3_ICM │ 0 │ 0.0% │
43
+ └────────────┴───────┴───────┘
44
+
45
+ Staged Kernel Rules (Sandbox Cooldown)
46
+ ┏━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━┓
47
+ ┃ Endorsement ID ┃ Commitment ┃ Rule Text ┃ Status ┃
48
+ ┡━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━┩
49
+ │ end-9f8a7b6c │ fin_integrity_01 │ Require dual │ ACTIVE COOLDOWN │
50
+ │ │ │ sign-off for │ (1799s left) │
51
+ │ │ │ adjustments > $10k │ │
52
+ └────────────────┴──────────────────┴────────────────────┴─────────────────────┘
53
+ ```
54
+
63
55
  ---
64
56
 
65
57
  ## 📖 Official Documentation
66
58
 
67
59
  For full API reference, architecture details, examples, and integration guides, visit our documentation site:
68
- 👉 [**https://hakandamar.github.io/ct-toolkit/**](https://hakandamar.github.io/ct-toolkit/)
60
+ 👉 [**https://theseus-guard.github.io/ct-toolkit/**](https://theseus-guard.github.io/ct-toolkit/)
69
61
 
70
- - [**Live Examples & Case Studies**](https://hakandamar.github.io/ct-toolkit/examples/): Real-world scenarios like Financial Auditor Integrity.
62
+ - [**Live Examples & Case Studies**](https://theseus-guard.github.io/ct-toolkit/examples/): Real-world scenarios like Financial Auditor Integrity.
71
63
  - [**FastAPI Integration Test Project**](https://github.com/hakandamar/ct-toolkit-fastapi): Reference FastAPI app for validating CT Toolkit end-to-end across L1/L2/L3 guardrails and provenance logs with local model infrastructure.
72
64
  - [**Deep Agents Integration Test Project**](https://github.com/hakandamar/ct-toolkit-deep-agents): Reference Deep Agents app for validating CT Toolkit end-to-end with hierarchical agent workflows, L1/L2/L3 guardrails, and provenance logs.
73
65
 
@@ -77,21 +69,27 @@ For full API reference, architecture details, examples, and integration guides,
77
69
 
78
70
  In complex agentic workflows, LLMs tend to "drift" from their original instructions. CT Toolkit provides the mathematical and cryptographic guardrails to ensure your agents remain aligned with their core constitution, even across deep hierarchies.
79
71
 
72
+ - **Async & Streaming Guardrails (`achat`)**: Native `async/await` and streaming (`stream=True`) support with non-blocking background execution for shadow requests and L3 ICM probes.
73
+ - **Contrastive Semantic L1 Engine**: Provider-independent embeddings (`litellm`, `ollama`, local `fastembed`) with positive/negative anchor analysis and semantic rule conflict detection.
80
74
  - **Staged Approval (Cooldown)**: Verify risky kernel updates in a sandbox via shadow requests before production promotion.
81
75
  - **Passive Context Compression Detection**: Automatically detects silent provider-side history compression (e.g., OpenAI/Anthropic).
82
- - **Constitutional Kernels**: Axiomatic identity anchors.
83
- - **Standalone Auditor CLI**: Rapidly audit any LLM endpoint for identity drift without writing code.
76
+ - **Constitutional Kernels & Distributed Propagation**: Axiomatic identity anchors with HMAC-SHA256 signed HTTP header propagation (`propagate_headers` / `from_headers`).
77
+ - **Standalone Auditor & Status CLI**: Rapidly audit any LLM endpoint (`ct-toolkit audit`) and inspect provenance integrity & divergence tiers (`ct-toolkit status` / `dashboard`).
84
78
  - **Autonomous Self-Correction**: Active L2->L1 feedback loop that retries and corrects divergent responses before they reach the user.
85
- - **Divergence Engine**: Multi-tiered drift analysis (L1/L2/L3).
86
- - **Hierarchical Propagation**: Mother-to-child constraint inheritance.
87
- - **Provenance Log**: Immutable HMAC-signed interaction history.
79
+ - **Enterprise Provenance & Observability**: Immutable HMAC-signed hash chain supporting SQLite and PostgreSQL/SQLAlchemy with paginated verification and OpenTelemetry (OTel) spans/metrics.
80
+
81
+ ![CT Toolkit Web Audit & Telemetry Dashboard](docs/ct_toolkit_web_dashboard.png)
88
82
 
89
83
  ---
90
84
 
91
85
  ## Quick Start
92
86
 
93
87
  ```bash
88
+ # Core lightweight install
94
89
  pip install ct-toolkit
90
+
91
+ # Or install with optional extras (cli, server, enterprise, embeddings, observability, all)
92
+ pip install "ct-toolkit[all]"
95
93
  ```
96
94
 
97
95
  ```python
@@ -103,18 +101,24 @@ config = WrapperConfig(compression_passive_detection=True)
103
101
  # One-line injection for any LLM provider
104
102
  client = TheseusWrapper(provider="openai", config=config)
105
103
 
106
- # Guardrails and drift analysis applied automatically
104
+ # Sync or async (`await client.achat(...)`) with automatic drift analysis
107
105
  response = client.chat("What are your core security axioms?")
108
106
 
109
107
  print(response.content)
110
108
  print(f"Divergence Score: {response.divergence_score}")
111
109
  ```
112
110
 
113
- ### 🔍 Standalone Auditor (CLI)
111
+ ### 🔍 Standalone Auditor & Dashboard (CLI & Web UI)
114
112
 
115
- Audit any LLM endpoint (OpenAI, Ollama, LM Studio) directly from your terminal:
113
+ Audit any LLM endpoint (OpenAI, Ollama, LM Studio) and inspect your provenance chain directly from your terminal or in the interactive Web Audit Dashboard:
116
114
 
117
115
  ```bash
116
+ # View Provenance Chain integrity, L1/L2/L3 tier breakdown, and staged rules in terminal
117
+ ct-toolkit status --vault ./ct_provenance.db
118
+
119
+ # Launch the interactive Web Audit & Telemetry Dashboard at http://127.0.0.1:8001/dashboard
120
+ ct-toolkit dashboard --web --vault ./ct_provenance.db --port 8001
121
+
118
122
  # Audit a local Ollama model
119
123
  ct-toolkit audit --url http://localhost:11434/v1 --kernel defense
120
124
 
@@ -142,10 +146,9 @@ The L2 judge does not evaluate Jinja2 expressions in user requests or model resp
142
146
 
143
147
  | Metric | Status |
144
148
  | :--------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
145
- | **Tests** | ✅ 397 passed, 3 skipped (100% success rate, 90% coverage) |
149
+ | **Tests** | ✅ 426 passed, 3 skipped (100% success rate, 90%+ coverage) |
146
150
  | **Downloads** | [![PyPI Downloads](https://static.pepy.tech/personalized-badge/ct-toolkit?period=total&units=INTERNATIONAL_SYSTEM&left_color=BLACK&right_color=MAGENTA&left_text=downloads)](https://pepy.tech/projects/ct-toolkit) |
147
- | **Last Phase** | ✅ v0.3.40: fsspec 2026.9.0 fixes ReferenceFileSystem template-injection RCE and multidict 6.9.1 fixes items-view reference leak (Dependabot #72/#73) |
148
- | **Current Goal** | 🔶 Phase 7: Multi-Agent Synchronization (Integration) |
151
+ | **Last Phase** | ✅ v0.4.1: aiohttp 3.14.5 DoS/header-timeout/cookie-Secure fixes (Dependabot #74-76) |
149
152
 
150
153
  ### Framework & Model Support
151
154
 
@@ -12,7 +12,7 @@ Identity Continuity Guardrails for LLM Systems.
12
12
  print(response.content)
13
13
  print(response.divergence_score)
14
14
  """
15
- from ct_toolkit.core.wrapper import TheseusWrapper, WrapperConfig, CTResponse
15
+ from ct_toolkit.core.wrapper import TheseusWrapper, WrapperConfig, CTResponse, CTStreamChunk
16
16
  from ct_toolkit.core.kernel import ConstitutionalKernel
17
17
  from ct_toolkit.core.compatibility import CompatibilityLayer
18
18
  from ct_toolkit.core.exceptions import (
@@ -23,12 +23,13 @@ from ct_toolkit.core.exceptions import (
23
23
  ChainIntegrityError,
24
24
  )
25
25
 
26
- __version__ = "0.3.40"
26
+ __version__ = "0.4.1"
27
27
 
28
28
  __all__ = [
29
29
  "TheseusWrapper",
30
30
  "WrapperConfig",
31
31
  "CTResponse",
32
+ "CTStreamChunk",
32
33
  "ConstitutionalKernel",
33
34
  "CompatibilityLayer",
34
35
  "AxiomaticViolationError",