faramesh-sdk 0.3.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.
- faramesh_sdk-0.3.0/LICENSE +84 -0
- faramesh_sdk-0.3.0/PKG-INFO +169 -0
- faramesh_sdk-0.3.0/README.md +153 -0
- faramesh_sdk-0.3.0/faramesh/__init__.py +178 -0
- faramesh_sdk-0.3.0/faramesh/canonicalization.py +281 -0
- faramesh_sdk-0.3.0/faramesh/client.py +1319 -0
- faramesh_sdk-0.3.0/faramesh/decorators.py +154 -0
- faramesh_sdk-0.3.0/faramesh/gate.py +377 -0
- faramesh_sdk-0.3.0/faramesh/governed_tool.py +101 -0
- faramesh_sdk-0.3.0/faramesh/policy.py +224 -0
- faramesh_sdk-0.3.0/faramesh/policy_helpers.py +139 -0
- faramesh_sdk-0.3.0/faramesh/snapshot.py +86 -0
- faramesh_sdk-0.3.0/faramesh_sdk.egg-info/PKG-INFO +169 -0
- faramesh_sdk-0.3.0/faramesh_sdk.egg-info/SOURCES.txt +18 -0
- faramesh_sdk-0.3.0/faramesh_sdk.egg-info/dependency_links.txt +1 -0
- faramesh_sdk-0.3.0/faramesh_sdk.egg-info/requires.txt +6 -0
- faramesh_sdk-0.3.0/faramesh_sdk.egg-info/top_level.txt +3 -0
- faramesh_sdk-0.3.0/pyproject.toml +37 -0
- faramesh_sdk-0.3.0/setup.cfg +4 -0
- faramesh_sdk-0.3.0/tests/test_canonicalization.py +249 -0
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
Elastic License 2.0
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 Faramesh Contributors
|
|
4
|
+
|
|
5
|
+
This Elastic License 2.0 (the "License") sets forth the terms on which the
|
|
6
|
+
software identified above ("Software") may be used. Any use of the Software
|
|
7
|
+
other than as expressly set forth herein is prohibited.
|
|
8
|
+
|
|
9
|
+
1. Grant of Rights
|
|
10
|
+
|
|
11
|
+
Subject to the terms of this License, you are granted a non-exclusive,
|
|
12
|
+
non-transferable, non-sublicensable, limited license to use, copy,
|
|
13
|
+
distribute, make available, and prepare derivative works of the Software,
|
|
14
|
+
in each case solely for your internal business purposes or for the purpose
|
|
15
|
+
of developing, testing, or running your applications and services.
|
|
16
|
+
|
|
17
|
+
2. Restrictions
|
|
18
|
+
|
|
19
|
+
You may not:
|
|
20
|
+
|
|
21
|
+
(a) provide the Software to third parties as a managed, hosted, or
|
|
22
|
+
network-accessible service where the primary value of the service is
|
|
23
|
+
the Software itself;
|
|
24
|
+
|
|
25
|
+
(b) sell, offer for sale, or otherwise make the Software available as a
|
|
26
|
+
product or service that competes with the Software or any substantially
|
|
27
|
+
similar product or service offered by the licensor; or
|
|
28
|
+
|
|
29
|
+
(c) remove, obscure, or alter any copyright, trademark, or other
|
|
30
|
+
proprietary notices contained in the Software.
|
|
31
|
+
|
|
32
|
+
3. Compliance with Laws
|
|
33
|
+
|
|
34
|
+
You must comply with all applicable laws and regulations, including export
|
|
35
|
+
control laws and regulations of the United States and other relevant
|
|
36
|
+
jurisdictions, in your use of the Software.
|
|
37
|
+
|
|
38
|
+
4. No Trademark License
|
|
39
|
+
|
|
40
|
+
This License does not grant you any right in or to any trademarks, service
|
|
41
|
+
marks, or trade names of the licensor or its affiliates.
|
|
42
|
+
|
|
43
|
+
5. Disclaimer of Warranty
|
|
44
|
+
|
|
45
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND WITHOUT WARRANTY OF ANY KIND, WHETHER
|
|
46
|
+
EXPRESS, IMPLIED, STATUTORY, OR OTHERWISE, INCLUDING WITHOUT LIMITATION ANY
|
|
47
|
+
WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR
|
|
48
|
+
NON-INFRINGEMENT. THE ENTIRE RISK ARISING OUT OF THE USE OR PERFORMANCE OF
|
|
49
|
+
THE SOFTWARE REMAINS WITH YOU.
|
|
50
|
+
|
|
51
|
+
6. Limitation of Liability
|
|
52
|
+
|
|
53
|
+
TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, IN NO EVENT SHALL THE
|
|
54
|
+
LICENSOR OR ITS AFFILIATES BE LIABLE FOR ANY INDIRECT, INCIDENTAL,
|
|
55
|
+
SPECIAL, CONSEQUENTIAL, OR PUNITIVE DAMAGES, OR ANY LOSS OF PROFITS OR
|
|
56
|
+
REVENUE, ARISING OUT OF OR IN CONNECTION WITH THIS LICENSE OR THE USE OR
|
|
57
|
+
INABILITY TO USE THE SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
|
|
58
|
+
DAMAGES.
|
|
59
|
+
|
|
60
|
+
7. Termination
|
|
61
|
+
|
|
62
|
+
This License is effective until terminated. Your rights under this License
|
|
63
|
+
will terminate automatically without notice if you fail to comply with any
|
|
64
|
+
term(s) of this License. Upon termination, you must cease all use of the
|
|
65
|
+
Software and destroy all copies in your possession or control.
|
|
66
|
+
|
|
67
|
+
8. Third-Party Components
|
|
68
|
+
|
|
69
|
+
The Software may include or be distributed with third-party software
|
|
70
|
+
components that are separately licensed. Your use of such components is
|
|
71
|
+
subject to the terms and conditions of the applicable third-party licenses.
|
|
72
|
+
|
|
73
|
+
9. Governing Law
|
|
74
|
+
|
|
75
|
+
This License shall be governed by and construed in accordance with the
|
|
76
|
+
laws of the State of California, without regard to its conflict of laws
|
|
77
|
+
principles.
|
|
78
|
+
|
|
79
|
+
10. Entire Agreement
|
|
80
|
+
|
|
81
|
+
This License constitutes the entire agreement between you and the licensor
|
|
82
|
+
with respect to the Software and supersedes all prior or contemporaneous
|
|
83
|
+
understandings regarding such subject matter.
|
|
84
|
+
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: faramesh-sdk
|
|
3
|
+
Version: 0.3.0
|
|
4
|
+
Summary: Faramesh Python SDK - Production-ready client for the Faramesh Execution Governor API
|
|
5
|
+
Author: Faramesh Contributors
|
|
6
|
+
License: Elastic License 2.0
|
|
7
|
+
Requires-Python: >=3.9
|
|
8
|
+
Description-Content-Type: text/markdown
|
|
9
|
+
License-File: LICENSE
|
|
10
|
+
Requires-Dist: requests>=2.31
|
|
11
|
+
Provides-Extra: dev
|
|
12
|
+
Requires-Dist: pytest>=7.4; extra == "dev"
|
|
13
|
+
Requires-Dist: pytest-asyncio>=0.21; extra == "dev"
|
|
14
|
+
Requires-Dist: ruff>=0.3; extra == "dev"
|
|
15
|
+
Dynamic: license-file
|
|
16
|
+
|
|
17
|
+
# Faramesh Python SDK
|
|
18
|
+
|
|
19
|
+
Production-ready Python client for the Faramesh Execution Governor API.
|
|
20
|
+
|
|
21
|
+
## Installation
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
pip install faramesh-sdk
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
Or install from source:
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
git clone https://github.com/faramesh/faramesh-python-sdk.git
|
|
31
|
+
cd faramesh-python-sdk
|
|
32
|
+
pip install -e .
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Quick Start
|
|
36
|
+
|
|
37
|
+
```python
|
|
38
|
+
from faramesh import configure, submit_action, approve_action
|
|
39
|
+
|
|
40
|
+
# Configure SDK (optional - defaults to http://127.0.0.1:8000)
|
|
41
|
+
configure(
|
|
42
|
+
base_url="http://localhost:8000",
|
|
43
|
+
token="your-token", # Optional, can also use FARAMESH_TOKEN env var
|
|
44
|
+
)
|
|
45
|
+
|
|
46
|
+
# Submit an action
|
|
47
|
+
action = submit_action(
|
|
48
|
+
agent_id="my-agent",
|
|
49
|
+
tool="http",
|
|
50
|
+
operation="get",
|
|
51
|
+
params={"url": "https://example.com"}
|
|
52
|
+
)
|
|
53
|
+
|
|
54
|
+
print(f"Action {action.id} status: {action.status}")
|
|
55
|
+
|
|
56
|
+
# If action requires approval
|
|
57
|
+
if action.status == "pending_approval":
|
|
58
|
+
approved = approve_action(
|
|
59
|
+
action.id,
|
|
60
|
+
action.approval_token,
|
|
61
|
+
reason="Looks safe"
|
|
62
|
+
)
|
|
63
|
+
print(f"Action approved: {approved.status}")
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
## Features
|
|
67
|
+
|
|
68
|
+
- **Simple API**: Easy-to-use functions for all API operations
|
|
69
|
+
- **Batch Operations**: Submit multiple actions at once
|
|
70
|
+
- **Submit and Wait**: Automatically wait for action completion
|
|
71
|
+
- **Policy Building**: Build policies in Python code
|
|
72
|
+
- **Deterministic Hashing**: Client-side request_hash computation
|
|
73
|
+
- **Gate Endpoint**: Pre-check decisions without creating actions
|
|
74
|
+
- **Replay Helpers**: Verify decision determinism
|
|
75
|
+
- **Error Handling**: Typed exceptions for all error cases
|
|
76
|
+
|
|
77
|
+
## Gate Endpoint & Deterministic Hashing
|
|
78
|
+
|
|
79
|
+
The SDK provides helpers for deterministic decision verification:
|
|
80
|
+
|
|
81
|
+
### Compute Request Hash Locally
|
|
82
|
+
|
|
83
|
+
```python
|
|
84
|
+
from faramesh import compute_request_hash
|
|
85
|
+
|
|
86
|
+
payload = {
|
|
87
|
+
"agent_id": "my-agent",
|
|
88
|
+
"tool": "http",
|
|
89
|
+
"operation": "get",
|
|
90
|
+
"params": {"url": "https://example.com"},
|
|
91
|
+
"context": {}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
# Compute hash locally (matches server's request_hash)
|
|
95
|
+
hash_value = compute_request_hash(payload)
|
|
96
|
+
print(f"Request hash: {hash_value}")
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
### Gate Decide (Decision Only)
|
|
100
|
+
|
|
101
|
+
```python
|
|
102
|
+
from faramesh import gate_decide
|
|
103
|
+
|
|
104
|
+
# Get decision without creating an action
|
|
105
|
+
decision = gate_decide(
|
|
106
|
+
agent_id="my-agent",
|
|
107
|
+
tool="http",
|
|
108
|
+
operation="get",
|
|
109
|
+
params={"url": "https://example.com"}
|
|
110
|
+
)
|
|
111
|
+
|
|
112
|
+
if decision.outcome == "EXECUTE":
|
|
113
|
+
print("Action would be allowed")
|
|
114
|
+
elif decision.outcome == "HALT":
|
|
115
|
+
print(f"Action would be denied: {decision.reason_code}")
|
|
116
|
+
else: # ABSTAIN
|
|
117
|
+
print("Action requires approval")
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
### Execute If Allowed (Gated Execution)
|
|
121
|
+
|
|
122
|
+
```python
|
|
123
|
+
from faramesh import execute_if_allowed
|
|
124
|
+
|
|
125
|
+
def my_executor(tool, operation, params, context):
|
|
126
|
+
# Your actual execution logic
|
|
127
|
+
return {"status": "done"}
|
|
128
|
+
|
|
129
|
+
result = execute_if_allowed(
|
|
130
|
+
agent_id="my-agent",
|
|
131
|
+
tool="http",
|
|
132
|
+
operation="get",
|
|
133
|
+
params={"url": "https://example.com"},
|
|
134
|
+
executor=my_executor
|
|
135
|
+
)
|
|
136
|
+
|
|
137
|
+
if result["executed"]:
|
|
138
|
+
print("Action executed:", result["execution_result"])
|
|
139
|
+
else:
|
|
140
|
+
print("Action blocked:", result["reason_code"])
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
### Replay Decision
|
|
144
|
+
|
|
145
|
+
```python
|
|
146
|
+
from faramesh import replay_decision
|
|
147
|
+
|
|
148
|
+
# Verify decision is deterministic
|
|
149
|
+
result = replay_decision(action_id="abc123")
|
|
150
|
+
|
|
151
|
+
if result.success:
|
|
152
|
+
print("Decision replay passed!")
|
|
153
|
+
else:
|
|
154
|
+
print("Mismatches:", result.mismatches)
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
## Documentation
|
|
158
|
+
|
|
159
|
+
Full documentation is available at: https://github.com/faramesh/faramesh-docs
|
|
160
|
+
|
|
161
|
+
See `docs/SDK-Python.md` for detailed API reference.
|
|
162
|
+
|
|
163
|
+
## Repository
|
|
164
|
+
|
|
165
|
+
**Source**: https://github.com/faramesh/faramesh-python-sdk
|
|
166
|
+
|
|
167
|
+
## License
|
|
168
|
+
|
|
169
|
+
Elastic License 2.0
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
# Faramesh Python SDK
|
|
2
|
+
|
|
3
|
+
Production-ready Python client for the Faramesh Execution Governor API.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pip install faramesh-sdk
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Or install from source:
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
git clone https://github.com/faramesh/faramesh-python-sdk.git
|
|
15
|
+
cd faramesh-python-sdk
|
|
16
|
+
pip install -e .
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Quick Start
|
|
20
|
+
|
|
21
|
+
```python
|
|
22
|
+
from faramesh import configure, submit_action, approve_action
|
|
23
|
+
|
|
24
|
+
# Configure SDK (optional - defaults to http://127.0.0.1:8000)
|
|
25
|
+
configure(
|
|
26
|
+
base_url="http://localhost:8000",
|
|
27
|
+
token="your-token", # Optional, can also use FARAMESH_TOKEN env var
|
|
28
|
+
)
|
|
29
|
+
|
|
30
|
+
# Submit an action
|
|
31
|
+
action = submit_action(
|
|
32
|
+
agent_id="my-agent",
|
|
33
|
+
tool="http",
|
|
34
|
+
operation="get",
|
|
35
|
+
params={"url": "https://example.com"}
|
|
36
|
+
)
|
|
37
|
+
|
|
38
|
+
print(f"Action {action.id} status: {action.status}")
|
|
39
|
+
|
|
40
|
+
# If action requires approval
|
|
41
|
+
if action.status == "pending_approval":
|
|
42
|
+
approved = approve_action(
|
|
43
|
+
action.id,
|
|
44
|
+
action.approval_token,
|
|
45
|
+
reason="Looks safe"
|
|
46
|
+
)
|
|
47
|
+
print(f"Action approved: {approved.status}")
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## Features
|
|
51
|
+
|
|
52
|
+
- **Simple API**: Easy-to-use functions for all API operations
|
|
53
|
+
- **Batch Operations**: Submit multiple actions at once
|
|
54
|
+
- **Submit and Wait**: Automatically wait for action completion
|
|
55
|
+
- **Policy Building**: Build policies in Python code
|
|
56
|
+
- **Deterministic Hashing**: Client-side request_hash computation
|
|
57
|
+
- **Gate Endpoint**: Pre-check decisions without creating actions
|
|
58
|
+
- **Replay Helpers**: Verify decision determinism
|
|
59
|
+
- **Error Handling**: Typed exceptions for all error cases
|
|
60
|
+
|
|
61
|
+
## Gate Endpoint & Deterministic Hashing
|
|
62
|
+
|
|
63
|
+
The SDK provides helpers for deterministic decision verification:
|
|
64
|
+
|
|
65
|
+
### Compute Request Hash Locally
|
|
66
|
+
|
|
67
|
+
```python
|
|
68
|
+
from faramesh import compute_request_hash
|
|
69
|
+
|
|
70
|
+
payload = {
|
|
71
|
+
"agent_id": "my-agent",
|
|
72
|
+
"tool": "http",
|
|
73
|
+
"operation": "get",
|
|
74
|
+
"params": {"url": "https://example.com"},
|
|
75
|
+
"context": {}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
# Compute hash locally (matches server's request_hash)
|
|
79
|
+
hash_value = compute_request_hash(payload)
|
|
80
|
+
print(f"Request hash: {hash_value}")
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
### Gate Decide (Decision Only)
|
|
84
|
+
|
|
85
|
+
```python
|
|
86
|
+
from faramesh import gate_decide
|
|
87
|
+
|
|
88
|
+
# Get decision without creating an action
|
|
89
|
+
decision = gate_decide(
|
|
90
|
+
agent_id="my-agent",
|
|
91
|
+
tool="http",
|
|
92
|
+
operation="get",
|
|
93
|
+
params={"url": "https://example.com"}
|
|
94
|
+
)
|
|
95
|
+
|
|
96
|
+
if decision.outcome == "EXECUTE":
|
|
97
|
+
print("Action would be allowed")
|
|
98
|
+
elif decision.outcome == "HALT":
|
|
99
|
+
print(f"Action would be denied: {decision.reason_code}")
|
|
100
|
+
else: # ABSTAIN
|
|
101
|
+
print("Action requires approval")
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
### Execute If Allowed (Gated Execution)
|
|
105
|
+
|
|
106
|
+
```python
|
|
107
|
+
from faramesh import execute_if_allowed
|
|
108
|
+
|
|
109
|
+
def my_executor(tool, operation, params, context):
|
|
110
|
+
# Your actual execution logic
|
|
111
|
+
return {"status": "done"}
|
|
112
|
+
|
|
113
|
+
result = execute_if_allowed(
|
|
114
|
+
agent_id="my-agent",
|
|
115
|
+
tool="http",
|
|
116
|
+
operation="get",
|
|
117
|
+
params={"url": "https://example.com"},
|
|
118
|
+
executor=my_executor
|
|
119
|
+
)
|
|
120
|
+
|
|
121
|
+
if result["executed"]:
|
|
122
|
+
print("Action executed:", result["execution_result"])
|
|
123
|
+
else:
|
|
124
|
+
print("Action blocked:", result["reason_code"])
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
### Replay Decision
|
|
128
|
+
|
|
129
|
+
```python
|
|
130
|
+
from faramesh import replay_decision
|
|
131
|
+
|
|
132
|
+
# Verify decision is deterministic
|
|
133
|
+
result = replay_decision(action_id="abc123")
|
|
134
|
+
|
|
135
|
+
if result.success:
|
|
136
|
+
print("Decision replay passed!")
|
|
137
|
+
else:
|
|
138
|
+
print("Mismatches:", result.mismatches)
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
## Documentation
|
|
142
|
+
|
|
143
|
+
Full documentation is available at: https://github.com/faramesh/faramesh-docs
|
|
144
|
+
|
|
145
|
+
See `docs/SDK-Python.md` for detailed API reference.
|
|
146
|
+
|
|
147
|
+
## Repository
|
|
148
|
+
|
|
149
|
+
**Source**: https://github.com/faramesh/faramesh-python-sdk
|
|
150
|
+
|
|
151
|
+
## License
|
|
152
|
+
|
|
153
|
+
Elastic License 2.0
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
"""Faramesh Python SDK - Production-ready client for the Faramesh Execution Governor API.
|
|
2
|
+
|
|
3
|
+
Quick Start:
|
|
4
|
+
>>> from faramesh import configure, submit_action, approve_action
|
|
5
|
+
>>> configure(base_url="http://localhost:8000", token="dev-token")
|
|
6
|
+
>>> action = submit_action("my-agent", "http", "get", {"url": "https://example.com"})
|
|
7
|
+
>>> print(f"Action {action['id']} status: {action['status']}")
|
|
8
|
+
"""
|
|
9
|
+
|
|
10
|
+
from .client import (
|
|
11
|
+
# Configuration
|
|
12
|
+
configure,
|
|
13
|
+
ClientConfig,
|
|
14
|
+
|
|
15
|
+
# Core functions
|
|
16
|
+
submit_action,
|
|
17
|
+
submit_actions,
|
|
18
|
+
submit_actions_bulk,
|
|
19
|
+
submit_and_wait,
|
|
20
|
+
block_until_approved,
|
|
21
|
+
get_action,
|
|
22
|
+
list_actions,
|
|
23
|
+
approve_action,
|
|
24
|
+
deny_action,
|
|
25
|
+
start_action,
|
|
26
|
+
replay_action,
|
|
27
|
+
wait_for_completion,
|
|
28
|
+
apply,
|
|
29
|
+
tail_events,
|
|
30
|
+
stream_events,
|
|
31
|
+
|
|
32
|
+
# Convenience aliases
|
|
33
|
+
allow,
|
|
34
|
+
deny,
|
|
35
|
+
|
|
36
|
+
# Exceptions
|
|
37
|
+
FarameshError,
|
|
38
|
+
FarameshAuthError,
|
|
39
|
+
FarameshNotFoundError,
|
|
40
|
+
FarameshPolicyError,
|
|
41
|
+
FarameshTimeoutError,
|
|
42
|
+
FarameshConnectionError,
|
|
43
|
+
FarameshValidationError,
|
|
44
|
+
FarameshServerError,
|
|
45
|
+
FarameshBatchError,
|
|
46
|
+
FarameshDeniedError,
|
|
47
|
+
|
|
48
|
+
# Legacy class-based API (for backward compatibility)
|
|
49
|
+
ExecutionGovernorClient,
|
|
50
|
+
GovernorConfig,
|
|
51
|
+
GovernorError,
|
|
52
|
+
GovernorTimeoutError,
|
|
53
|
+
GovernorAuthError,
|
|
54
|
+
GovernorConnectionError,
|
|
55
|
+
)
|
|
56
|
+
|
|
57
|
+
# Import new modules
|
|
58
|
+
from .governed_tool import governed_tool
|
|
59
|
+
from .snapshot import ActionSnapshotStore, get_default_store
|
|
60
|
+
from .policy_helpers import validate_policy_file, test_policy_against_action
|
|
61
|
+
|
|
62
|
+
# Import canonicalization helpers
|
|
63
|
+
from .canonicalization import (
|
|
64
|
+
canonicalize,
|
|
65
|
+
canonicalize_action_payload,
|
|
66
|
+
compute_request_hash,
|
|
67
|
+
compute_hash,
|
|
68
|
+
CanonicalizeError,
|
|
69
|
+
)
|
|
70
|
+
|
|
71
|
+
# Import gate helpers
|
|
72
|
+
from .gate import (
|
|
73
|
+
gate_decide,
|
|
74
|
+
gate_decide_dict,
|
|
75
|
+
replay_decision,
|
|
76
|
+
verify_request_hash,
|
|
77
|
+
execute_if_allowed,
|
|
78
|
+
GateDecision,
|
|
79
|
+
ReplayResult,
|
|
80
|
+
)
|
|
81
|
+
|
|
82
|
+
# Import version
|
|
83
|
+
from .client import __version__
|
|
84
|
+
|
|
85
|
+
# Import policy models
|
|
86
|
+
from .policy import (
|
|
87
|
+
Policy,
|
|
88
|
+
PolicyRule,
|
|
89
|
+
MatchCondition,
|
|
90
|
+
RiskRule,
|
|
91
|
+
RiskLevel,
|
|
92
|
+
create_policy,
|
|
93
|
+
)
|
|
94
|
+
|
|
95
|
+
__all__ = [
|
|
96
|
+
# Configuration
|
|
97
|
+
"configure",
|
|
98
|
+
"ClientConfig",
|
|
99
|
+
|
|
100
|
+
# Core functions
|
|
101
|
+
"submit_action",
|
|
102
|
+
"submit_actions",
|
|
103
|
+
"submit_actions_bulk",
|
|
104
|
+
"submit_and_wait",
|
|
105
|
+
"block_until_approved",
|
|
106
|
+
"get_action",
|
|
107
|
+
"list_actions",
|
|
108
|
+
"approve_action",
|
|
109
|
+
"deny_action",
|
|
110
|
+
"start_action",
|
|
111
|
+
"replay_action",
|
|
112
|
+
"wait_for_completion",
|
|
113
|
+
"apply",
|
|
114
|
+
"tail_events",
|
|
115
|
+
"stream_events",
|
|
116
|
+
|
|
117
|
+
# Convenience aliases
|
|
118
|
+
"allow",
|
|
119
|
+
"deny",
|
|
120
|
+
|
|
121
|
+
# Policy models
|
|
122
|
+
"Policy",
|
|
123
|
+
"PolicyRule",
|
|
124
|
+
"MatchCondition",
|
|
125
|
+
"RiskRule",
|
|
126
|
+
"RiskLevel",
|
|
127
|
+
"create_policy",
|
|
128
|
+
|
|
129
|
+
# Policy helpers
|
|
130
|
+
"validate_policy_file",
|
|
131
|
+
"test_policy_against_action",
|
|
132
|
+
|
|
133
|
+
# Canonicalization helpers
|
|
134
|
+
"canonicalize",
|
|
135
|
+
"canonicalize_action_payload",
|
|
136
|
+
"compute_request_hash",
|
|
137
|
+
"compute_hash",
|
|
138
|
+
"CanonicalizeError",
|
|
139
|
+
|
|
140
|
+
# Gate/Replay helpers
|
|
141
|
+
"gate_decide",
|
|
142
|
+
"gate_decide_dict",
|
|
143
|
+
"replay_decision",
|
|
144
|
+
"verify_request_hash",
|
|
145
|
+
"execute_if_allowed",
|
|
146
|
+
"GateDecision",
|
|
147
|
+
"ReplayResult",
|
|
148
|
+
|
|
149
|
+
# Decorators
|
|
150
|
+
"governed_tool",
|
|
151
|
+
|
|
152
|
+
# Utilities
|
|
153
|
+
"ActionSnapshotStore",
|
|
154
|
+
"get_default_store",
|
|
155
|
+
|
|
156
|
+
# Exceptions
|
|
157
|
+
"FarameshError",
|
|
158
|
+
"FarameshAuthError",
|
|
159
|
+
"FarameshNotFoundError",
|
|
160
|
+
"FarameshPolicyError",
|
|
161
|
+
"FarameshTimeoutError",
|
|
162
|
+
"FarameshConnectionError",
|
|
163
|
+
"FarameshValidationError",
|
|
164
|
+
"FarameshServerError",
|
|
165
|
+
"FarameshBatchError",
|
|
166
|
+
"FarameshDeniedError",
|
|
167
|
+
|
|
168
|
+
# Legacy API
|
|
169
|
+
"ExecutionGovernorClient",
|
|
170
|
+
"GovernorConfig",
|
|
171
|
+
"GovernorError",
|
|
172
|
+
"GovernorTimeoutError",
|
|
173
|
+
"GovernorAuthError",
|
|
174
|
+
"GovernorConnectionError",
|
|
175
|
+
|
|
176
|
+
# Version
|
|
177
|
+
"__version__",
|
|
178
|
+
]
|