ct-toolkit 0.3.9__tar.gz → 0.3.10__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 (59) hide show
  1. {ct_toolkit-0.3.9 → ct_toolkit-0.3.10}/PKG-INFO +5 -3
  2. {ct_toolkit-0.3.9 → ct_toolkit-0.3.10}/README.md +4 -2
  3. {ct_toolkit-0.3.9 → ct_toolkit-0.3.10}/ct_toolkit/cli.py +47 -0
  4. {ct_toolkit-0.3.9 → ct_toolkit-0.3.10}/ct_toolkit/divergence/analysis.py +2 -2
  5. {ct_toolkit-0.3.9 → ct_toolkit-0.3.10}/ct_toolkit/divergence/engine.py +1 -1
  6. {ct_toolkit-0.3.9 → ct_toolkit-0.3.10}/ct_toolkit/endorsement/reflective.py +7 -8
  7. {ct_toolkit-0.3.9 → ct_toolkit-0.3.10}/ct_toolkit.egg-info/PKG-INFO +5 -3
  8. {ct_toolkit-0.3.9 → ct_toolkit-0.3.10}/pyproject.toml +1 -1
  9. {ct_toolkit-0.3.9 → ct_toolkit-0.3.10}/LICENSE +0 -0
  10. {ct_toolkit-0.3.9 → ct_toolkit-0.3.10}/ct_toolkit/__init__.py +0 -0
  11. {ct_toolkit-0.3.9 → ct_toolkit-0.3.10}/ct_toolkit/__main__.py +0 -0
  12. {ct_toolkit-0.3.9 → ct_toolkit-0.3.10}/ct_toolkit/core/__init__.py +0 -0
  13. {ct_toolkit-0.3.9 → ct_toolkit-0.3.10}/ct_toolkit/core/compatibility.py +0 -0
  14. {ct_toolkit-0.3.9 → ct_toolkit-0.3.10}/ct_toolkit/core/compression_guard.py +0 -0
  15. {ct_toolkit-0.3.9 → ct_toolkit-0.3.10}/ct_toolkit/core/exceptions.py +0 -0
  16. {ct_toolkit-0.3.9 → ct_toolkit-0.3.10}/ct_toolkit/core/integrity.py +0 -0
  17. {ct_toolkit-0.3.9 → ct_toolkit-0.3.10}/ct_toolkit/core/kernel.py +0 -0
  18. {ct_toolkit-0.3.9 → ct_toolkit-0.3.10}/ct_toolkit/core/wrapper.py +0 -0
  19. {ct_toolkit-0.3.9 → ct_toolkit-0.3.10}/ct_toolkit/divergence/__init__.py +0 -0
  20. {ct_toolkit-0.3.9 → ct_toolkit-0.3.10}/ct_toolkit/divergence/l2_judge.py +0 -0
  21. {ct_toolkit-0.3.9 → ct_toolkit-0.3.10}/ct_toolkit/divergence/l3_icm.py +0 -0
  22. {ct_toolkit-0.3.9 → ct_toolkit-0.3.10}/ct_toolkit/divergence/loss.py +0 -0
  23. {ct_toolkit-0.3.9 → ct_toolkit-0.3.10}/ct_toolkit/divergence/scheduler.py +0 -0
  24. {ct_toolkit-0.3.9 → ct_toolkit-0.3.10}/ct_toolkit/endorsement/__init__.py +0 -0
  25. {ct_toolkit-0.3.9 → ct_toolkit-0.3.10}/ct_toolkit/endorsement/probes/__init__.py +0 -0
  26. {ct_toolkit-0.3.9 → ct_toolkit-0.3.10}/ct_toolkit/identity/__init__.py +0 -0
  27. {ct_toolkit-0.3.9 → ct_toolkit-0.3.10}/ct_toolkit/identity/embedding.py +0 -0
  28. {ct_toolkit-0.3.9 → ct_toolkit-0.3.10}/ct_toolkit/identity/templates/__init__.py +0 -0
  29. {ct_toolkit-0.3.9 → ct_toolkit-0.3.10}/ct_toolkit/identity/templates/defense.yaml +0 -0
  30. {ct_toolkit-0.3.9 → ct_toolkit-0.3.10}/ct_toolkit/identity/templates/finance.yaml +0 -0
  31. {ct_toolkit-0.3.9 → ct_toolkit-0.3.10}/ct_toolkit/identity/templates/general.yaml +0 -0
  32. {ct_toolkit-0.3.9 → ct_toolkit-0.3.10}/ct_toolkit/identity/templates/medical.yaml +0 -0
  33. {ct_toolkit-0.3.9 → ct_toolkit-0.3.10}/ct_toolkit/kernels/__init__.py +0 -0
  34. {ct_toolkit-0.3.9 → ct_toolkit-0.3.10}/ct_toolkit/kernels/default.yaml +0 -0
  35. {ct_toolkit-0.3.9 → ct_toolkit-0.3.10}/ct_toolkit/kernels/defense.yaml +0 -0
  36. {ct_toolkit-0.3.9 → ct_toolkit-0.3.10}/ct_toolkit/middleware/__init__.py +0 -0
  37. {ct_toolkit-0.3.9 → ct_toolkit-0.3.10}/ct_toolkit/middleware/autogen.py +0 -0
  38. {ct_toolkit-0.3.9 → ct_toolkit-0.3.10}/ct_toolkit/middleware/crewai.py +0 -0
  39. {ct_toolkit-0.3.9 → ct_toolkit-0.3.10}/ct_toolkit/middleware/deepagents.py +0 -0
  40. {ct_toolkit-0.3.9 → ct_toolkit-0.3.10}/ct_toolkit/middleware/langchain.py +0 -0
  41. {ct_toolkit-0.3.9 → ct_toolkit-0.3.10}/ct_toolkit/middleware/litellm.py +0 -0
  42. {ct_toolkit-0.3.9 → ct_toolkit-0.3.10}/ct_toolkit/provenance/__init__.py +0 -0
  43. {ct_toolkit-0.3.9 → ct_toolkit-0.3.10}/ct_toolkit/provenance/log.py +0 -0
  44. {ct_toolkit-0.3.9 → ct_toolkit-0.3.10}/ct_toolkit/provenance/vault/__init__.py +0 -0
  45. {ct_toolkit-0.3.9 → ct_toolkit-0.3.10}/ct_toolkit/server.py +0 -0
  46. {ct_toolkit-0.3.9 → ct_toolkit-0.3.10}/ct_toolkit/utils/__init__.py +0 -0
  47. {ct_toolkit-0.3.9 → ct_toolkit-0.3.10}/ct_toolkit/utils/logger.py +0 -0
  48. {ct_toolkit-0.3.9 → ct_toolkit-0.3.10}/ct_toolkit.egg-info/SOURCES.txt +0 -0
  49. {ct_toolkit-0.3.9 → ct_toolkit-0.3.10}/ct_toolkit.egg-info/dependency_links.txt +0 -0
  50. {ct_toolkit-0.3.9 → ct_toolkit-0.3.10}/ct_toolkit.egg-info/entry_points.txt +0 -0
  51. {ct_toolkit-0.3.9 → ct_toolkit-0.3.10}/ct_toolkit.egg-info/requires.txt +0 -0
  52. {ct_toolkit-0.3.9 → ct_toolkit-0.3.10}/ct_toolkit.egg-info/top_level.txt +0 -0
  53. {ct_toolkit-0.3.9 → ct_toolkit-0.3.10}/setup.cfg +0 -0
  54. {ct_toolkit-0.3.9 → ct_toolkit-0.3.10}/tests/test_analysis.py +0 -0
  55. {ct_toolkit-0.3.9 → ct_toolkit-0.3.10}/tests/test_cli.py +0 -0
  56. {ct_toolkit-0.3.9 → ct_toolkit-0.3.10}/tests/test_cli_extended.py +0 -0
  57. {ct_toolkit-0.3.9 → ct_toolkit-0.3.10}/tests/test_deep_agents_integration.py +0 -0
  58. {ct_toolkit-0.3.9 → ct_toolkit-0.3.10}/tests/test_loss.py +0 -0
  59. {ct_toolkit-0.3.9 → ct_toolkit-0.3.10}/tests/test_summarization_drift.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ct-toolkit
3
- Version: 0.3.9
3
+ Version: 0.3.10
4
4
  Summary: Computational Theseus Toolkit — Identity Continuity Guardrails for Agentic Systems
5
5
  Author: Hakan Damar
6
6
  License: Apache-2.0
@@ -49,6 +49,7 @@ Dynamic: license-file
49
49
  [![License: Apache 2.0](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](LICENSE)
50
50
  [![PyPI version](https://img.shields.io/pypi/v/ct-toolkit.svg)](https://pypi.org/project/ct-toolkit/)
51
51
  [![Documentation](https://img.shields.io/badge/docs-GitHub%20Pages-blue.svg)](https://hakandamar.github.io/ct-toolkit/)
52
+ [![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)
52
53
 
53
54
  CT Toolkit is an open-source security layer designed to preserve the **identity continuity** of AI agents over time. It implements the **Nested Agency Architecture (NAA)** framework to prevent **Sequential Self-Compression (SSC)** in multi-agent hierarchies.
54
55
 
@@ -119,8 +120,9 @@ ct-toolkit list-templates
119
120
 
120
121
  | Metric | Status |
121
122
  | :--------------- | :------------------------------------------------------ |
122
- | **Tests** | ✅ 293/296 passing (89% coverage) |
123
- | **Last Phase** | ✅ Phase 6: Auditor Mode (v0.3.9: Cooldown Integrated) |
123
+ | **Tests** | ✅ 293 passed, 3 skipped, 13 warnings (93% coverage) |
124
+ | **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) |
125
+ | **Last Phase** | ✅ Phase 6: Auditor Mode (v0.3.10: n8n Guardrail Node) |
124
126
  | **Current Goal** | 🔶 Phase 7: Multi-Agent Synchronization (Integration) |
125
127
 
126
128
  For a detailed breakdown of the 8-phase roadmap, see [**PROJECT_STATUS.md**](docs/PROJECT_STATUS.md).
@@ -6,6 +6,7 @@
6
6
  [![License: Apache 2.0](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](LICENSE)
7
7
  [![PyPI version](https://img.shields.io/pypi/v/ct-toolkit.svg)](https://pypi.org/project/ct-toolkit/)
8
8
  [![Documentation](https://img.shields.io/badge/docs-GitHub%20Pages-blue.svg)](https://hakandamar.github.io/ct-toolkit/)
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)
9
10
 
10
11
  CT Toolkit is an open-source security layer designed to preserve the **identity continuity** of AI agents over time. It implements the **Nested Agency Architecture (NAA)** framework to prevent **Sequential Self-Compression (SSC)** in multi-agent hierarchies.
11
12
 
@@ -76,8 +77,9 @@ ct-toolkit list-templates
76
77
 
77
78
  | Metric | Status |
78
79
  | :--------------- | :------------------------------------------------------ |
79
- | **Tests** | ✅ 293/296 passing (89% coverage) |
80
- | **Last Phase** | ✅ Phase 6: Auditor Mode (v0.3.9: Cooldown Integrated) |
80
+ | **Tests** | ✅ 293 passed, 3 skipped, 13 warnings (93% coverage) |
81
+ | **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) |
82
+ | **Last Phase** | ✅ Phase 6: Auditor Mode (v0.3.10: n8n Guardrail Node) |
81
83
  | **Current Goal** | 🔶 Phase 7: Multi-Agent Synchronization (Integration) |
82
84
 
83
85
  For a detailed breakdown of the 8-phase roadmap, see [**PROJECT_STATUS.md**](docs/PROJECT_STATUS.md).
@@ -167,6 +167,53 @@ def serve(
167
167
  console.print(f"[bold red]Failed to start server:[/bold red] {e}")
168
168
  raise typer.Exit(code=1)
169
169
 
170
+ @app.command()
171
+ def setup(
172
+ profile: str = typer.Argument("personal_kernel", help="Name of the profile to download (e.g., personal_kernel)"),
173
+ repo_branch: str = typer.Option("main", "--branch", help="GitHub repo branch"),
174
+ dest_dir: str = typer.Option("./config", "--dest", help="Destination folder (default: ./config)")
175
+ ):
176
+ """Download a CT-Toolkit profile (kernel, identity, probes) from the official GitHub repository."""
177
+ import urllib.request
178
+
179
+ base_url = f"https://raw.githubusercontent.com/hakandamar/ct-toolkit/{repo_branch}/examples/agent_dna_config"
180
+ target_dir = Path(dest_dir)
181
+ target_dir.mkdir(parents=True, exist_ok=True)
182
+
183
+ base_name = profile.replace("_kernel", "") if profile.endswith("_kernel") else profile
184
+ if base_name == profile:
185
+ kernel_file = f"{profile}_kernel.yaml"
186
+ else:
187
+ kernel_file = f"{profile}.yaml"
188
+
189
+ identity_file = f"{base_name}_identity.yaml"
190
+ probes_file = f"{base_name}_probes.json"
191
+
192
+ files_to_download = [kernel_file, identity_file, probes_file]
193
+
194
+ with console.status(f"[bold green]Downloading '{profile}' profile from GitHub...[/bold green]"):
195
+ has_errors = False
196
+ for filename in files_to_download:
197
+ url = f"{base_url}/{filename}"
198
+ dest_path = target_dir / filename
199
+ try:
200
+ # Use a custom user agent to avoid 403s on some raw github requests occasionally
201
+ req = urllib.request.Request(url, headers={'User-Agent': 'Mozilla/5.0'})
202
+ with urllib.request.urlopen(req) as response:
203
+ content = response.read()
204
+ with open(dest_path, "wb") as f:
205
+ f.write(content)
206
+ console.print(f"[green]✓ Saved {filename} to {dest_path}[/green]")
207
+ except Exception as e:
208
+ console.print(f"[red]✗ Failed to download {filename} from {url}:[/red] {e}")
209
+ has_errors = True
210
+
211
+ if not has_errors:
212
+ console.print(f"\n[bold blue]Profile '{profile}' setup complete![/bold blue]")
213
+ console.print(f"You can now use this kernel by setting [bold]kernel_name='{kernel_file.replace('.yaml','')}'[/bold] in TheseusWrapper")
214
+ else:
215
+ console.print(f"\n[bold yellow]Profile '{profile}' setup finished with some errors.[/bold yellow]")
216
+
170
217
  @app.command()
171
218
  def list_kernels():
172
219
  """List available Constitutional Kernels."""
@@ -42,6 +42,7 @@ class PolicyDriftAnalyzer:
42
42
 
43
43
  def __init__(self, log: ProvenanceLog) -> None:
44
44
  self._log = log
45
+ self._ssc_calc = SSCSeverityCalculator()
45
46
 
46
47
  def analyze_drift(
47
48
  self,
@@ -87,8 +88,7 @@ class PolicyDriftAnalyzer:
87
88
  slope, _ = np.polyfit(x, scores, 1)
88
89
 
89
90
  # SSC Severity calculation (Risk-adjusted)
90
- calc = SSCSeverityCalculator()
91
- ssc_score, struct_risk = calc.calculate(
91
+ ssc_score, struct_risk = self._ssc_calc.calculate(
92
92
  mean_divergence=mean_div,
93
93
  velocity=slope,
94
94
  variance=var_div,
@@ -9,7 +9,7 @@ Wrapper uses this class. On every API call:
9
9
  L3 (ICM) — triggered when L2 returns a problematic finding
10
10
  OR triggered by a periodic schedule
11
11
 
12
- In Enterprise mode, all tiers run all the time and
12
+ In Rigorous mode, all tiers run all the time and
13
13
  action is taken based on the total score.
14
14
  """
15
15
  from __future__ import annotations
@@ -271,12 +271,12 @@ class StagedUpdateManager:
271
271
  """
272
272
 
273
273
  def __init__(self) -> None:
274
- self._staged: list[EndorsementRecord] = []
274
+ self._staged: dict[str, EndorsementRecord] = {}
275
275
 
276
276
  def register(self, record: EndorsementRecord) -> None:
277
277
  """Registers a STAGED record for tracking."""
278
278
  if record.is_staged:
279
- self._staged.append(record)
279
+ self._staged[record.id] = record
280
280
  logger.info(
281
281
  f"StagedUpdateManager: registered staged endorsement "
282
282
  f"id={record.id[:8]}... cooldown_until={record.cooldown_until}"
@@ -284,16 +284,16 @@ class StagedUpdateManager:
284
284
 
285
285
  def get_active(self) -> list[EndorsementRecord]:
286
286
  """Returns all staged endorsements still in their cooldown window."""
287
- return [r for r in self._staged if not r.is_cooldown_expired]
287
+ return [r for r in self._staged.values() if not r.is_cooldown_expired]
288
288
 
289
289
  def get_promotable(self) -> list[EndorsementRecord]:
290
290
  """
291
291
  Returns staged endorsements whose cooldown has expired without
292
292
  being rejected. Removes them from the tracking list.
293
293
  """
294
- promotable = [r for r in self._staged if r.is_cooldown_expired]
294
+ promotable = [r for r in self._staged.values() if r.is_cooldown_expired]
295
295
  for r in promotable:
296
- self._staged.remove(r)
296
+ del self._staged[r.id]
297
297
  return promotable
298
298
 
299
299
  def reject_staged(self, record_id: str, reason: str = "") -> bool:
@@ -301,9 +301,8 @@ class StagedUpdateManager:
301
301
  Rejects and removes a staged endorsement (e.g. on CriticalDivergenceError).
302
302
  Returns True if found and removed.
303
303
  """
304
- for r in self._staged:
305
- if r.id == record_id:
306
- self._staged.remove(r)
304
+ if record_id in self._staged:
305
+ del self._staged[record_id]
307
306
  logger.warning(
308
307
  f"StagedUpdateManager: staged endorsement REJECTED "
309
308
  f"id={record_id[:8]}... reason={reason!r}"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ct-toolkit
3
- Version: 0.3.9
3
+ Version: 0.3.10
4
4
  Summary: Computational Theseus Toolkit — Identity Continuity Guardrails for Agentic Systems
5
5
  Author: Hakan Damar
6
6
  License: Apache-2.0
@@ -49,6 +49,7 @@ Dynamic: license-file
49
49
  [![License: Apache 2.0](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](LICENSE)
50
50
  [![PyPI version](https://img.shields.io/pypi/v/ct-toolkit.svg)](https://pypi.org/project/ct-toolkit/)
51
51
  [![Documentation](https://img.shields.io/badge/docs-GitHub%20Pages-blue.svg)](https://hakandamar.github.io/ct-toolkit/)
52
+ [![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)
52
53
 
53
54
  CT Toolkit is an open-source security layer designed to preserve the **identity continuity** of AI agents over time. It implements the **Nested Agency Architecture (NAA)** framework to prevent **Sequential Self-Compression (SSC)** in multi-agent hierarchies.
54
55
 
@@ -119,8 +120,9 @@ ct-toolkit list-templates
119
120
 
120
121
  | Metric | Status |
121
122
  | :--------------- | :------------------------------------------------------ |
122
- | **Tests** | ✅ 293/296 passing (89% coverage) |
123
- | **Last Phase** | ✅ Phase 6: Auditor Mode (v0.3.9: Cooldown Integrated) |
123
+ | **Tests** | ✅ 293 passed, 3 skipped, 13 warnings (93% coverage) |
124
+ | **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) |
125
+ | **Last Phase** | ✅ Phase 6: Auditor Mode (v0.3.10: n8n Guardrail Node) |
124
126
  | **Current Goal** | 🔶 Phase 7: Multi-Agent Synchronization (Integration) |
125
127
 
126
128
  For a detailed breakdown of the 8-phase roadmap, see [**PROJECT_STATUS.md**](docs/PROJECT_STATUS.md).
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "ct-toolkit"
7
- version = "0.3.9"
7
+ version = "0.3.10"
8
8
  description = "Computational Theseus Toolkit — Identity Continuity Guardrails for Agentic Systems"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.11"
File without changes
File without changes