ct-toolkit 0.3.3__tar.gz → 0.3.5__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 (55) hide show
  1. {ct_toolkit-0.3.3 → ct_toolkit-0.3.5}/PKG-INFO +20 -4
  2. {ct_toolkit-0.3.3 → ct_toolkit-0.3.5}/README.md +17 -3
  3. {ct_toolkit-0.3.3 → ct_toolkit-0.3.5}/ct_toolkit/__init__.py +3 -0
  4. ct_toolkit-0.3.5/ct_toolkit/__main__.py +9 -0
  5. ct_toolkit-0.3.5/ct_toolkit/cli.py +169 -0
  6. {ct_toolkit-0.3.3 → ct_toolkit-0.3.5}/ct_toolkit.egg-info/PKG-INFO +20 -4
  7. {ct_toolkit-0.3.3 → ct_toolkit-0.3.5}/ct_toolkit.egg-info/SOURCES.txt +4 -0
  8. ct_toolkit-0.3.5/ct_toolkit.egg-info/entry_points.txt +2 -0
  9. {ct_toolkit-0.3.3 → ct_toolkit-0.3.5}/ct_toolkit.egg-info/requires.txt +2 -0
  10. {ct_toolkit-0.3.3 → ct_toolkit-0.3.5}/pyproject.toml +6 -1
  11. ct_toolkit-0.3.5/tests/test_cli.py +44 -0
  12. {ct_toolkit-0.3.3 → ct_toolkit-0.3.5}/LICENSE +0 -0
  13. {ct_toolkit-0.3.3 → ct_toolkit-0.3.5}/ct_toolkit/core/__init__.py +0 -0
  14. {ct_toolkit-0.3.3 → ct_toolkit-0.3.5}/ct_toolkit/core/compatibility.py +0 -0
  15. {ct_toolkit-0.3.3 → ct_toolkit-0.3.5}/ct_toolkit/core/exceptions.py +0 -0
  16. {ct_toolkit-0.3.3 → ct_toolkit-0.3.5}/ct_toolkit/core/integrity.py +0 -0
  17. {ct_toolkit-0.3.3 → ct_toolkit-0.3.5}/ct_toolkit/core/kernel.py +0 -0
  18. {ct_toolkit-0.3.3 → ct_toolkit-0.3.5}/ct_toolkit/core/wrapper.py +0 -0
  19. {ct_toolkit-0.3.3 → ct_toolkit-0.3.5}/ct_toolkit/divergence/__init__.py +0 -0
  20. {ct_toolkit-0.3.3 → ct_toolkit-0.3.5}/ct_toolkit/divergence/analysis.py +0 -0
  21. {ct_toolkit-0.3.3 → ct_toolkit-0.3.5}/ct_toolkit/divergence/engine.py +0 -0
  22. {ct_toolkit-0.3.3 → ct_toolkit-0.3.5}/ct_toolkit/divergence/l2_judge.py +0 -0
  23. {ct_toolkit-0.3.3 → ct_toolkit-0.3.5}/ct_toolkit/divergence/l3_icm.py +0 -0
  24. {ct_toolkit-0.3.3 → ct_toolkit-0.3.5}/ct_toolkit/divergence/loss.py +0 -0
  25. {ct_toolkit-0.3.3 → ct_toolkit-0.3.5}/ct_toolkit/divergence/scheduler.py +0 -0
  26. {ct_toolkit-0.3.3 → ct_toolkit-0.3.5}/ct_toolkit/endorsement/__init__.py +0 -0
  27. {ct_toolkit-0.3.3 → ct_toolkit-0.3.5}/ct_toolkit/endorsement/probes/__init__.py +0 -0
  28. {ct_toolkit-0.3.3 → ct_toolkit-0.3.5}/ct_toolkit/endorsement/reflective.py +0 -0
  29. {ct_toolkit-0.3.3 → ct_toolkit-0.3.5}/ct_toolkit/identity/__init__.py +0 -0
  30. {ct_toolkit-0.3.3 → ct_toolkit-0.3.5}/ct_toolkit/identity/embedding.py +0 -0
  31. {ct_toolkit-0.3.3 → ct_toolkit-0.3.5}/ct_toolkit/identity/templates/__init__.py +0 -0
  32. {ct_toolkit-0.3.3 → ct_toolkit-0.3.5}/ct_toolkit/identity/templates/defense.yaml +0 -0
  33. {ct_toolkit-0.3.3 → ct_toolkit-0.3.5}/ct_toolkit/identity/templates/finance.yaml +0 -0
  34. {ct_toolkit-0.3.3 → ct_toolkit-0.3.5}/ct_toolkit/identity/templates/general.yaml +0 -0
  35. {ct_toolkit-0.3.3 → ct_toolkit-0.3.5}/ct_toolkit/identity/templates/medical.yaml +0 -0
  36. {ct_toolkit-0.3.3 → ct_toolkit-0.3.5}/ct_toolkit/kernels/__init__.py +0 -0
  37. {ct_toolkit-0.3.3 → ct_toolkit-0.3.5}/ct_toolkit/kernels/default.yaml +0 -0
  38. {ct_toolkit-0.3.3 → ct_toolkit-0.3.5}/ct_toolkit/kernels/defense.yaml +0 -0
  39. {ct_toolkit-0.3.3 → ct_toolkit-0.3.5}/ct_toolkit/middleware/__init__.py +0 -0
  40. {ct_toolkit-0.3.3 → ct_toolkit-0.3.5}/ct_toolkit/middleware/autogen.py +0 -0
  41. {ct_toolkit-0.3.3 → ct_toolkit-0.3.5}/ct_toolkit/middleware/crewai.py +0 -0
  42. {ct_toolkit-0.3.3 → ct_toolkit-0.3.5}/ct_toolkit/middleware/deepagents.py +0 -0
  43. {ct_toolkit-0.3.3 → ct_toolkit-0.3.5}/ct_toolkit/middleware/langchain.py +0 -0
  44. {ct_toolkit-0.3.3 → ct_toolkit-0.3.5}/ct_toolkit/provenance/__init__.py +0 -0
  45. {ct_toolkit-0.3.3 → ct_toolkit-0.3.5}/ct_toolkit/provenance/log.py +0 -0
  46. {ct_toolkit-0.3.3 → ct_toolkit-0.3.5}/ct_toolkit/provenance/vault/__init__.py +0 -0
  47. {ct_toolkit-0.3.3 → ct_toolkit-0.3.5}/ct_toolkit/utils/__init__.py +0 -0
  48. {ct_toolkit-0.3.3 → ct_toolkit-0.3.5}/ct_toolkit/utils/logger.py +0 -0
  49. {ct_toolkit-0.3.3 → ct_toolkit-0.3.5}/ct_toolkit.egg-info/dependency_links.txt +0 -0
  50. {ct_toolkit-0.3.3 → ct_toolkit-0.3.5}/ct_toolkit.egg-info/top_level.txt +0 -0
  51. {ct_toolkit-0.3.3 → ct_toolkit-0.3.5}/setup.cfg +0 -0
  52. {ct_toolkit-0.3.3 → ct_toolkit-0.3.5}/tests/test_analysis.py +0 -0
  53. {ct_toolkit-0.3.3 → ct_toolkit-0.3.5}/tests/test_deep_agents_integration.py +0 -0
  54. {ct_toolkit-0.3.3 → ct_toolkit-0.3.5}/tests/test_loss.py +0 -0
  55. {ct_toolkit-0.3.3 → ct_toolkit-0.3.5}/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.3
3
+ Version: 0.3.5
4
4
  Summary: Computational Theseus Toolkit — Identity Continuity Guardrails for Agentic Systems
5
5
  Author: Hakan Damar
6
6
  License: Apache-2.0
@@ -18,6 +18,8 @@ Requires-Dist: SQLAlchemy>=2.0.0
18
18
  Requires-Dist: httpx>=0.27.0
19
19
  Requires-Dist: rich>=13.0.0
20
20
  Requires-Dist: jinja2>=3.1.0
21
+ Requires-Dist: pyasn1>=0.6.3
22
+ Requires-Dist: typer[all]>=0.12.0
21
23
  Provides-Extra: ollama
22
24
  Requires-Dist: ollama>=0.2.0; extra == "ollama"
23
25
  Provides-Extra: langchain
@@ -64,6 +66,7 @@ For full API reference, architecture details, examples, and integration guides,
64
66
  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.
65
67
 
66
68
  - **Constitutional Kernels**: Axiomatic identity anchors.
69
+ - **Standalone Auditor CLI**: Rapidly audit any LLM endpoint for identity drift without writing code.
67
70
  - **Autonomous Self-Correction**: Active L2->L1 feedback loop that retries and corrects divergent responses before they reach the user.
68
71
  - **Divergence Engine**: Multi-tiered drift analysis (L1/L2/L3).
69
72
  - **Hierarchical Propagation**: Mother-to-child constraint inheritance.
@@ -90,15 +93,28 @@ print(response.content)
90
93
  print(f"Divergence Score: {response.divergence_score}")
91
94
  ```
92
95
 
96
+ ### 🔍 Standalone Auditor (CLI)
97
+
98
+ Audit any LLM endpoint (OpenAI, Ollama, LM Studio) directly from your terminal:
99
+
100
+ ```bash
101
+ # Audit a local Ollama model
102
+ ct-toolkit audit --url http://localhost:11434/v1 --kernel defense
103
+
104
+ # List available kernels and templates
105
+ ct-toolkit list-kernels
106
+ ct-toolkit list-templates
107
+ ```
108
+
93
109
  ---
94
110
 
95
111
  ## 🚦 Project Health & Status
96
112
 
97
113
  | Metric | Status |
98
114
  | :--------------- | :------------------------------------------------------ |
99
- | **Tests** | ✅ 231/232 passing (90% coverage) |
100
- | **Last Phase** | ✅ Phase 4: OS Support, Deep Agents & Alerts (Complete) |
101
- | **Current Goal** | 🔶 Phase 5: Vault & Security (In Progress) |
115
+ | **Tests** | ✅ 237/240 passing (90% coverage) |
116
+ | **Last Phase** | ✅ Phase 6: Auditor Mode (Complete) |
117
+ | **Current Goal** | 🔶 Phase 7: Multi-Agent Synchronization (Planning) |
102
118
 
103
119
  For a detailed breakdown of the 8-phase roadmap, see [**PROJECT_STATUS.md**](docs/PROJECT_STATUS.md).
104
120
 
@@ -25,6 +25,7 @@ For full API reference, architecture details, examples, and integration guides,
25
25
  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.
26
26
 
27
27
  - **Constitutional Kernels**: Axiomatic identity anchors.
28
+ - **Standalone Auditor CLI**: Rapidly audit any LLM endpoint for identity drift without writing code.
28
29
  - **Autonomous Self-Correction**: Active L2->L1 feedback loop that retries and corrects divergent responses before they reach the user.
29
30
  - **Divergence Engine**: Multi-tiered drift analysis (L1/L2/L3).
30
31
  - **Hierarchical Propagation**: Mother-to-child constraint inheritance.
@@ -51,15 +52,28 @@ print(response.content)
51
52
  print(f"Divergence Score: {response.divergence_score}")
52
53
  ```
53
54
 
55
+ ### 🔍 Standalone Auditor (CLI)
56
+
57
+ Audit any LLM endpoint (OpenAI, Ollama, LM Studio) directly from your terminal:
58
+
59
+ ```bash
60
+ # Audit a local Ollama model
61
+ ct-toolkit audit --url http://localhost:11434/v1 --kernel defense
62
+
63
+ # List available kernels and templates
64
+ ct-toolkit list-kernels
65
+ ct-toolkit list-templates
66
+ ```
67
+
54
68
  ---
55
69
 
56
70
  ## 🚦 Project Health & Status
57
71
 
58
72
  | Metric | Status |
59
73
  | :--------------- | :------------------------------------------------------ |
60
- | **Tests** | ✅ 231/232 passing (90% coverage) |
61
- | **Last Phase** | ✅ Phase 4: OS Support, Deep Agents & Alerts (Complete) |
62
- | **Current Goal** | 🔶 Phase 5: Vault & Security (In Progress) |
74
+ | **Tests** | ✅ 237/240 passing (90% coverage) |
75
+ | **Last Phase** | ✅ Phase 6: Auditor Mode (Complete) |
76
+ | **Current Goal** | 🔶 Phase 7: Multi-Agent Synchronization (Planning) |
63
77
 
64
78
  For a detailed breakdown of the 8-phase roadmap, see [**PROJECT_STATUS.md**](docs/PROJECT_STATUS.md).
65
79
 
@@ -23,6 +23,8 @@ from ct_toolkit.core.exceptions import (
23
23
  ChainIntegrityError,
24
24
  )
25
25
 
26
+ __version__ = "0.3.5"
27
+
26
28
  __all__ = [
27
29
  "TheseusWrapper",
28
30
  "WrapperConfig",
@@ -34,4 +36,5 @@ __all__ = [
34
36
  "IncompatibleProfileError",
35
37
  "CriticalDivergenceError",
36
38
  "ChainIntegrityError",
39
+ "__version__",
37
40
  ]
@@ -0,0 +1,9 @@
1
+ """
2
+ ct_toolkit.__main__
3
+ -------------------
4
+ Allows running the CLI as a module: `python -m ct_toolkit`.
5
+ """
6
+ from ct_toolkit.cli import app
7
+
8
+ if __name__ == "__main__":
9
+ app()
@@ -0,0 +1,169 @@
1
+ """
2
+ ct_toolkit.cli
3
+ --------------
4
+ Main entry point for the Theseus Guard / CT Toolkit CLI.
5
+ """
6
+ from __future__ import annotations
7
+
8
+ import os
9
+ from pathlib import Path
10
+ from typing import Optional
11
+
12
+ import typer
13
+ from rich.console import Console
14
+ from rich.panel import Panel
15
+ from rich.table import Table
16
+
17
+ from ct_toolkit import TheseusWrapper, WrapperConfig, __version__
18
+ from ct_toolkit.divergence.l3_icm import ICMRunner
19
+ from ct_toolkit.core.kernel import ConstitutionalKernel
20
+
21
+ app = typer.Typer(
22
+ help="Computational Theseus Toolkit — Identity Continuity Guardrails for Agentic Systems.",
23
+ no_args_is_help=True,
24
+ rich_markup_mode="rich",
25
+ )
26
+
27
+ console = Console()
28
+
29
+ BANNER = r"""
30
+ _______ _ _ ______ _____ ______ _ _ _____ _____ _ _ _____ _____
31
+ |__ __| | | | ____|/ ____| ____| | | |/ ____| / ____| | | | /\ | __ \| __ \
32
+ | | | |__| | |__ | (___ | |__ | | | | (___ | | __| | | | / \ | |__) | | | |
33
+ | | | __ | __| \___ \| __| | | | |\___ \ | | |_ | | | | / /\ \ | _ /| | | |
34
+ | | | | | | |____ ____) | |____| |__| |____) | | |__| | |__| |/ ____ \| | \ \| |__| |
35
+ |_| |_| |_|______|_____/|______|_____/|_____/ \_____|\____//_/ \_\_| \_\_____/
36
+ """
37
+
38
+ def show_banner():
39
+ console.print(f"[bold cyan]{BANNER}[/bold cyan]")
40
+ console.print(f"[bold white] Computatonal Theseus Toolkit (CT Toolkit) v{__version__}[/bold white]")
41
+ console.print(f"[dim] Identity Continuity Guardrails for Agentic Systems[/dim]\n")
42
+
43
+ def version_callback(value: bool):
44
+ if value:
45
+ console.print(f"CT Toolkit v{__version__}")
46
+ raise typer.Exit()
47
+
48
+ @app.callback()
49
+ def main(
50
+ version: Optional[bool] = typer.Option(
51
+ None, "--version", "-v", help="Show version and exit.", callback=version_callback
52
+ ),
53
+ ):
54
+ """Theseus Guard CLI — Preserve Agent Identity Continuity."""
55
+ if not version:
56
+ show_banner()
57
+
58
+ @app.command()
59
+ def audit(
60
+ url: str = typer.Option(..., "--url", help="Target LLM API base URL."),
61
+ api_key: str = typer.Option("no-key", "--api-key", help="API Key for the provider."),
62
+ provider: str = typer.Option("openai", "--provider", help="LLM provider (openai, anthropic, ollama)."),
63
+ kernel: str = typer.Option("general", "--kernel", help="Name of the Constitutional Kernel to use."),
64
+ template: str = typer.Option("general", "--template", help="Name of the Identity Template to use."),
65
+ model: Optional[str] = typer.Option(None, "--model", help="Specific model ID to test."),
66
+ max_probes: Optional[int] = typer.Option(None, "--max-probes", help="Max number of probes to run."),
67
+ ):
68
+ """Run an Independent Identity Audit (L3 ICM) against an LLM endpoint."""
69
+ with console.status("[bold green]Initializing Auditor...[/bold green]"):
70
+ try:
71
+ # Load kernel
72
+ config = WrapperConfig(
73
+ kernel_name=kernel,
74
+ template=template,
75
+ project_root=Path.cwd()
76
+ )
77
+
78
+ # Using TheseusWrapper to manage kernel loading
79
+ wrapper = TheseusWrapper(provider=provider, config=config)
80
+
81
+ import openai
82
+ client = openai.OpenAI(base_url=url, api_key=api_key)
83
+
84
+ runner = ICMRunner(
85
+ client=client,
86
+ provider=provider,
87
+ kernel=wrapper.kernel,
88
+ template=template,
89
+ model=model,
90
+ max_probes=max_probes,
91
+ project_root=Path.cwd()
92
+ )
93
+ except Exception as e:
94
+ console.print(f"[bold red]Initialization failed:[/bold red] {e}")
95
+ raise typer.Exit(code=1)
96
+
97
+ console.print(f"🚀 Starting audit against [bold cyan]{url}[/bold cyan] using kernel [bold yellow]{kernel}[/bold yellow]...")
98
+
99
+ with console.status("[bold blue]Running probes...[/bold blue]"):
100
+ try:
101
+ report = runner.run()
102
+ if report.total_probes == 0:
103
+ console.print(f"[bold red]Error:[/bold red] No probes were loaded from {runner.PROBES_DIR}. Check your configuration and probe files.")
104
+ raise typer.Exit(code=1)
105
+ except Exception as e:
106
+ console.print(f"[bold red]Audit failed during execution:[/bold red] {e}")
107
+ raise typer.Exit(code=1)
108
+
109
+ # Results Table
110
+ table = Table(title=f"ICM Audit Report: {kernel}", show_header=True, header_style="bold magenta")
111
+ table.add_column("Probe ID", style="dim", width=20)
112
+ table.add_column("Category")
113
+ table.add_column("Severity")
114
+ table.add_column("Result", justify="center")
115
+
116
+ for res in report.results:
117
+ status = "[green]PASS[/green]" if res.passed else "[red]FAIL[/red]"
118
+ table.add_row(res.probe_id, res.category, res.severity, status)
119
+
120
+ console.print(table)
121
+
122
+ # Summary Panel
123
+ color = "green" if report.is_healthy else "red"
124
+ if report.risk_level == "MEDIUM":
125
+ color = "yellow"
126
+
127
+ summary_text = (
128
+ f"Health Score : [bold]{report.health_score:.1%}[/bold]\n"
129
+ f"Risk Level : [bold {color}]{report.risk_level}[/bold {color}]\n"
130
+ f"Passed/Total : {report.passed}/{report.total_probes}"
131
+ )
132
+
133
+ console.print(Panel(summary_text, title="Summary", border_style=color, expand=False))
134
+
135
+ if not report.is_healthy:
136
+ raise typer.Exit(code=1)
137
+
138
+ @app.command()
139
+ def list_kernels():
140
+ """List available Constitutional Kernels."""
141
+ kernels_dir = Path(__file__).parent / "kernels"
142
+ files = list(kernels_dir.glob("*.yaml"))
143
+
144
+ table = Table(title="Available Kernels", show_header=True, header_style="bold blue")
145
+ table.add_column("Name", style="cyan")
146
+ table.add_column("Path", style="dim")
147
+
148
+ for f in files:
149
+ table.add_row(f.stem, str(f))
150
+
151
+ console.print(table)
152
+
153
+ @app.command()
154
+ def list_templates():
155
+ """List available Identity Templates."""
156
+ templates_dir = Path(__file__).parent / "identity" / "templates"
157
+ files = list(templates_dir.glob("*.yaml"))
158
+
159
+ table = Table(title="Available Templates", show_header=True, header_style="bold green")
160
+ table.add_column("Name", style="cyan")
161
+ table.add_column("Path", style="dim")
162
+
163
+ for f in files:
164
+ table.add_row(f.stem, str(f))
165
+
166
+ console.print(table)
167
+
168
+ if __name__ == "__main__":
169
+ app()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ct-toolkit
3
- Version: 0.3.3
3
+ Version: 0.3.5
4
4
  Summary: Computational Theseus Toolkit — Identity Continuity Guardrails for Agentic Systems
5
5
  Author: Hakan Damar
6
6
  License: Apache-2.0
@@ -18,6 +18,8 @@ Requires-Dist: SQLAlchemy>=2.0.0
18
18
  Requires-Dist: httpx>=0.27.0
19
19
  Requires-Dist: rich>=13.0.0
20
20
  Requires-Dist: jinja2>=3.1.0
21
+ Requires-Dist: pyasn1>=0.6.3
22
+ Requires-Dist: typer[all]>=0.12.0
21
23
  Provides-Extra: ollama
22
24
  Requires-Dist: ollama>=0.2.0; extra == "ollama"
23
25
  Provides-Extra: langchain
@@ -64,6 +66,7 @@ For full API reference, architecture details, examples, and integration guides,
64
66
  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.
65
67
 
66
68
  - **Constitutional Kernels**: Axiomatic identity anchors.
69
+ - **Standalone Auditor CLI**: Rapidly audit any LLM endpoint for identity drift without writing code.
67
70
  - **Autonomous Self-Correction**: Active L2->L1 feedback loop that retries and corrects divergent responses before they reach the user.
68
71
  - **Divergence Engine**: Multi-tiered drift analysis (L1/L2/L3).
69
72
  - **Hierarchical Propagation**: Mother-to-child constraint inheritance.
@@ -90,15 +93,28 @@ print(response.content)
90
93
  print(f"Divergence Score: {response.divergence_score}")
91
94
  ```
92
95
 
96
+ ### 🔍 Standalone Auditor (CLI)
97
+
98
+ Audit any LLM endpoint (OpenAI, Ollama, LM Studio) directly from your terminal:
99
+
100
+ ```bash
101
+ # Audit a local Ollama model
102
+ ct-toolkit audit --url http://localhost:11434/v1 --kernel defense
103
+
104
+ # List available kernels and templates
105
+ ct-toolkit list-kernels
106
+ ct-toolkit list-templates
107
+ ```
108
+
93
109
  ---
94
110
 
95
111
  ## 🚦 Project Health & Status
96
112
 
97
113
  | Metric | Status |
98
114
  | :--------------- | :------------------------------------------------------ |
99
- | **Tests** | ✅ 231/232 passing (90% coverage) |
100
- | **Last Phase** | ✅ Phase 4: OS Support, Deep Agents & Alerts (Complete) |
101
- | **Current Goal** | 🔶 Phase 5: Vault & Security (In Progress) |
115
+ | **Tests** | ✅ 237/240 passing (90% coverage) |
116
+ | **Last Phase** | ✅ Phase 6: Auditor Mode (Complete) |
117
+ | **Current Goal** | 🔶 Phase 7: Multi-Agent Synchronization (Planning) |
102
118
 
103
119
  For a detailed breakdown of the 8-phase roadmap, see [**PROJECT_STATUS.md**](docs/PROJECT_STATUS.md).
104
120
 
@@ -2,9 +2,12 @@ LICENSE
2
2
  README.md
3
3
  pyproject.toml
4
4
  ct_toolkit/__init__.py
5
+ ct_toolkit/__main__.py
6
+ ct_toolkit/cli.py
5
7
  ct_toolkit.egg-info/PKG-INFO
6
8
  ct_toolkit.egg-info/SOURCES.txt
7
9
  ct_toolkit.egg-info/dependency_links.txt
10
+ ct_toolkit.egg-info/entry_points.txt
8
11
  ct_toolkit.egg-info/requires.txt
9
12
  ct_toolkit.egg-info/top_level.txt
10
13
  ct_toolkit/core/__init__.py
@@ -44,6 +47,7 @@ ct_toolkit/provenance/vault/__init__.py
44
47
  ct_toolkit/utils/__init__.py
45
48
  ct_toolkit/utils/logger.py
46
49
  tests/test_analysis.py
50
+ tests/test_cli.py
47
51
  tests/test_deep_agents_integration.py
48
52
  tests/test_loss.py
49
53
  tests/test_summarization_drift.py
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ ct-toolkit = ct_toolkit.cli:app
@@ -8,6 +8,8 @@ SQLAlchemy>=2.0.0
8
8
  httpx>=0.27.0
9
9
  rich>=13.0.0
10
10
  jinja2>=3.1.0
11
+ pyasn1>=0.6.3
12
+ typer[all]>=0.12.0
11
13
 
12
14
  [autogen]
13
15
  pyautogen>=0.4.0
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "ct-toolkit"
7
- version = "0.3.3"
7
+ version = "0.3.5"
8
8
  description = "Computational Theseus Toolkit — Identity Continuity Guardrails for Agentic Systems"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.11"
@@ -23,6 +23,8 @@ dependencies = [
23
23
  "httpx>=0.27.0",
24
24
  "rich>=13.0.0", # For CLI reporting
25
25
  "jinja2>=3.1.0",
26
+ "pyasn1>=0.6.3",
27
+ "typer[all]>=0.12.0",
26
28
  ]
27
29
 
28
30
  [project.optional-dependencies]
@@ -63,6 +65,9 @@ include = ["ct_toolkit*"]
63
65
  "ct_toolkit.kernels" = ["*.yaml"]
64
66
  "ct_toolkit.identity.templates" = ["*.yaml"]
65
67
 
68
+ [project.scripts]
69
+ ct-toolkit = "ct_toolkit.cli:app"
70
+
66
71
  [tool.pytest.ini_options]
67
72
  extraPaths = ["."]
68
73
 
@@ -0,0 +1,44 @@
1
+ import pytest
2
+ from typer.testing import CliRunner
3
+ from ct_toolkit.cli import app
4
+ from ct_toolkit import __version__
5
+
6
+ runner = CliRunner()
7
+
8
+ def test_cli_help():
9
+ """Test standard help output."""
10
+ result = runner.invoke(app, ["--help"])
11
+ assert result.exit_code == 0
12
+ assert "Computational Theseus Toolkit" in result.stdout
13
+ assert "audit" in result.stdout
14
+
15
+ def test_cli_version():
16
+ """Test --version flag."""
17
+ result = runner.invoke(app, ["--version"])
18
+ assert result.exit_code == 0
19
+ assert f"CT Toolkit v{__version__}" in result.stdout
20
+
21
+ def test_cli_list_kernels():
22
+ """Test list-kernels command."""
23
+ result = runner.invoke(app, ["list-kernels"])
24
+ assert result.exit_code == 0
25
+ assert "Available Kernels" in result.stdout
26
+ # Check for a character that is definitely in the banner
27
+ assert "____" in result.stdout
28
+
29
+ def test_cli_list_templates():
30
+ """Test list-templates command."""
31
+ result = runner.invoke(app, ["list-templates"])
32
+ assert result.exit_code == 0
33
+ assert "Available Templates" in result.stdout
34
+ assert "general" in result.stdout
35
+
36
+ def test_cli_audit_invalid_url():
37
+ """Test audit command with an unreachable URL (should fail gracefully)."""
38
+ result = runner.invoke(app, ["audit", "--url", "http://invalid-url-that-does-not-exist:1234", "--kernel", "default"])
39
+
40
+ # Check that it either failed with error or finished with 0%
41
+ output = result.stdout.lower()
42
+ assert (result.exit_code == 1) or (result.exit_code == 0 and "0.0%" in output)
43
+ # At least some indicator of failure or starting should be there
44
+ assert "starting audit" in output
File without changes
File without changes