akf 1.4.0__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 (128) hide show
  1. akf-1.4.0/PKG-INFO +116 -0
  2. akf-1.4.0/README.md +62 -0
  3. akf-1.4.0/akf/__init__.py +465 -0
  4. akf-1.4.0/akf/__main__.py +6 -0
  5. akf-1.4.0/akf/_auto.py +496 -0
  6. akf-1.4.0/akf/a2a_bridge.py +190 -0
  7. akf-1.4.0/akf/agent.py +452 -0
  8. akf-1.4.0/akf/agent_card.py +155 -0
  9. akf-1.4.0/akf/ai_detect.py +309 -0
  10. akf-1.4.0/akf/builder.py +168 -0
  11. akf-1.4.0/akf/certify.py +441 -0
  12. akf-1.4.0/akf/cli.py +2186 -0
  13. akf-1.4.0/akf/compliance.py +723 -0
  14. akf-1.4.0/akf/context.py +454 -0
  15. akf-1.4.0/akf/core.py +289 -0
  16. akf-1.4.0/akf/daemon.py +202 -0
  17. akf-1.4.0/akf/data.py +238 -0
  18. akf-1.4.0/akf/delegation.py +113 -0
  19. akf-1.4.0/akf/detection.py +632 -0
  20. akf-1.4.0/akf/formats/__init__.py +1 -0
  21. akf-1.4.0/akf/formats/_ooxml.py +337 -0
  22. akf-1.4.0/akf/formats/audio.py +106 -0
  23. akf-1.4.0/akf/formats/base.py +141 -0
  24. akf-1.4.0/akf/formats/csv.py +65 -0
  25. akf-1.4.0/akf/formats/docx.py +197 -0
  26. akf-1.4.0/akf/formats/email.py +153 -0
  27. akf-1.4.0/akf/formats/html.py +224 -0
  28. akf-1.4.0/akf/formats/image.py +213 -0
  29. akf-1.4.0/akf/formats/json_format.py +163 -0
  30. akf-1.4.0/akf/formats/markdown.py +497 -0
  31. akf-1.4.0/akf/formats/pdf.py +164 -0
  32. akf-1.4.0/akf/formats/pptx.py +234 -0
  33. akf-1.4.0/akf/formats/toml_format.py +80 -0
  34. akf-1.4.0/akf/formats/video.py +106 -0
  35. akf-1.4.0/akf/formats/xlsx.py +213 -0
  36. akf-1.4.0/akf/fs_events.py +342 -0
  37. akf-1.4.0/akf/git_ops.py +156 -0
  38. akf-1.4.0/akf/i18n.py +88 -0
  39. akf-1.4.0/akf/knowledge_base.py +278 -0
  40. akf-1.4.0/akf/models.py +799 -0
  41. akf-1.4.0/akf/presets.py +142 -0
  42. akf-1.4.0/akf/provenance.py +159 -0
  43. akf-1.4.0/akf/report.py +971 -0
  44. akf-1.4.0/akf/security.py +485 -0
  45. akf-1.4.0/akf/shell_hook.py +407 -0
  46. akf-1.4.0/akf/sidecar.py +201 -0
  47. akf-1.4.0/akf/signing.py +166 -0
  48. akf-1.4.0/akf/stamp.py +233 -0
  49. akf-1.4.0/akf/streaming.py +313 -0
  50. akf-1.4.0/akf/team_stream.py +294 -0
  51. akf-1.4.0/akf/tracking.py +305 -0
  52. akf-1.4.0/akf/transform.py +91 -0
  53. akf-1.4.0/akf/trust.py +369 -0
  54. akf-1.4.0/akf/universal.py +873 -0
  55. akf-1.4.0/akf/view.py +200 -0
  56. akf-1.4.0/akf/watch.py +232 -0
  57. akf-1.4.0/akf.egg-info/PKG-INFO +116 -0
  58. akf-1.4.0/akf.egg-info/SOURCES.txt +126 -0
  59. akf-1.4.0/akf.egg-info/dependency_links.txt +1 -0
  60. akf-1.4.0/akf.egg-info/entry_points.txt +2 -0
  61. akf-1.4.0/akf.egg-info/requires.txt +43 -0
  62. akf-1.4.0/akf.egg-info/top_level.txt +1 -0
  63. akf-1.4.0/pyproject.toml +52 -0
  64. akf-1.4.0/setup.cfg +4 -0
  65. akf-1.4.0/tests/test_a2a_bridge.py +175 -0
  66. akf-1.4.0/tests/test_agent.py +166 -0
  67. akf-1.4.0/tests/test_agent_card.py +270 -0
  68. akf-1.4.0/tests/test_ai_detect.py +258 -0
  69. akf-1.4.0/tests/test_aliases.py +167 -0
  70. akf-1.4.0/tests/test_audio.py +163 -0
  71. akf-1.4.0/tests/test_auto_service.py +241 -0
  72. akf-1.4.0/tests/test_builder.py +113 -0
  73. akf-1.4.0/tests/test_certify.py +268 -0
  74. akf-1.4.0/tests/test_cli.py +222 -0
  75. akf-1.4.0/tests/test_compliance.py +124 -0
  76. akf-1.4.0/tests/test_compliance_enhanced.py +202 -0
  77. akf-1.4.0/tests/test_context.py +451 -0
  78. akf-1.4.0/tests/test_core.py +185 -0
  79. akf-1.4.0/tests/test_cross_flow.py +293 -0
  80. akf-1.4.0/tests/test_daemon.py +163 -0
  81. akf-1.4.0/tests/test_data.py +111 -0
  82. akf-1.4.0/tests/test_delegation.py +296 -0
  83. akf-1.4.0/tests/test_delta_cli.py +26 -0
  84. akf-1.4.0/tests/test_delta_freshness.py +69 -0
  85. akf-1.4.0/tests/test_delta_generation_params.py +116 -0
  86. akf-1.4.0/tests/test_delta_security_report.py +86 -0
  87. akf-1.4.0/tests/test_delta_size_benchmarks.py +79 -0
  88. akf-1.4.0/tests/test_delta_trust_origin.py +94 -0
  89. akf-1.4.0/tests/test_detection.py +337 -0
  90. akf-1.4.0/tests/test_e2e_agent_platforms.py +512 -0
  91. akf-1.4.0/tests/test_e2e_certify.py +1407 -0
  92. akf-1.4.0/tests/test_e2e_integration.py +1093 -0
  93. akf-1.4.0/tests/test_e2e_multi_agent.py +1605 -0
  94. akf-1.4.0/tests/test_e2e_smart_context.py +550 -0
  95. akf-1.4.0/tests/test_e2e_woodgrove.py +330 -0
  96. akf-1.4.0/tests/test_enhanced_trust.py +184 -0
  97. akf-1.4.0/tests/test_evidence.py +195 -0
  98. akf-1.4.0/tests/test_fs_events.py +213 -0
  99. akf-1.4.0/tests/test_git_ops.py +74 -0
  100. akf-1.4.0/tests/test_i18n.py +41 -0
  101. akf-1.4.0/tests/test_integration_full.py +832 -0
  102. akf-1.4.0/tests/test_knowledge_base.py +85 -0
  103. akf-1.4.0/tests/test_log.py +43 -0
  104. akf-1.4.0/tests/test_models.py +251 -0
  105. akf-1.4.0/tests/test_new_models.py +353 -0
  106. akf-1.4.0/tests/test_ooxml_custom_properties.py +827 -0
  107. akf-1.4.0/tests/test_performance.py +841 -0
  108. akf-1.4.0/tests/test_presets.py +71 -0
  109. akf-1.4.0/tests/test_provenance.py +119 -0
  110. akf-1.4.0/tests/test_report.py +935 -0
  111. akf-1.4.0/tests/test_scan_recursive_flag.py +64 -0
  112. akf-1.4.0/tests/test_secure_defaults.py +79 -0
  113. akf-1.4.0/tests/test_security.py +185 -0
  114. akf-1.4.0/tests/test_security_enhanced.py +168 -0
  115. akf-1.4.0/tests/test_shell_hook.py +322 -0
  116. akf-1.4.0/tests/test_sidecar.py +224 -0
  117. akf-1.4.0/tests/test_signing.py +81 -0
  118. akf-1.4.0/tests/test_stamp.py +139 -0
  119. akf-1.4.0/tests/test_streaming.py +171 -0
  120. akf-1.4.0/tests/test_team_certify.py +210 -0
  121. akf-1.4.0/tests/test_team_stream.py +186 -0
  122. akf-1.4.0/tests/test_tracking.py +130 -0
  123. akf-1.4.0/tests/test_transform.py +118 -0
  124. akf-1.4.0/tests/test_trust.py +169 -0
  125. akf-1.4.0/tests/test_universal.py +505 -0
  126. akf-1.4.0/tests/test_video.py +163 -0
  127. akf-1.4.0/tests/test_view.py +85 -0
  128. akf-1.4.0/tests/test_watch.py +208 -0
akf-1.4.0/PKG-INFO ADDED
@@ -0,0 +1,116 @@
1
+ Metadata-Version: 2.4
2
+ Name: akf
3
+ Version: 1.4.0
4
+ Summary: AKF — Agent Knowledge Format. Lightweight file format for AI-generated knowledge with built-in trust, provenance, and security.
5
+ Author: AKF Contributors
6
+ License: MIT
7
+ Project-URL: Homepage, https://akf.dev
8
+ Project-URL: Repository, https://github.com/HMAKT99/AKF
9
+ Project-URL: Documentation, https://akf.dev
10
+ Classifier: Development Status :: 4 - Beta
11
+ Classifier: Intended Audience :: Developers
12
+ Classifier: Programming Language :: Python :: 3
13
+ Classifier: Programming Language :: Python :: 3.9
14
+ Classifier: Programming Language :: Python :: 3.10
15
+ Classifier: Programming Language :: Python :: 3.11
16
+ Classifier: Programming Language :: Python :: 3.12
17
+ Classifier: Topic :: Software Development :: Libraries
18
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
19
+ Requires-Python: >=3.9
20
+ Description-Content-Type: text/markdown
21
+ Requires-Dist: pydantic>=2.0
22
+ Requires-Dist: click>=8.0
23
+ Provides-Extra: docx
24
+ Requires-Dist: python-docx>=0.8; extra == "docx"
25
+ Provides-Extra: xlsx
26
+ Requires-Dist: openpyxl>=3.1; extra == "xlsx"
27
+ Provides-Extra: pptx
28
+ Requires-Dist: python-pptx>=0.6; extra == "pptx"
29
+ Provides-Extra: pdf
30
+ Requires-Dist: pypdf>=3.0; extra == "pdf"
31
+ Provides-Extra: image
32
+ Requires-Dist: Pillow>=10.0; extra == "image"
33
+ Provides-Extra: office
34
+ Requires-Dist: python-docx>=0.8; extra == "office"
35
+ Requires-Dist: openpyxl>=3.1; extra == "office"
36
+ Requires-Dist: python-pptx>=0.6; extra == "office"
37
+ Provides-Extra: report
38
+ Requires-Dist: fpdf2>=2.7; extra == "report"
39
+ Provides-Extra: crypto
40
+ Requires-Dist: cryptography>=42.0; extra == "crypto"
41
+ Provides-Extra: all
42
+ Requires-Dist: python-docx>=0.8; extra == "all"
43
+ Requires-Dist: openpyxl>=3.1; extra == "all"
44
+ Requires-Dist: python-pptx>=0.6; extra == "all"
45
+ Requires-Dist: pypdf>=3.0; extra == "all"
46
+ Requires-Dist: Pillow>=10.0; extra == "all"
47
+ Requires-Dist: cryptography>=42.0; extra == "all"
48
+ Requires-Dist: fpdf2>=2.7; extra == "all"
49
+ Provides-Extra: dev
50
+ Requires-Dist: pytest; extra == "dev"
51
+ Requires-Dist: black; extra == "dev"
52
+ Requires-Dist: ruff; extra == "dev"
53
+ Requires-Dist: pyyaml; extra == "dev"
54
+
55
+ # AKF — Agent Knowledge Format (Python SDK)
56
+
57
+ [![PyPI](https://img.shields.io/pypi/v/akf)](https://pypi.org/project/akf/)
58
+ [![Python](https://img.shields.io/pypi/pyversions/akf)](https://pypi.org/project/akf/)
59
+
60
+ Lightweight file format for AI-generated knowledge with built-in trust, provenance, and security.
61
+
62
+ ## Install
63
+
64
+ ```bash
65
+ pip install akf
66
+ ```
67
+
68
+ > **`akf` command not found?** Use `python3 -m akf` (always works), or:
69
+ > - Install with pipx: `pipx install akf` (recommended — auto-handles PATH)
70
+ > - macOS: add `export PATH="$HOME/Library/Python/3.9/bin:$PATH"` to `~/.zshrc`
71
+ > - Linux: add `export PATH="$HOME/.local/bin:$PATH"` to `~/.bashrc`
72
+
73
+ ## Usage
74
+
75
+ ```python
76
+ import akf
77
+
78
+ # Create a single-claim unit
79
+ unit = akf.create("Revenue $4.2B", t=0.98, src="SEC 10-Q", tier=1)
80
+ unit.save("report.akf")
81
+
82
+ # Load and validate
83
+ unit = akf.load("report.akf")
84
+ result = akf.validate(unit)
85
+
86
+ # Builder API
87
+ unit = (akf.AKFBuilder()
88
+ .by("sarah@woodgrove.com")
89
+ .label("confidential")
90
+ .claim("Revenue $4.2B", 0.98, src="SEC 10-Q", tier=1, ver=True)
91
+ .claim("Cloud growth 15%", 0.85, src="Gartner", tier=2)
92
+ .build())
93
+
94
+ # Trust computation
95
+ for claim in unit.claims:
96
+ result = akf.effective_trust(claim)
97
+ print(f"{result.decision}: {result.score:.2f}")
98
+
99
+ # Agent consumption
100
+ brief = (akf.AKFTransformer(unit)
101
+ .filter(trust_min=0.5)
102
+ .penalty(-0.03)
103
+ .by("research-agent")
104
+ .build())
105
+ ```
106
+
107
+ ## CLI
108
+
109
+ ```bash
110
+ akf create report.akf --claim "Revenue $4.2B" --trust 0.98
111
+ akf validate report.akf
112
+ akf inspect report.akf
113
+ akf trust report.akf
114
+ akf consume report.akf --output brief.akf --threshold 0.6
115
+ akf provenance report.akf
116
+ ```
akf-1.4.0/README.md ADDED
@@ -0,0 +1,62 @@
1
+ # AKF — Agent Knowledge Format (Python SDK)
2
+
3
+ [![PyPI](https://img.shields.io/pypi/v/akf)](https://pypi.org/project/akf/)
4
+ [![Python](https://img.shields.io/pypi/pyversions/akf)](https://pypi.org/project/akf/)
5
+
6
+ Lightweight file format for AI-generated knowledge with built-in trust, provenance, and security.
7
+
8
+ ## Install
9
+
10
+ ```bash
11
+ pip install akf
12
+ ```
13
+
14
+ > **`akf` command not found?** Use `python3 -m akf` (always works), or:
15
+ > - Install with pipx: `pipx install akf` (recommended — auto-handles PATH)
16
+ > - macOS: add `export PATH="$HOME/Library/Python/3.9/bin:$PATH"` to `~/.zshrc`
17
+ > - Linux: add `export PATH="$HOME/.local/bin:$PATH"` to `~/.bashrc`
18
+
19
+ ## Usage
20
+
21
+ ```python
22
+ import akf
23
+
24
+ # Create a single-claim unit
25
+ unit = akf.create("Revenue $4.2B", t=0.98, src="SEC 10-Q", tier=1)
26
+ unit.save("report.akf")
27
+
28
+ # Load and validate
29
+ unit = akf.load("report.akf")
30
+ result = akf.validate(unit)
31
+
32
+ # Builder API
33
+ unit = (akf.AKFBuilder()
34
+ .by("sarah@woodgrove.com")
35
+ .label("confidential")
36
+ .claim("Revenue $4.2B", 0.98, src="SEC 10-Q", tier=1, ver=True)
37
+ .claim("Cloud growth 15%", 0.85, src="Gartner", tier=2)
38
+ .build())
39
+
40
+ # Trust computation
41
+ for claim in unit.claims:
42
+ result = akf.effective_trust(claim)
43
+ print(f"{result.decision}: {result.score:.2f}")
44
+
45
+ # Agent consumption
46
+ brief = (akf.AKFTransformer(unit)
47
+ .filter(trust_min=0.5)
48
+ .penalty(-0.03)
49
+ .by("research-agent")
50
+ .build())
51
+ ```
52
+
53
+ ## CLI
54
+
55
+ ```bash
56
+ akf create report.akf --claim "Revenue $4.2B" --trust 0.98
57
+ akf validate report.akf
58
+ akf inspect report.akf
59
+ akf trust report.akf
60
+ akf consume report.akf --output brief.akf --threshold 0.6
61
+ akf provenance report.akf
62
+ ```
@@ -0,0 +1,465 @@
1
+ """AKF — Agent Knowledge Format v1.1.
2
+
3
+ The trust metadata standard for every file AI touches.
4
+
5
+ Usage:
6
+ import akf
7
+
8
+ # Standalone .akf
9
+ unit = akf.create("Revenue $4.2B", confidence=0.98)
10
+ unit.save("out.akf")
11
+
12
+ # Universal: embed into any format
13
+ akf.embed("report.docx", claims=[...], classification="confidential")
14
+ akf.extract("report.docx")
15
+ akf.scan("report.docx")
16
+ akf.info("report.docx")
17
+ """
18
+
19
+ from .models import (
20
+ AKF, Claim, Evidence, Fidelity, ProvHop,
21
+ Origin, GenerationParams, MadeBy, Review, SourceDetail,
22
+ ReasoningChain, Annotation, Freshness, CostMetadata, AgentProfile,
23
+ Calibration, DelegationPolicy,
24
+ )
25
+ from .core import create, create_multi, load, loads, validate, ValidationResult
26
+ from .universal import ConvertResult
27
+ from .builder import AKFBuilder
28
+ from .trust import (
29
+ effective_trust, compute_all, explain_trust, TrustResult, TrustLevel,
30
+ AUTHORITY_WEIGHTS, calibrated_trust, resolve_conflict, trust_summary,
31
+ is_expired, freshness_status,
32
+ )
33
+ from .provenance import add_hop, format_tree, compute_integrity_hash, models_used
34
+ from .security import (
35
+ validate_inheritance, can_share_external, inherit_label, security_score,
36
+ purview_signals, detect_laundering, SecurityScore, SecurityReport,
37
+ check_access, verify_trust_anchor, redaction_report, compute_security_hash,
38
+ full_report,
39
+ )
40
+ from .transform import AKFTransformer
41
+ from .agent import (
42
+ consume, derive, generation_prompt, validate_output,
43
+ response_schema, from_tool_call, to_context, detect,
44
+ )
45
+ from .delegation import delegate, validate_delegation
46
+ from .compliance import (
47
+ audit, check_regulation, audit_trail, verify_human_oversight, AuditResult,
48
+ check_explainability, check_fairness, export_audit, continuous_audit,
49
+ )
50
+ from .view import show, to_html, to_markdown, executive_summary
51
+ from .data import load_dataset, quality_report, merge, filter_claims
52
+ from .report import enterprise_report, EnterpriseReport, FileReport, register_renderer, RENDERERS
53
+ from .knowledge_base import KnowledgeBase
54
+ from .stamp import stamp, stamp_file
55
+ from .certify import (
56
+ certify_file, certify_directory, certify_team,
57
+ CertifyResult, CertifyReport, AgentCertifyReport, TeamCertifyReport,
58
+ parse_junit_xml, parse_evidence_json,
59
+ )
60
+ from .agent_card import (
61
+ AgentCard, AgentRegistry, create_agent_card, verify_agent_card, to_agent_profile,
62
+ )
63
+ from .a2a_bridge import (
64
+ to_a2a_card, from_a2a_card, save_a2a_card, discover_a2a_cards,
65
+ )
66
+ from .git_ops import stamp_commit, read_commit, trust_log
67
+ from .streaming import StreamSession, AKFStream, stream_start, stream_claim, stream_end, collect_stream, iter_stream
68
+ from .team_stream import (
69
+ TeamStreamSession, TeamTrustResult, TeamStream,
70
+ team_stream_start, team_stream_claim, team_stream_end, team_trust_aggregate,
71
+ )
72
+ from .detection import (
73
+ detect_ai_without_review, detect_trust_below_threshold,
74
+ detect_hallucination_risk, detect_knowledge_laundering,
75
+ detect_classification_downgrade, detect_stale_claims,
76
+ detect_ungrounded_claims, detect_trust_degradation_chain,
77
+ detect_excessive_ai_concentration, detect_provenance_gap,
78
+ run_all_detections, DetectionResult, DetectionReport,
79
+ )
80
+ from .i18n import t as translate
81
+
82
+ # Universal format layer — lazy imports to avoid optional dependency issues
83
+ def save(unit, filepath, compact=True):
84
+ """Save an AKF unit to a file."""
85
+ unit.save(filepath, compact=compact)
86
+
87
+
88
+ def embed(filepath, **kwargs):
89
+ """Embed AKF metadata into any supported file format."""
90
+ from .universal import embed as _embed
91
+ return _embed(filepath, **kwargs)
92
+
93
+ def extract(filepath):
94
+ """Extract AKF metadata from any supported file format."""
95
+ from .universal import extract as _extract
96
+ return _extract(filepath)
97
+
98
+ def scan(filepath):
99
+ """Security scan any file for AKF metadata."""
100
+ from .universal import scan as _scan
101
+ return _scan(filepath)
102
+
103
+ def info(filepath):
104
+ """Quick info check on any file's AKF metadata."""
105
+ from .universal import info as _info
106
+ return _info(filepath)
107
+
108
+ def is_enriched(filepath):
109
+ """Check if any file has AKF metadata."""
110
+ from .universal import is_enriched as _is_enriched
111
+ return _is_enriched(filepath)
112
+
113
+ def convert_directory(dirpath, **kwargs):
114
+ """Convert all files in a directory to standalone .akf files."""
115
+ from .universal import convert_directory as _convert_directory
116
+ return _convert_directory(dirpath, **kwargs)
117
+
118
+ def init(path=".", git_hooks=False, agent=None, classification="internal"):
119
+ """Initialize AKF in a project directory.
120
+
121
+ Args:
122
+ path: Project root directory.
123
+ git_hooks: Install post-commit hook for stamp-commit.
124
+ agent: Default AI agent ID.
125
+ classification: Default security classification.
126
+
127
+ Returns:
128
+ Path to created config file.
129
+ """
130
+ import json as _json
131
+ from pathlib import Path as _Path
132
+
133
+ root = _Path(path).resolve()
134
+ akf_dir = root / ".akf"
135
+ akf_dir.mkdir(exist_ok=True)
136
+
137
+ config = {
138
+ "version": "1.0",
139
+ "classification": classification,
140
+ "auto_embed": True,
141
+ }
142
+ if agent:
143
+ config["agent"] = agent
144
+
145
+ config_path = akf_dir / "config.json"
146
+ config_path.write_text(_json.dumps(config, indent=2) + "\n")
147
+
148
+ if git_hooks:
149
+ hooks_dir = root / ".git" / "hooks"
150
+ if hooks_dir.parent.exists():
151
+ hooks_dir.mkdir(exist_ok=True)
152
+ hook = hooks_dir / "post-commit"
153
+ hook.write_text("#!/bin/sh\nakf stamp-commit\n")
154
+ hook.chmod(0o755)
155
+
156
+ return str(config_path)
157
+
158
+
159
+ def stream(output_path=None, *, agent=None, model=None, confidence=0.7, **kwargs):
160
+ """Create a streaming context manager for incremental trust metadata.
161
+
162
+ Usage::
163
+
164
+ with akf.stream("output.md", model="gpt-4o") as s:
165
+ for chunk in llm.generate():
166
+ s.write(chunk)
167
+
168
+ Args:
169
+ output_path: Path for the output file.
170
+ agent: Agent identifier.
171
+ model: AI model identifier.
172
+ confidence: Default confidence for each write.
173
+ **kwargs: Additional stream parameters.
174
+
175
+ Returns:
176
+ AKFStream context manager.
177
+ """
178
+ return AKFStream(output_path, agent=agent, model=model, confidence=confidence, **kwargs)
179
+
180
+
181
+ def keygen(**kwargs):
182
+ """Generate an Ed25519 keypair for signing AKF units."""
183
+ from .signing import keygen as _keygen
184
+ return _keygen(**kwargs)
185
+
186
+ def sign_unit(unit, **kwargs):
187
+ """Sign an AKF unit with an Ed25519 private key."""
188
+ from .signing import sign as _sign
189
+ return _sign(unit, **kwargs)
190
+
191
+ def verify_signature(unit, **kwargs):
192
+ """Verify the Ed25519 signature on an AKF unit."""
193
+ from .signing import verify as _verify
194
+ return _verify(unit, **kwargs)
195
+
196
+ def install(user=True):
197
+ """Activate AKF auto-tracking for all LLM calls in this Python environment.
198
+
199
+ Writes a .pth file so every Python process auto-patches LLM SDKs.
200
+ Use ``akf uninstall`` or ``uninstall()`` to reverse.
201
+
202
+ Args:
203
+ user: Install for current user (True) or system-wide (False).
204
+
205
+ Returns:
206
+ Path to the created .pth file.
207
+ """
208
+ from ._auto import install as _install
209
+ return _install(user=user)
210
+
211
+
212
+ def uninstall():
213
+ """Remove AKF auto-tracking (reverses ``install()``).
214
+
215
+ Returns:
216
+ Path of the removed .pth file, or None if not found.
217
+ """
218
+ from ._auto import uninstall as _uninstall
219
+ return _uninstall()
220
+
221
+
222
+ def track(client, **kwargs):
223
+ """Wrap an LLM client to auto-track model/provider on every API call.
224
+
225
+ Supported: OpenAI, Anthropic, Mistral, Google GenerativeAI.
226
+ For OpenAI-compatible APIs (Groq, Together), pass provider= to override.
227
+
228
+ Usage::
229
+
230
+ client = akf.track(openai.OpenAI())
231
+ response = client.chat.completions.create(model="gpt-4o", ...)
232
+ unit = akf.create("claim", confidence=0.95)
233
+ # unit.origin.model == "gpt-4o" — automatic
234
+ """
235
+ from .tracking import track as _track
236
+ return _track(client, **kwargs)
237
+
238
+
239
+ def get_last_model():
240
+ """Return the last tracked LLM model/provider, or None."""
241
+ from .tracking import get_last_model as _get
242
+ return _get()
243
+
244
+
245
+ def get_tracking_history():
246
+ """Return all tracked LLM calls in this thread."""
247
+ from .tracking import get_tracking_history as _get
248
+ return _get()
249
+
250
+
251
+ def clear_tracking():
252
+ """Reset LLM tracking context."""
253
+ from .tracking import clear_tracking as _clear
254
+ _clear()
255
+
256
+
257
+ def read(filepath):
258
+ """Read AKF trust metadata from any file.
259
+
260
+ Extracts metadata and attempts to parse it as a full AKF model.
261
+
262
+ Args:
263
+ filepath: Path to any supported file.
264
+
265
+ Returns:
266
+ AKF model if parseable, raw metadata dict otherwise, or None.
267
+ """
268
+ from .universal import extract as _extract
269
+
270
+ meta = _extract(filepath)
271
+ if meta is None:
272
+ return None
273
+
274
+ # Try to parse as full AKF model
275
+ try:
276
+ return AKF.model_validate(meta)
277
+ except Exception:
278
+ return meta
279
+
280
+
281
+ __version__ = "1.4.0"
282
+ __all__ = [
283
+ # Models
284
+ "AKF",
285
+ "AKFBuilder",
286
+ "AKFTransformer",
287
+ "AUTHORITY_WEIGHTS",
288
+ "AuditResult",
289
+ "Claim",
290
+ "Evidence",
291
+ "Fidelity",
292
+ "KnowledgeBase",
293
+ "ProvHop",
294
+ "SecurityScore",
295
+ "TrustLevel",
296
+ "TrustResult",
297
+ "ValidationResult",
298
+ "Calibration",
299
+ # v1.1 models
300
+ "Origin",
301
+ "GenerationParams",
302
+ "MadeBy",
303
+ "Review",
304
+ "SourceDetail",
305
+ "ReasoningChain",
306
+ "Annotation",
307
+ "Freshness",
308
+ "CostMetadata",
309
+ "AgentProfile",
310
+ "DelegationPolicy",
311
+ # Delegation
312
+ "delegate",
313
+ "validate_delegation",
314
+ # Core
315
+ "add_hop",
316
+ "can_share_external",
317
+ "compute_all",
318
+ "compute_integrity_hash",
319
+ "create",
320
+ "create_multi",
321
+ "effective_trust",
322
+ "format_tree",
323
+ "models_used",
324
+ "inherit_label",
325
+ "load",
326
+ "loads",
327
+ "save",
328
+ "validate",
329
+ "validate_inheritance",
330
+ # Trust extras
331
+ "explain_trust",
332
+ "calibrated_trust",
333
+ "resolve_conflict",
334
+ "trust_summary",
335
+ "is_expired",
336
+ "freshness_status",
337
+ # Security extras
338
+ "check_access",
339
+ "compute_security_hash",
340
+ "detect_laundering",
341
+ "purview_signals",
342
+ "redaction_report",
343
+ "security_score",
344
+ "SecurityReport",
345
+ "full_report",
346
+ "verify_trust_anchor",
347
+ # Agent
348
+ "consume",
349
+ "derive",
350
+ "detect",
351
+ "from_tool_call",
352
+ "generation_prompt",
353
+ "response_schema",
354
+ "to_context",
355
+ "validate_output",
356
+ # Compliance
357
+ "audit",
358
+ "audit_trail",
359
+ "check_explainability",
360
+ "check_fairness",
361
+ "check_regulation",
362
+ "continuous_audit",
363
+ "export_audit",
364
+ "verify_human_oversight",
365
+ # Streaming
366
+ "AKFStream",
367
+ "StreamSession",
368
+ "collect_stream",
369
+ "iter_stream",
370
+ "stream_claim",
371
+ "stream_end",
372
+ "stream_start",
373
+ # Detection classes
374
+ "DetectionReport",
375
+ "DetectionResult",
376
+ "detect_ai_without_review",
377
+ "detect_classification_downgrade",
378
+ "detect_excessive_ai_concentration",
379
+ "detect_hallucination_risk",
380
+ "detect_knowledge_laundering",
381
+ "detect_provenance_gap",
382
+ "detect_stale_claims",
383
+ "detect_trust_below_threshold",
384
+ "detect_trust_degradation_chain",
385
+ "detect_ungrounded_claims",
386
+ "run_all_detections",
387
+ # Convenience
388
+ "stream",
389
+ # i18n
390
+ "translate",
391
+ # View
392
+ "executive_summary",
393
+ "show",
394
+ "to_html",
395
+ "to_markdown",
396
+ # Data
397
+ "filter_claims",
398
+ "load_dataset",
399
+ "merge",
400
+ "quality_report",
401
+ # Report
402
+ "enterprise_report",
403
+ "EnterpriseReport",
404
+ "FileReport",
405
+ "register_renderer",
406
+ "RENDERERS",
407
+ # Certify
408
+ "certify_file",
409
+ "certify_directory",
410
+ "CertifyResult",
411
+ "CertifyReport",
412
+ "parse_junit_xml",
413
+ "parse_evidence_json",
414
+ # Stamp & Git
415
+ "stamp",
416
+ "stamp_file",
417
+ "stamp_commit",
418
+ "read_commit",
419
+ "trust_log",
420
+ # Signing
421
+ "keygen",
422
+ "sign_unit",
423
+ "verify_signature",
424
+ # Auto-tracking
425
+ "install",
426
+ "uninstall",
427
+ # Tracking
428
+ "track",
429
+ "get_last_model",
430
+ "get_tracking_history",
431
+ "clear_tracking",
432
+ # Universal format layer
433
+ "ConvertResult",
434
+ "convert_directory",
435
+ "embed",
436
+ "extract",
437
+ "info",
438
+ "init",
439
+ "is_enriched",
440
+ "read",
441
+ "scan",
442
+ # Agent Card
443
+ "AgentCard",
444
+ "AgentRegistry",
445
+ "create_agent_card",
446
+ "verify_agent_card",
447
+ "to_agent_profile",
448
+ # A2A Bridge
449
+ "to_a2a_card",
450
+ "from_a2a_card",
451
+ "save_a2a_card",
452
+ "discover_a2a_cards",
453
+ # Team Streaming
454
+ "TeamStreamSession",
455
+ "TeamTrustResult",
456
+ "TeamStream",
457
+ "team_stream_start",
458
+ "team_stream_claim",
459
+ "team_stream_end",
460
+ "team_trust_aggregate",
461
+ # Team Certify
462
+ "certify_team",
463
+ "AgentCertifyReport",
464
+ "TeamCertifyReport",
465
+ ]
@@ -0,0 +1,6 @@
1
+ """Allow running AKF CLI via `python -m akf`."""
2
+
3
+ from akf.cli import main
4
+
5
+ if __name__ == "__main__":
6
+ main()