verilink-sdk 3.7.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.
- verilink_sdk-3.7.0/PKG-INFO +185 -0
- verilink_sdk-3.7.0/README.md +150 -0
- verilink_sdk-3.7.0/pyproject.toml +3 -0
- verilink_sdk-3.7.0/setup.cfg +4 -0
- verilink_sdk-3.7.0/setup.py +56 -0
- verilink_sdk-3.7.0/verilink_sdk/__init__.py +27 -0
- verilink_sdk-3.7.0/verilink_sdk/_check_schemas.py +108 -0
- verilink_sdk-3.7.0/verilink_sdk/_enums.py +146 -0
- verilink_sdk-3.7.0/verilink_sdk/_version.py +7 -0
- verilink_sdk-3.7.0/verilink_sdk/adapters/__init__.py +5 -0
- verilink_sdk-3.7.0/verilink_sdk/adapters/autogen.py +63 -0
- verilink_sdk-3.7.0/verilink_sdk/adapters/crewai.py +45 -0
- verilink_sdk-3.7.0/verilink_sdk/adapters/guardian.py +237 -0
- verilink_sdk-3.7.0/verilink_sdk/adapters/langchain.py +48 -0
- verilink_sdk-3.7.0/verilink_sdk/adapters/openclaw.py +56 -0
- verilink_sdk-3.7.0/verilink_sdk/canonical.py +190 -0
- verilink_sdk-3.7.0/verilink_sdk/client.py +957 -0
- verilink_sdk-3.7.0/verilink_sdk/mcp/__init__.py +3 -0
- verilink_sdk-3.7.0/verilink_sdk/mcp/adapters.py +120 -0
- verilink_sdk-3.7.0/verilink_sdk/mcp/app_views.py +63 -0
- verilink_sdk-3.7.0/verilink_sdk/mcp/cli.py +5 -0
- verilink_sdk-3.7.0/verilink_sdk/mcp/client.py +298 -0
- verilink_sdk-3.7.0/verilink_sdk/mcp/server.py +201 -0
- verilink_sdk-3.7.0/verilink_sdk/mcp/tasks.py +156 -0
- verilink_sdk-3.7.0/verilink_sdk/schemas.py +387 -0
- verilink_sdk-3.7.0/verilink_sdk.egg-info/PKG-INFO +185 -0
- verilink_sdk-3.7.0/verilink_sdk.egg-info/SOURCES.txt +29 -0
- verilink_sdk-3.7.0/verilink_sdk.egg-info/dependency_links.txt +1 -0
- verilink_sdk-3.7.0/verilink_sdk.egg-info/entry_points.txt +2 -0
- verilink_sdk-3.7.0/verilink_sdk.egg-info/requires.txt +14 -0
- verilink_sdk-3.7.0/verilink_sdk.egg-info/top_level.txt +1 -0
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: verilink-sdk
|
|
3
|
+
Version: 3.7.0
|
|
4
|
+
Summary: Python SDK for the VeriLinkOS governed-agent API
|
|
5
|
+
Home-page: https://github.com/rajinderjhol/VeriLinkOS
|
|
6
|
+
License: Proprietary
|
|
7
|
+
Classifier: Programming Language :: Python :: 3
|
|
8
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
9
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
10
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
11
|
+
Classifier: Operating System :: OS Independent
|
|
12
|
+
Classifier: Topic :: Security
|
|
13
|
+
Requires-Python: >=3.10
|
|
14
|
+
Description-Content-Type: text/markdown
|
|
15
|
+
Requires-Dist: httpx>=0.25.0
|
|
16
|
+
Requires-Dist: tenacity>=8.2.0
|
|
17
|
+
Requires-Dist: pydantic>=2.0.0
|
|
18
|
+
Requires-Dist: cryptography>=41.0.0
|
|
19
|
+
Provides-Extra: mcp
|
|
20
|
+
Requires-Dist: mcp>=0.1.0; extra == "mcp"
|
|
21
|
+
Provides-Extra: langchain
|
|
22
|
+
Requires-Dist: langchain-core>=0.1.0; extra == "langchain"
|
|
23
|
+
Provides-Extra: all
|
|
24
|
+
Requires-Dist: mcp>=0.1.0; extra == "all"
|
|
25
|
+
Requires-Dist: langchain-core>=0.1.0; extra == "all"
|
|
26
|
+
Dynamic: classifier
|
|
27
|
+
Dynamic: description
|
|
28
|
+
Dynamic: description-content-type
|
|
29
|
+
Dynamic: home-page
|
|
30
|
+
Dynamic: license
|
|
31
|
+
Dynamic: provides-extra
|
|
32
|
+
Dynamic: requires-dist
|
|
33
|
+
Dynamic: requires-python
|
|
34
|
+
Dynamic: summary
|
|
35
|
+
|
|
36
|
+
# VeriLinkOS Python SDK
|
|
37
|
+
|
|
38
|
+
<div align="center">
|
|
39
|
+
|
|
40
|
+
**The Sovereign Safety Kernel for Autonomous AI Agents**
|
|
41
|
+
|
|
42
|
+
[](LICENSE)
|
|
43
|
+
|
|
44
|
+
> **Installation note:** install from a local checkout or your internal package
|
|
45
|
+
> index. A PyPI release pipeline is in place (`PUBLISHING.md`) but the package is
|
|
46
|
+
> **not published yet** — do not use `pip install verilink-sdk` until the release
|
|
47
|
+
> workflow has succeeded. Its version tracks the server version
|
|
48
|
+
> (`verilink.__version__`).
|
|
49
|
+
|
|
50
|
+
**Trust but Verify.** VeriLinkOS provides cryptographic governance for autonomous AI agents.
|
|
51
|
+
|
|
52
|
+
</div>
|
|
53
|
+
|
|
54
|
+
---
|
|
55
|
+
|
|
56
|
+
## 🚀 Quick Start
|
|
57
|
+
|
|
58
|
+
### Installation
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
# From the repository root — core SDK
|
|
62
|
+
pip install ./sdks/python
|
|
63
|
+
|
|
64
|
+
# With the MCP server/client (Claude Desktop, DeepSeek)
|
|
65
|
+
pip install './sdks/python[mcp]'
|
|
66
|
+
|
|
67
|
+
# With all optional framework dependencies (LangChain core + MCP)
|
|
68
|
+
pip install './sdks/python[all]'
|
|
69
|
+
|
|
70
|
+
# Editable install for development
|
|
71
|
+
pip install -e ./sdks/python
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
Once published (see `PUBLISHING.md`), `pip install verilink-sdk` and
|
|
75
|
+
`pip install 'verilink-sdk[mcp]'` will be available from PyPI.
|
|
76
|
+
|
|
77
|
+
Only `langchain-core` and `mcp` are declared as extras because those are the
|
|
78
|
+
only adapters with third-party imports. The CrewAI, AutoGen and OpenClaw
|
|
79
|
+
adapters are dependency-free wrappers.
|
|
80
|
+
|
|
81
|
+
### 5-Minute Example
|
|
82
|
+
|
|
83
|
+
```python
|
|
84
|
+
import asyncio
|
|
85
|
+
from datetime import datetime, timezone
|
|
86
|
+
from verilink_sdk import VeriLinkClient, enforce
|
|
87
|
+
|
|
88
|
+
async def main():
|
|
89
|
+
# 1. Create client
|
|
90
|
+
async with VeriLinkClient(
|
|
91
|
+
base_url="http://localhost:8000",
|
|
92
|
+
api_key="your-api-key",
|
|
93
|
+
) as client:
|
|
94
|
+
|
|
95
|
+
# 2. Register agent
|
|
96
|
+
agent = await client.register(
|
|
97
|
+
name="My-Agent",
|
|
98
|
+
capabilities=["analysis", "data-processing"],
|
|
99
|
+
)
|
|
100
|
+
print(f"✅ Agent registered: {agent.id}")
|
|
101
|
+
|
|
102
|
+
# 3. Send heartbeat
|
|
103
|
+
await client.heartbeat(agent.id)
|
|
104
|
+
|
|
105
|
+
# 4. Enforce governance with @enforce decorator
|
|
106
|
+
@enforce(action_type="financial_transaction", risk_threshold=2)
|
|
107
|
+
async def execute_payment(amount: float, recipient: str):
|
|
108
|
+
# This code only runs if VeriLinkOS Guardian approves
|
|
109
|
+
return {"status": "success"}
|
|
110
|
+
|
|
111
|
+
# 5. Generate VAP receipt
|
|
112
|
+
receipt = await client.generate_vap_receipt(
|
|
113
|
+
agent_id=agent.id,
|
|
114
|
+
action={"type": "ai_decision", "input_hash": "a"*64},
|
|
115
|
+
decision={"verdict": "allow", "confidence": 99},
|
|
116
|
+
context={"policy_id": "default", "timestamp": datetime.now(timezone.utc).isoformat()},
|
|
117
|
+
)
|
|
118
|
+
print(f"✅ VAP Receipt: {receipt.receipt_id}")
|
|
119
|
+
|
|
120
|
+
asyncio.run(main())
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
---
|
|
124
|
+
|
|
125
|
+
## 📚 Key Features
|
|
126
|
+
|
|
127
|
+
### 🔐 Cryptographic Governance
|
|
128
|
+
- **Ed25519** signing for agent identity and VAP receipts
|
|
129
|
+
- **ML-DSA-87 (NIST FIPS 204)** for post-quantum security
|
|
130
|
+
- **ZK-Range Proofs** for privacy-preserving trust verification
|
|
131
|
+
- **BBS+ Signatures** for selective disclosure
|
|
132
|
+
- **Hybrid Dual-Signatures** (Ed25519 + ML-DSA-87)
|
|
133
|
+
|
|
134
|
+
### 📜 VAP Receipts (Verifiable Action Protocol)
|
|
135
|
+
- Full lifecycle: generate, verify, approve, retrieve
|
|
136
|
+
- HITL (Human-in-the-Loop) approval with polling
|
|
137
|
+
- Local offline receipt creation
|
|
138
|
+
- 7-step verification protocol
|
|
139
|
+
- Merkle tree anchoring
|
|
140
|
+
|
|
141
|
+
### 🏦 x402 Commerce & Escrow
|
|
142
|
+
- Agent-to-agent commerce proposals
|
|
143
|
+
- Trust-weighted escrow contracts
|
|
144
|
+
- Multi-chain settlement (Polygon, Base, Ethereum, Solana)
|
|
145
|
+
- VAP proof-of-delivery verification
|
|
146
|
+
|
|
147
|
+
### 🛡️ Trust Infrastructure
|
|
148
|
+
- **Trust Passports** (W3C DID compliant)
|
|
149
|
+
- **Revocation propagation** (Redis Pub/Sub)
|
|
150
|
+
- **did:mesh** resolution
|
|
151
|
+
- **SPIFFE SVID mTLS** support
|
|
152
|
+
|
|
153
|
+
### 🤖 Framework Adapters
|
|
154
|
+
- **LangChain**: `VeriLinkLangChainCallback` for tool & LLM governance
|
|
155
|
+
- **CrewAI**: `VeriLinkCrewAIGovernor` for task & agent governance
|
|
156
|
+
- **AutoGen**: `VeriLinkAutoGenAdapter` for message interception
|
|
157
|
+
- **OpenClaw**: Middleware for tool execution
|
|
158
|
+
- **Universal `@enforce`**: Zero-config governance decorator
|
|
159
|
+
|
|
160
|
+
### 🔌 MCP Server (Claude Desktop & DeepSeek)
|
|
161
|
+
```json
|
|
162
|
+
{
|
|
163
|
+
"mcpServers": {
|
|
164
|
+
"verilinkos": {
|
|
165
|
+
"command": "verilink-mcp",
|
|
166
|
+
"env": {"VERILINK_API_KEY": "your-key"}
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
```
|
|
171
|
+
- 8 core governance tools
|
|
172
|
+
- Verdict Console UI for HITL approvals
|
|
173
|
+
- Long-running audit tasks (`audit_bom`, `audit_vap`)
|
|
174
|
+
|
|
175
|
+
### 🔄 MCP Client Switchboard
|
|
176
|
+
- Orchestrate third-party MCP servers
|
|
177
|
+
- Governed tool calls with Guardian enforcement
|
|
178
|
+
- Framework adapters for LangChain, CrewAI, AutoGen
|
|
179
|
+
|
|
180
|
+
### 📊 Compliance & Analytics
|
|
181
|
+
- **AI-BOM Verification** with SHA-256 model hashes
|
|
182
|
+
- **Annex G Forensics** for court-admissible evidence
|
|
183
|
+
- **User Outcomes** tracking (`record_user_outcome`)
|
|
184
|
+
- **A/B Testing Metrics** (`record_ab_metric`)
|
|
185
|
+
- **EU AI Act Article 12** logging compliance
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
# VeriLinkOS Python SDK
|
|
2
|
+
|
|
3
|
+
<div align="center">
|
|
4
|
+
|
|
5
|
+
**The Sovereign Safety Kernel for Autonomous AI Agents**
|
|
6
|
+
|
|
7
|
+
[](LICENSE)
|
|
8
|
+
|
|
9
|
+
> **Installation note:** install from a local checkout or your internal package
|
|
10
|
+
> index. A PyPI release pipeline is in place (`PUBLISHING.md`) but the package is
|
|
11
|
+
> **not published yet** — do not use `pip install verilink-sdk` until the release
|
|
12
|
+
> workflow has succeeded. Its version tracks the server version
|
|
13
|
+
> (`verilink.__version__`).
|
|
14
|
+
|
|
15
|
+
**Trust but Verify.** VeriLinkOS provides cryptographic governance for autonomous AI agents.
|
|
16
|
+
|
|
17
|
+
</div>
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
## 🚀 Quick Start
|
|
22
|
+
|
|
23
|
+
### Installation
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
# From the repository root — core SDK
|
|
27
|
+
pip install ./sdks/python
|
|
28
|
+
|
|
29
|
+
# With the MCP server/client (Claude Desktop, DeepSeek)
|
|
30
|
+
pip install './sdks/python[mcp]'
|
|
31
|
+
|
|
32
|
+
# With all optional framework dependencies (LangChain core + MCP)
|
|
33
|
+
pip install './sdks/python[all]'
|
|
34
|
+
|
|
35
|
+
# Editable install for development
|
|
36
|
+
pip install -e ./sdks/python
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
Once published (see `PUBLISHING.md`), `pip install verilink-sdk` and
|
|
40
|
+
`pip install 'verilink-sdk[mcp]'` will be available from PyPI.
|
|
41
|
+
|
|
42
|
+
Only `langchain-core` and `mcp` are declared as extras because those are the
|
|
43
|
+
only adapters with third-party imports. The CrewAI, AutoGen and OpenClaw
|
|
44
|
+
adapters are dependency-free wrappers.
|
|
45
|
+
|
|
46
|
+
### 5-Minute Example
|
|
47
|
+
|
|
48
|
+
```python
|
|
49
|
+
import asyncio
|
|
50
|
+
from datetime import datetime, timezone
|
|
51
|
+
from verilink_sdk import VeriLinkClient, enforce
|
|
52
|
+
|
|
53
|
+
async def main():
|
|
54
|
+
# 1. Create client
|
|
55
|
+
async with VeriLinkClient(
|
|
56
|
+
base_url="http://localhost:8000",
|
|
57
|
+
api_key="your-api-key",
|
|
58
|
+
) as client:
|
|
59
|
+
|
|
60
|
+
# 2. Register agent
|
|
61
|
+
agent = await client.register(
|
|
62
|
+
name="My-Agent",
|
|
63
|
+
capabilities=["analysis", "data-processing"],
|
|
64
|
+
)
|
|
65
|
+
print(f"✅ Agent registered: {agent.id}")
|
|
66
|
+
|
|
67
|
+
# 3. Send heartbeat
|
|
68
|
+
await client.heartbeat(agent.id)
|
|
69
|
+
|
|
70
|
+
# 4. Enforce governance with @enforce decorator
|
|
71
|
+
@enforce(action_type="financial_transaction", risk_threshold=2)
|
|
72
|
+
async def execute_payment(amount: float, recipient: str):
|
|
73
|
+
# This code only runs if VeriLinkOS Guardian approves
|
|
74
|
+
return {"status": "success"}
|
|
75
|
+
|
|
76
|
+
# 5. Generate VAP receipt
|
|
77
|
+
receipt = await client.generate_vap_receipt(
|
|
78
|
+
agent_id=agent.id,
|
|
79
|
+
action={"type": "ai_decision", "input_hash": "a"*64},
|
|
80
|
+
decision={"verdict": "allow", "confidence": 99},
|
|
81
|
+
context={"policy_id": "default", "timestamp": datetime.now(timezone.utc).isoformat()},
|
|
82
|
+
)
|
|
83
|
+
print(f"✅ VAP Receipt: {receipt.receipt_id}")
|
|
84
|
+
|
|
85
|
+
asyncio.run(main())
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
---
|
|
89
|
+
|
|
90
|
+
## 📚 Key Features
|
|
91
|
+
|
|
92
|
+
### 🔐 Cryptographic Governance
|
|
93
|
+
- **Ed25519** signing for agent identity and VAP receipts
|
|
94
|
+
- **ML-DSA-87 (NIST FIPS 204)** for post-quantum security
|
|
95
|
+
- **ZK-Range Proofs** for privacy-preserving trust verification
|
|
96
|
+
- **BBS+ Signatures** for selective disclosure
|
|
97
|
+
- **Hybrid Dual-Signatures** (Ed25519 + ML-DSA-87)
|
|
98
|
+
|
|
99
|
+
### 📜 VAP Receipts (Verifiable Action Protocol)
|
|
100
|
+
- Full lifecycle: generate, verify, approve, retrieve
|
|
101
|
+
- HITL (Human-in-the-Loop) approval with polling
|
|
102
|
+
- Local offline receipt creation
|
|
103
|
+
- 7-step verification protocol
|
|
104
|
+
- Merkle tree anchoring
|
|
105
|
+
|
|
106
|
+
### 🏦 x402 Commerce & Escrow
|
|
107
|
+
- Agent-to-agent commerce proposals
|
|
108
|
+
- Trust-weighted escrow contracts
|
|
109
|
+
- Multi-chain settlement (Polygon, Base, Ethereum, Solana)
|
|
110
|
+
- VAP proof-of-delivery verification
|
|
111
|
+
|
|
112
|
+
### 🛡️ Trust Infrastructure
|
|
113
|
+
- **Trust Passports** (W3C DID compliant)
|
|
114
|
+
- **Revocation propagation** (Redis Pub/Sub)
|
|
115
|
+
- **did:mesh** resolution
|
|
116
|
+
- **SPIFFE SVID mTLS** support
|
|
117
|
+
|
|
118
|
+
### 🤖 Framework Adapters
|
|
119
|
+
- **LangChain**: `VeriLinkLangChainCallback` for tool & LLM governance
|
|
120
|
+
- **CrewAI**: `VeriLinkCrewAIGovernor` for task & agent governance
|
|
121
|
+
- **AutoGen**: `VeriLinkAutoGenAdapter` for message interception
|
|
122
|
+
- **OpenClaw**: Middleware for tool execution
|
|
123
|
+
- **Universal `@enforce`**: Zero-config governance decorator
|
|
124
|
+
|
|
125
|
+
### 🔌 MCP Server (Claude Desktop & DeepSeek)
|
|
126
|
+
```json
|
|
127
|
+
{
|
|
128
|
+
"mcpServers": {
|
|
129
|
+
"verilinkos": {
|
|
130
|
+
"command": "verilink-mcp",
|
|
131
|
+
"env": {"VERILINK_API_KEY": "your-key"}
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
```
|
|
136
|
+
- 8 core governance tools
|
|
137
|
+
- Verdict Console UI for HITL approvals
|
|
138
|
+
- Long-running audit tasks (`audit_bom`, `audit_vap`)
|
|
139
|
+
|
|
140
|
+
### 🔄 MCP Client Switchboard
|
|
141
|
+
- Orchestrate third-party MCP servers
|
|
142
|
+
- Governed tool calls with Guardian enforcement
|
|
143
|
+
- Framework adapters for LangChain, CrewAI, AutoGen
|
|
144
|
+
|
|
145
|
+
### 📊 Compliance & Analytics
|
|
146
|
+
- **AI-BOM Verification** with SHA-256 model hashes
|
|
147
|
+
- **Annex G Forensics** for court-admissible evidence
|
|
148
|
+
- **User Outcomes** tracking (`record_user_outcome`)
|
|
149
|
+
- **A/B Testing Metrics** (`record_ab_metric`)
|
|
150
|
+
- **EU AI Act Article 12** logging compliance
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
from pathlib import Path
|
|
2
|
+
|
|
3
|
+
from setuptools import find_packages, setup
|
|
4
|
+
|
|
5
|
+
# The version lives inside the package so `python -m build` works in PyPI's
|
|
6
|
+
# isolated environment, where the server repository is not available. A
|
|
7
|
+
# regression test asserts it matches the server version; bump both together.
|
|
8
|
+
VERSION_FILE = Path(__file__).resolve().parent / "verilink_sdk" / "_version.py"
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
def _server_version() -> str:
|
|
12
|
+
for line in VERSION_FILE.read_text(encoding="utf-8").splitlines():
|
|
13
|
+
if line.startswith("__version__"):
|
|
14
|
+
return line.split("=", 1)[1].strip().strip('"\'')
|
|
15
|
+
raise RuntimeError("SDK version not found")
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
README = Path(__file__).with_name("README.md")
|
|
19
|
+
|
|
20
|
+
setup(
|
|
21
|
+
name="verilink-sdk",
|
|
22
|
+
version=_server_version(),
|
|
23
|
+
description="Python SDK for the VeriLinkOS governed-agent API",
|
|
24
|
+
long_description=README.read_text(encoding="utf-8"),
|
|
25
|
+
long_description_content_type="text/markdown",
|
|
26
|
+
url="https://github.com/rajinderjhol/VeriLinkOS",
|
|
27
|
+
license="Proprietary",
|
|
28
|
+
classifiers=[
|
|
29
|
+
"Programming Language :: Python :: 3",
|
|
30
|
+
"Programming Language :: Python :: 3.10",
|
|
31
|
+
"Programming Language :: Python :: 3.11",
|
|
32
|
+
"Programming Language :: Python :: 3.12",
|
|
33
|
+
"Operating System :: OS Independent",
|
|
34
|
+
"Topic :: Security",
|
|
35
|
+
],
|
|
36
|
+
python_requires=">=3.10",
|
|
37
|
+
packages=find_packages(),
|
|
38
|
+
install_requires=[
|
|
39
|
+
"httpx>=0.25.0",
|
|
40
|
+
"tenacity>=8.2.0",
|
|
41
|
+
"pydantic>=2.0.0",
|
|
42
|
+
"cryptography>=41.0.0",
|
|
43
|
+
],
|
|
44
|
+
extras_require={
|
|
45
|
+
# MCP server/client (Claude Desktop, DeepSeek, stdio transport).
|
|
46
|
+
"mcp": ["mcp>=0.1.0"],
|
|
47
|
+
# Framework adapters that need optional third-party packages.
|
|
48
|
+
"langchain": ["langchain-core>=0.1.0"],
|
|
49
|
+
"all": ["mcp>=0.1.0", "langchain-core>=0.1.0"],
|
|
50
|
+
},
|
|
51
|
+
entry_points={
|
|
52
|
+
"console_scripts": [
|
|
53
|
+
"verilink-mcp = verilink_sdk.mcp.cli:main",
|
|
54
|
+
],
|
|
55
|
+
},
|
|
56
|
+
)
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
from .client import VeriLinkClient, VAPReceiptBuilder
|
|
2
|
+
from .schemas import *
|
|
3
|
+
from .adapters.guardian import (
|
|
4
|
+
enforce,
|
|
5
|
+
preflight,
|
|
6
|
+
PreflightBlocked,
|
|
7
|
+
set_active_client,
|
|
8
|
+
get_active_client,
|
|
9
|
+
set_client,
|
|
10
|
+
get_client,
|
|
11
|
+
)
|
|
12
|
+
|
|
13
|
+
# Backward compatibility alias
|
|
14
|
+
VeriLinkSDKClient = VeriLinkClient
|
|
15
|
+
|
|
16
|
+
__all__ = [
|
|
17
|
+
"VeriLinkClient",
|
|
18
|
+
"VeriLinkSDKClient",
|
|
19
|
+
"VAPReceiptBuilder",
|
|
20
|
+
"enforce",
|
|
21
|
+
"preflight",
|
|
22
|
+
"PreflightBlocked",
|
|
23
|
+
"set_active_client",
|
|
24
|
+
"get_active_client",
|
|
25
|
+
"set_client",
|
|
26
|
+
"get_client"
|
|
27
|
+
]
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
"""Pre-flight check schemas, vendored from verilink.schemas.core.
|
|
2
|
+
|
|
3
|
+
Kept in the SDK so the published wheel has no dependency on the server package.
|
|
4
|
+
"""
|
|
5
|
+
from typing import Any, Dict, List, Optional
|
|
6
|
+
from datetime import datetime
|
|
7
|
+
from enum import Enum
|
|
8
|
+
from pydantic import BaseModel, Field, ConfigDict
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class CheckActionabilityOptions(BaseModel):
|
|
12
|
+
"""Optional flags controlling check_actionability behavior."""
|
|
13
|
+
explain: bool = True
|
|
14
|
+
check_claims: bool = True
|
|
15
|
+
estimate_cost: bool = True
|
|
16
|
+
return_receipt: bool = True
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
class CheckActionabilityRequest(BaseModel):
|
|
20
|
+
"""Input for the public pre-flight check."""
|
|
21
|
+
action: Dict[str, Any] = Field(..., description="Full action: type + inputs")
|
|
22
|
+
agent: Optional[Dict[str, Any]] = Field(None, description="Agent DID + capabilities")
|
|
23
|
+
organization: Optional[Dict[str, Any]] = Field(None, description="Org id + policy_version")
|
|
24
|
+
options: Optional[CheckActionabilityOptions] = Field(
|
|
25
|
+
default_factory=CheckActionabilityOptions,
|
|
26
|
+
description="Optional behavior flags",
|
|
27
|
+
)
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
class MissingClaim(BaseModel):
|
|
31
|
+
"""A claim the agent must satisfy to make the action actionable."""
|
|
32
|
+
claim_id: str = Field(..., description="Stable identifier for the claim")
|
|
33
|
+
type: str = Field(..., description="human_approval | regulatory | technical | evidence | delegation")
|
|
34
|
+
description: str = Field(..., description="Human-readable description of what's required")
|
|
35
|
+
how_to_satisfy: str = Field(..., description="Specific action the agent can take")
|
|
36
|
+
priority: str = Field(..., description="blocking | warning")
|
|
37
|
+
endpoint: Optional[str] = Field(None, description="API endpoint or CLI command to satisfy")
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
class EstimatedCost(BaseModel):
|
|
41
|
+
"""Estimated cost of executing (or attempting) the action."""
|
|
42
|
+
tokens: int = Field(0, ge=0, description="Estimated token consumption")
|
|
43
|
+
rep_impact: float = Field(0.0, description="Estimated reputation change (negative = loss)")
|
|
44
|
+
rep_impact_reason: Optional[str] = Field(None, description="Why the reputation moves")
|
|
45
|
+
api_cost_usd: float = Field(0.0, ge=0.0, description="Estimated API cost in USD")
|
|
46
|
+
est_execution_time_ms: int = Field(0, ge=0, description="Estimated execution time")
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
class ReasoningStep(BaseModel):
|
|
50
|
+
"""One step in the decision reasoning path."""
|
|
51
|
+
step: int = Field(..., ge=1)
|
|
52
|
+
check: str = Field(..., description="e.g. agent_revocation | delegation_scope | policy_evaluation")
|
|
53
|
+
result: str = Field(..., description="clean | valid | blocked | escalated | unknown")
|
|
54
|
+
note: Optional[str] = None
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
class NextStep(BaseModel):
|
|
58
|
+
"""A concrete next step the agent can take."""
|
|
59
|
+
action: str = Field(..., description="reduce_amount | request_extension | escalate_hitl | wait_until | ...")
|
|
60
|
+
description: str = Field(..., description="Human-readable description of the option")
|
|
61
|
+
endpoint: Optional[str] = Field(None, description="API endpoint for this option")
|
|
62
|
+
example: Optional[Dict[str, Any]] = Field(None, description="Example payload")
|
|
63
|
+
retry_after: Optional[datetime] = Field(None, description="When to retry (time-based blocks)")
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
class CheckActionabilityVerdict(BaseModel):
|
|
67
|
+
"""The verdict — multiple views for different consumers."""
|
|
68
|
+
is_actionable: bool = Field(..., description="Headline answer: is this actionable?")
|
|
69
|
+
allowed: bool = Field(..., description="Would enforce() permit this?")
|
|
70
|
+
block_risk: bool = Field(..., description="Is there a risk of block?")
|
|
71
|
+
requires_hitl: bool = Field(False, description="Would this require human approval?")
|
|
72
|
+
execution_status: str = Field(..., description="allowed | blocked | pending")
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
class CheckActionabilityResponse(BaseModel):
|
|
76
|
+
"""Output for the public pre-flight check."""
|
|
77
|
+
# Identification
|
|
78
|
+
check_id: str = Field(..., description="Unique ID for this check")
|
|
79
|
+
receipt_id: Optional[str] = Field(None, description="ID of the self-contained signed receipt for this check (not persisted)")
|
|
80
|
+
receipt_url: Optional[str] = Field(None, description="Always null: the zero-side-effect check does not persist a retrievable receipt")
|
|
81
|
+
checked_at: datetime = Field(default_factory=lambda: datetime.now(timezone.utc))
|
|
82
|
+
latency_ms: float = Field(0.0, ge=0.0, description="Server-side evaluation latency")
|
|
83
|
+
|
|
84
|
+
# Verdict (nested)
|
|
85
|
+
verdict: CheckActionabilityVerdict
|
|
86
|
+
|
|
87
|
+
# Reason
|
|
88
|
+
block_reason: Optional[str] = Field(None, description="Short reason if blocked")
|
|
89
|
+
counterfactual: Optional[str] = Field(None, description="What would have made this actionable")
|
|
90
|
+
rule_id: Optional[str] = Field(None, description="The rule that blocked, if any")
|
|
91
|
+
|
|
92
|
+
# Roadmap to success
|
|
93
|
+
missing_claims: List[MissingClaim] = Field(default_factory=list)
|
|
94
|
+
next_steps: List[NextStep] = Field(default_factory=list)
|
|
95
|
+
|
|
96
|
+
# Cost
|
|
97
|
+
estimated_cost: Optional[EstimatedCost] = None
|
|
98
|
+
|
|
99
|
+
# Legibility
|
|
100
|
+
reasoning_path: List[ReasoningStep] = Field(default_factory=list)
|
|
101
|
+
constraints_checked: List[Dict[str, Any]] = Field(default_factory=list)
|
|
102
|
+
|
|
103
|
+
# Proof
|
|
104
|
+
receipt: Optional[Dict[str, Any]] = Field(None, description="Full Ed25519-signed VAP receipt for the check itself, returned inline; not persisted")
|
|
105
|
+
|
|
106
|
+
# Risk & applicability
|
|
107
|
+
risk_tier: int = Field(1, ge=1, le=5)
|
|
108
|
+
applicability_domain: Optional[Dict[str, Any]] = None
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
"""Enums needed by SDK schemas, vendored from verilink.enums.
|
|
2
|
+
|
|
3
|
+
Kept in the SDK so the published wheel has no dependency on the server package.
|
|
4
|
+
Regenerate from verilink/enums.py when the wire contract changes; the parity test
|
|
5
|
+
in tests/test_sdk_packaging.py guards the critical values.
|
|
6
|
+
"""
|
|
7
|
+
from enum import Enum
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class VAPActionType(str, Enum):
|
|
11
|
+
link_check = "link_check"
|
|
12
|
+
message_forward = "message_forward"
|
|
13
|
+
ai_decision = "ai_decision"
|
|
14
|
+
datacenter_attestation = "datacenter_attestation"
|
|
15
|
+
custom_action = "custom_action"
|
|
16
|
+
custom = "custom"
|
|
17
|
+
contract_created = "contract_created"
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
# Asset Protection
|
|
21
|
+
identity_registered = "identity_registered"
|
|
22
|
+
emblem_issued = "emblem_issued"
|
|
23
|
+
authority_endorsed = "authority_endorsed"
|
|
24
|
+
integrity_verified = "integrity_verified"
|
|
25
|
+
incident_reported = "incident_reported"
|
|
26
|
+
forensic_package_generated = "forensic_package_generated"
|
|
27
|
+
protection_renewed = "protection_renewed"
|
|
28
|
+
configuration_published = "configuration_published"
|
|
29
|
+
protection_revoked = "protection_revoked"
|
|
30
|
+
agent_bound = "agent_bound"
|
|
31
|
+
|
|
32
|
+
# Bootstrap / Common
|
|
33
|
+
monitoring = "monitoring"
|
|
34
|
+
financial = "financial"
|
|
35
|
+
data_access = "data_access"
|
|
36
|
+
|
|
37
|
+
# Agent-native action types (added for policy simulation)
|
|
38
|
+
financial_transfer = "financial_transfer"
|
|
39
|
+
read = "read"
|
|
40
|
+
memory_write = "memory_write"
|
|
41
|
+
|
|
42
|
+
# Platform
|
|
43
|
+
agent_disposition = "agent_disposition" # Internal platform decision receipt
|
|
44
|
+
credential_finding = "credential_finding"
|
|
45
|
+
code_leak_finding = "code_leak_finding"
|
|
46
|
+
|
|
47
|
+
# High-risk actions requiring HITL
|
|
48
|
+
wire_transfer = "wire_transfer"
|
|
49
|
+
data_export = "data_export"
|
|
50
|
+
delete_db = "delete_db"
|
|
51
|
+
agent_handoff = "agent_handoff"
|
|
52
|
+
parametric_claim = "parametric_claim"
|
|
53
|
+
payment_settlement = "payment_settlement"
|
|
54
|
+
mcp_invoke = "mcp_invoke"
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
class VAPDecisionVerdict(str, Enum):
|
|
58
|
+
allow = "allow"
|
|
59
|
+
block = "block"
|
|
60
|
+
warn = "warn"
|
|
61
|
+
defer = "defer"
|
|
62
|
+
attest_pass = "attest_pass"
|
|
63
|
+
attest_fail = "attest_fail"
|
|
64
|
+
custom = "custom"
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
class VAPActorType(str, Enum):
|
|
68
|
+
agent = "agent"
|
|
69
|
+
user = "user"
|
|
70
|
+
system = "system"
|
|
71
|
+
unknown = "unknown"
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
class VAPSector(str, Enum):
|
|
75
|
+
finance = "finance"
|
|
76
|
+
healthcare = "healthcare"
|
|
77
|
+
information = "information"
|
|
78
|
+
national_security = "national_security"
|
|
79
|
+
it = "it"
|
|
80
|
+
other = "other"
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
class AIBOMStatus(str, Enum):
|
|
84
|
+
DRAFT = "draft"
|
|
85
|
+
SIGNED = "signed"
|
|
86
|
+
VERIFIED = "verified"
|
|
87
|
+
COMPROMISED = "compromised"
|
|
88
|
+
EXPIRED = "expired"
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
class IncidentSeverity(str, Enum):
|
|
92
|
+
CRITICAL = "critical"
|
|
93
|
+
HIGH = "high"
|
|
94
|
+
MEDIUM = "medium"
|
|
95
|
+
LOW = "low"
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
class AssetType(str, Enum):
|
|
99
|
+
"""NEW: Types of digital assets that can be protected."""
|
|
100
|
+
URL = "url"
|
|
101
|
+
DOMAIN = "domain"
|
|
102
|
+
IP = "ip"
|
|
103
|
+
WILDCARD = "wildcard"
|
|
104
|
+
QR_CODE = "qr_code"
|
|
105
|
+
INFRASTRUCTURE = "infrastructure"
|
|
106
|
+
SERVER = "server"
|
|
107
|
+
NETWORK = "network"
|
|
108
|
+
AI_MODEL = "ai_model"
|
|
109
|
+
CULTURAL_HERITAGE = "cultural_heritage"
|
|
110
|
+
TREATY = "treaty"
|
|
111
|
+
LEGAL_DOCUMENT = "legal_document"
|
|
112
|
+
CONTRACT = "contract"
|
|
113
|
+
WALLET = "wallet"
|
|
114
|
+
TRANSACTION = "transaction"
|
|
115
|
+
INSURANCE_POLICY = "insurance_policy"
|
|
116
|
+
PATIENT_RECORD = "patient_record"
|
|
117
|
+
PRESCRIPTION = "prescription"
|
|
118
|
+
CONSENT = "consent"
|
|
119
|
+
IDENTITY = "identity"
|
|
120
|
+
CREDENTIAL = "credential"
|
|
121
|
+
DIGITAL_ART = "digital_art"
|
|
122
|
+
PHYSICAL_ASSET = "physical_asset"
|
|
123
|
+
CUSTOM = "custom"
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
class DiscoveryPath(str, Enum):
|
|
127
|
+
"""NEW: Discovery paths for asset attestations."""
|
|
128
|
+
DNS_TXT = "dns_txt"
|
|
129
|
+
WELL_KNOWN = "well_known"
|
|
130
|
+
HTTP_HEADER = "header"
|
|
131
|
+
TLSA = "tlsa"
|
|
132
|
+
HTTPS = "https"
|
|
133
|
+
UDP = "udp"
|
|
134
|
+
TLS = "tls"
|
|
135
|
+
QR = "qr"
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
class ReceiptStatus(str, Enum):
|
|
139
|
+
"""MGF Alignment: Formal lifecycle of a VAP action from permit to settlement."""
|
|
140
|
+
PENDING = "pending"
|
|
141
|
+
PERMIT_GRANTED = "permit_granted"
|
|
142
|
+
EXECUTING = "executing"
|
|
143
|
+
SETTLEMENT_COMPLETE = "settlement_complete"
|
|
144
|
+
SETTLEMENT_FAILED = "settlement_failed"
|
|
145
|
+
BLOCKED = "blocked"
|
|
146
|
+
AUTOMATED = "automated"
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"""SDK release version.
|
|
2
|
+
|
|
3
|
+
Baked into the package so `python -m build` works in PyPI's isolated build
|
|
4
|
+
environment, where the server repository is not present. tests/test_sdk_packaging.py
|
|
5
|
+
asserts this matches the server's verilink.__version__; bump both together.
|
|
6
|
+
"""
|
|
7
|
+
__version__ = "3.7.0"
|