pfc-client 0.1.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.
- pfc_client-0.1.0/PKG-INFO +38 -0
- pfc_client-0.1.0/README.md +234 -0
- pfc_client-0.1.0/README_SDK.md +20 -0
- pfc_client-0.1.0/pfc_client/__init__.py +4 -0
- pfc_client-0.1.0/pfc_client/client.py +50 -0
- pfc_client-0.1.0/pfc_client/guard.py +22 -0
- pfc_client-0.1.0/pfc_client.egg-info/PKG-INFO +38 -0
- pfc_client-0.1.0/pfc_client.egg-info/SOURCES.txt +11 -0
- pfc_client-0.1.0/pfc_client.egg-info/dependency_links.txt +1 -0
- pfc_client-0.1.0/pfc_client.egg-info/requires.txt +1 -0
- pfc_client-0.1.0/pfc_client.egg-info/top_level.txt +1 -0
- pfc_client-0.1.0/pyproject.toml +35 -0
- pfc_client-0.1.0/setup.cfg +4 -0
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: pfc-client
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Python SDK for Prime Form Calculus governance API
|
|
5
|
+
Author: Dan Evans
|
|
6
|
+
License: Proprietary
|
|
7
|
+
Project-URL: Homepage, https://pfc-api.fly.dev
|
|
8
|
+
Project-URL: Source, https://github.com/danlevans1/PFC
|
|
9
|
+
Keywords: pfc,governance,ai,sdk,api
|
|
10
|
+
Classifier: Programming Language :: Python :: 3
|
|
11
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
12
|
+
Classifier: Operating System :: OS Independent
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: Topic :: Software Development :: Libraries
|
|
15
|
+
Requires-Python: >=3.8
|
|
16
|
+
Description-Content-Type: text/markdown
|
|
17
|
+
Requires-Dist: requests>=2.28
|
|
18
|
+
|
|
19
|
+
# PFC Python Client
|
|
20
|
+
|
|
21
|
+
Example usage:
|
|
22
|
+
|
|
23
|
+
```python
|
|
24
|
+
from pfc_client import PFCClient, guarded_tool
|
|
25
|
+
|
|
26
|
+
client = PFCClient(
|
|
27
|
+
api_url="https://pfc-api.fly.dev",
|
|
28
|
+
api_key="YOUR_API_KEY",
|
|
29
|
+
)
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
@guarded_tool(client)
|
|
33
|
+
def deploy():
|
|
34
|
+
print("Deploying to production")
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
deploy()
|
|
38
|
+
```
|
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
Core Positioning
|
|
2
|
+
|
|
3
|
+
PFC determines whether an action should be permitted based on consequence, authority, irreversibility, and systemic stability. Execution-control systems enforce those permissions at runtime.
|
|
4
|
+
|
|
5
|
+
Public architecture overview. Implementation and operational deployment require licensing.
|
|
6
|
+
|
|
7
|
+
Public, non-commercial overview.
|
|
8
|
+
|
|
9
|
+
Prime Form Calculus (PFC) defines
|
|
10
|
+
a governance layer for intelligent systems.
|
|
11
|
+
|
|
12
|
+
This repository contains conceptual,
|
|
13
|
+
architectural, and exploratory material
|
|
14
|
+
intended for technical review and evaluation.
|
|
15
|
+
It is not a product, service, or solicitation.
|
|
16
|
+
|
|
17
|
+
Any implementation or production use requires
|
|
18
|
+
a commercial license from the author.
|
|
19
|
+
|
|
20
|
+
Read Full Spec: [PFC Specification v0.1](SPEC/PFC-v0.1.md)
|
|
21
|
+
|
|
22
|
+
⸻
|
|
23
|
+
|
|
24
|
+
Prime Form Calculus (PFC)
|
|
25
|
+
|
|
26
|
+
A Governance Layer Between Intelligence and Action
|
|
27
|
+
|
|
28
|
+
Artificial intelligence systems are rapidly moving
|
|
29
|
+
from generating information to taking real-world action.
|
|
30
|
+
|
|
31
|
+
They diagnose conditions, recommend financial decisions,
|
|
32
|
+
operate infrastructure, guide autonomous systems, and
|
|
33
|
+
influence regulatory and human outcomes.
|
|
34
|
+
|
|
35
|
+
As systems transition from “answering questions”
|
|
36
|
+
to “exercising authority,” a new control boundary
|
|
37
|
+
becomes necessary.
|
|
38
|
+
|
|
39
|
+
Not inside the model.
|
|
40
|
+
Not after the output.
|
|
41
|
+
But between intelligence and action.
|
|
42
|
+
|
|
43
|
+
Most current approaches focus on alignment,
|
|
44
|
+
training, prompting, and moderation. These
|
|
45
|
+
improve surface behavior, but they do not
|
|
46
|
+
govern whether an intelligent system should
|
|
47
|
+
be allowed to act under real conditions.
|
|
48
|
+
|
|
49
|
+
Over time, drift accumulates.
|
|
50
|
+
Contradictions emerge.
|
|
51
|
+
Operational authority expands beyond
|
|
52
|
+
verified boundaries.
|
|
53
|
+
|
|
54
|
+
Systems can remain functional while
|
|
55
|
+
diverging from safe or intended operation.
|
|
56
|
+
|
|
57
|
+
Prime Form Calculus (PFC) defines the
|
|
58
|
+
missing layer: a governance and stability
|
|
59
|
+
architecture that controls how intelligent
|
|
60
|
+
systems operate over time and whether
|
|
61
|
+
proposed actions are permitted.
|
|
62
|
+
|
|
63
|
+
⸻
|
|
64
|
+
|
|
65
|
+
What PFC Is
|
|
66
|
+
|
|
67
|
+
PFC is a model-agnostic governance runtime
|
|
68
|
+
designed to regulate operational authority,
|
|
69
|
+
state transitions, and system behavior.
|
|
70
|
+
|
|
71
|
+
It does not improve model intelligence.
|
|
72
|
+
It does not generate content.
|
|
73
|
+
It does not replace existing AI systems.
|
|
74
|
+
|
|
75
|
+
Instead, PFC governs whether an
|
|
76
|
+
intelligent system is allowed to act.
|
|
77
|
+
|
|
78
|
+
Ordinary AI answers questions such as:
|
|
79
|
+
|
|
80
|
+
What diagnosis to produce
|
|
81
|
+
What trade to execute
|
|
82
|
+
What route to choose
|
|
83
|
+
|
|
84
|
+
PFC governs higher-order questions such as:
|
|
85
|
+
|
|
86
|
+
Is the system authorized to perform this action
|
|
87
|
+
Is the proposed state transition permitted
|
|
88
|
+
under current constraints
|
|
89
|
+
Does the system remain inside its certified
|
|
90
|
+
operational envelope
|
|
91
|
+
|
|
92
|
+
This establishes a control plane over
|
|
93
|
+
intelligence rather than inside it.
|
|
94
|
+
|
|
95
|
+
⸻
|
|
96
|
+
|
|
97
|
+
The Control Boundary
|
|
98
|
+
|
|
99
|
+
PFC operates at the boundary between
|
|
100
|
+
model output and real-world authority.
|
|
101
|
+
|
|
102
|
+
It governs:
|
|
103
|
+
|
|
104
|
+
Whether outputs are permitted to influence
|
|
105
|
+
decisions Whether actions may be committed
|
|
106
|
+
Whether operational transitions remain
|
|
107
|
+
within defined stability constraints
|
|
108
|
+
|
|
109
|
+
Instead of filtering what a system says,
|
|
110
|
+
PFC governs what a system can do.
|
|
111
|
+
|
|
112
|
+
This distinction becomes critical as
|
|
113
|
+
intelligent systems move into safety-critical
|
|
114
|
+
and regulated environments.
|
|
115
|
+
|
|
116
|
+
⸻
|
|
117
|
+
|
|
118
|
+
The Stability Kernel
|
|
119
|
+
|
|
120
|
+
At the core of PFC is a continuously operating
|
|
121
|
+
closed-loop governance mechanism referred to
|
|
122
|
+
as the Stability Kernel.
|
|
123
|
+
|
|
124
|
+
The Stability Kernel:
|
|
125
|
+
|
|
126
|
+
Monitors system state continuously
|
|
127
|
+
Evaluates proposed transitions against
|
|
128
|
+
stability and constraint criteria
|
|
129
|
+
Controls which transitions may be committed
|
|
130
|
+
Maintains operational integrity over time
|
|
131
|
+
|
|
132
|
+
Because governance operates at runtime,
|
|
133
|
+
unsafe or unstable system regions become
|
|
134
|
+
dynamically unreachable rather than detected
|
|
135
|
+
after the fact.
|
|
136
|
+
|
|
137
|
+
⸻
|
|
138
|
+
|
|
139
|
+
Why This Layer Is Necessary
|
|
140
|
+
|
|
141
|
+
Alignment, fine-tuning, and guardrails
|
|
142
|
+
address model behavior.
|
|
143
|
+
|
|
144
|
+
They do not provide operational governance.
|
|
145
|
+
|
|
146
|
+
As intelligent systems scale into real-world
|
|
147
|
+
environments, organizations require:
|
|
148
|
+
|
|
149
|
+
Authority control
|
|
150
|
+
Operational constraints
|
|
151
|
+
Continuous assurance
|
|
152
|
+
Audit-grade evidence
|
|
153
|
+
Rollback and containment capability
|
|
154
|
+
|
|
155
|
+
These needs define infrastructure, not features.
|
|
156
|
+
|
|
157
|
+
PFC is designed to operate as
|
|
158
|
+
that infrastructure layer.
|
|
159
|
+
|
|
160
|
+
⸻
|
|
161
|
+
|
|
162
|
+
Evidence and Assurance
|
|
163
|
+
|
|
164
|
+
PFC is designed to generate audit-grade,
|
|
165
|
+
machine-verifiable evidence of system
|
|
166
|
+
behavior by construction.
|
|
167
|
+
|
|
168
|
+
This supports:
|
|
169
|
+
|
|
170
|
+
Regulated deployment
|
|
171
|
+
Post-incident analysis
|
|
172
|
+
Continuous assurance requirements
|
|
173
|
+
Operational accountability
|
|
174
|
+
|
|
175
|
+
Rather than adding audit after deployment,
|
|
176
|
+
governance is embedded into system operation.
|
|
177
|
+
|
|
178
|
+
⸻
|
|
179
|
+
|
|
180
|
+
Model-Agnostic Deployment
|
|
181
|
+
|
|
182
|
+
PFC operates independently of
|
|
183
|
+
any specific model architecture.
|
|
184
|
+
|
|
185
|
+
It can be deployed around:
|
|
186
|
+
|
|
187
|
+
Cloud AI systems
|
|
188
|
+
Enterprise decision platforms
|
|
189
|
+
Autonomous systems
|
|
190
|
+
Industrial and infrastructure environments
|
|
191
|
+
Medical and financial systems
|
|
192
|
+
|
|
193
|
+
PFC governs intelligent behavior
|
|
194
|
+
without retraining, modifying, or
|
|
195
|
+
accessing internal model parameters.
|
|
196
|
+
|
|
197
|
+
⸻
|
|
198
|
+
|
|
199
|
+
Position in the Stack
|
|
200
|
+
|
|
201
|
+
PFC functions as governance infrastructure.
|
|
202
|
+
|
|
203
|
+
Comparable roles in other domains include:
|
|
204
|
+
|
|
205
|
+
Operating systems for computation
|
|
206
|
+
Identity layers for access control
|
|
207
|
+
API gateways for service interaction
|
|
208
|
+
Control planes for distributed systems
|
|
209
|
+
|
|
210
|
+
PFC provides a governance control plane
|
|
211
|
+
for intelligent systems.
|
|
212
|
+
|
|
213
|
+
⸻
|
|
214
|
+
|
|
215
|
+
Repository Scope
|
|
216
|
+
|
|
217
|
+
This repository publishes conceptual
|
|
218
|
+
and architectural material related to the
|
|
219
|
+
Prime Form Calculus protocol for review
|
|
220
|
+
and evaluation.
|
|
221
|
+
|
|
222
|
+
It includes:
|
|
223
|
+
|
|
224
|
+
Governance principles
|
|
225
|
+
Control architecture concepts
|
|
226
|
+
Runtime stability framing
|
|
227
|
+
Evidence-generation approaches
|
|
228
|
+
Compatibility with existing AI risk
|
|
229
|
+
and compliance frameworks
|
|
230
|
+
|
|
231
|
+
Read Full Spec: [PFC Specification v0.1](SPEC/PFC-v0.1.md)
|
|
232
|
+
|
|
233
|
+
Prime Flow Calculus Protocol,
|
|
234
|
+
Version 0.1 (Draft), 2026.
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# PFC Python Client
|
|
2
|
+
|
|
3
|
+
Example usage:
|
|
4
|
+
|
|
5
|
+
```python
|
|
6
|
+
from pfc_client import PFCClient, guarded_tool
|
|
7
|
+
|
|
8
|
+
client = PFCClient(
|
|
9
|
+
api_url="https://pfc-api.fly.dev",
|
|
10
|
+
api_key="YOUR_API_KEY",
|
|
11
|
+
)
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
@guarded_tool(client)
|
|
15
|
+
def deploy():
|
|
16
|
+
print("Deploying to production")
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
deploy()
|
|
20
|
+
```
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import uuid
|
|
2
|
+
|
|
3
|
+
import requests
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class PFCClient:
|
|
7
|
+
def __init__(self, api_url="https://pfc-api.fly.dev", api_key=None):
|
|
8
|
+
self.api_url = api_url.rstrip("/")
|
|
9
|
+
self.api_key = api_key
|
|
10
|
+
|
|
11
|
+
def evaluate(
|
|
12
|
+
self,
|
|
13
|
+
action,
|
|
14
|
+
subject=None,
|
|
15
|
+
resource=None,
|
|
16
|
+
policy=None,
|
|
17
|
+
context=None,
|
|
18
|
+
irreversible=True,
|
|
19
|
+
):
|
|
20
|
+
payload = {
|
|
21
|
+
"request_id": str(uuid.uuid4()),
|
|
22
|
+
"action": action,
|
|
23
|
+
"subject": subject or {"type": "agent", "id": "default-agent"},
|
|
24
|
+
"resource": resource or {"type": "system", "id": "default"},
|
|
25
|
+
"proposed_execution": {"irreversible": irreversible},
|
|
26
|
+
"policy": policy or {"policy_id": "default-policy", "rules": {}},
|
|
27
|
+
"context": context or {"environment": "prod", "tenant_id": "default"},
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
r = requests.post(
|
|
31
|
+
f"{self.api_url}/v1/evaluate",
|
|
32
|
+
json=payload,
|
|
33
|
+
headers={
|
|
34
|
+
"Content-Type": "application/json",
|
|
35
|
+
"x-api-key": self.api_key,
|
|
36
|
+
},
|
|
37
|
+
timeout=10,
|
|
38
|
+
)
|
|
39
|
+
|
|
40
|
+
r.raise_for_status()
|
|
41
|
+
return r.json()
|
|
42
|
+
|
|
43
|
+
def verify(self, artifact, public_key_pem):
|
|
44
|
+
r = requests.post(
|
|
45
|
+
f"{self.api_url}/v1/verify",
|
|
46
|
+
json={"artifact": artifact, "public_key_pem": public_key_pem},
|
|
47
|
+
timeout=10,
|
|
48
|
+
)
|
|
49
|
+
r.raise_for_status()
|
|
50
|
+
return r.json()
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
from functools import wraps
|
|
2
|
+
|
|
3
|
+
from .client import PFCClient
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
def guarded_tool(client: PFCClient):
|
|
7
|
+
def decorator(func):
|
|
8
|
+
@wraps(func)
|
|
9
|
+
def wrapper(*args, **kwargs):
|
|
10
|
+
decision = client.evaluate(
|
|
11
|
+
action=func.__name__,
|
|
12
|
+
resource={"type": "tool", "id": func.__name__},
|
|
13
|
+
)
|
|
14
|
+
|
|
15
|
+
if not decision.get("allow"):
|
|
16
|
+
raise RuntimeError(f"PFC blocked execution: {decision.get('reason')}")
|
|
17
|
+
|
|
18
|
+
return func(*args, **kwargs)
|
|
19
|
+
|
|
20
|
+
return wrapper
|
|
21
|
+
|
|
22
|
+
return decorator
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: pfc-client
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Python SDK for Prime Form Calculus governance API
|
|
5
|
+
Author: Dan Evans
|
|
6
|
+
License: Proprietary
|
|
7
|
+
Project-URL: Homepage, https://pfc-api.fly.dev
|
|
8
|
+
Project-URL: Source, https://github.com/danlevans1/PFC
|
|
9
|
+
Keywords: pfc,governance,ai,sdk,api
|
|
10
|
+
Classifier: Programming Language :: Python :: 3
|
|
11
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
12
|
+
Classifier: Operating System :: OS Independent
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: Topic :: Software Development :: Libraries
|
|
15
|
+
Requires-Python: >=3.8
|
|
16
|
+
Description-Content-Type: text/markdown
|
|
17
|
+
Requires-Dist: requests>=2.28
|
|
18
|
+
|
|
19
|
+
# PFC Python Client
|
|
20
|
+
|
|
21
|
+
Example usage:
|
|
22
|
+
|
|
23
|
+
```python
|
|
24
|
+
from pfc_client import PFCClient, guarded_tool
|
|
25
|
+
|
|
26
|
+
client = PFCClient(
|
|
27
|
+
api_url="https://pfc-api.fly.dev",
|
|
28
|
+
api_key="YOUR_API_KEY",
|
|
29
|
+
)
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
@guarded_tool(client)
|
|
33
|
+
def deploy():
|
|
34
|
+
print("Deploying to production")
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
deploy()
|
|
38
|
+
```
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
README.md
|
|
2
|
+
README_SDK.md
|
|
3
|
+
pyproject.toml
|
|
4
|
+
pfc_client/__init__.py
|
|
5
|
+
pfc_client/client.py
|
|
6
|
+
pfc_client/guard.py
|
|
7
|
+
pfc_client.egg-info/PKG-INFO
|
|
8
|
+
pfc_client.egg-info/SOURCES.txt
|
|
9
|
+
pfc_client.egg-info/dependency_links.txt
|
|
10
|
+
pfc_client.egg-info/requires.txt
|
|
11
|
+
pfc_client.egg-info/top_level.txt
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
requests>=2.28
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
pfc_client
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=68", "wheel", "build"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "pfc-client"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "Python SDK for Prime Form Calculus governance API"
|
|
9
|
+
readme = "README_SDK.md"
|
|
10
|
+
requires-python = ">=3.8"
|
|
11
|
+
license = {text = "Proprietary"}
|
|
12
|
+
authors = [
|
|
13
|
+
{name = "Dan Evans"}
|
|
14
|
+
]
|
|
15
|
+
dependencies = [
|
|
16
|
+
"requests>=2.28"
|
|
17
|
+
]
|
|
18
|
+
keywords = ["pfc", "governance", "ai", "sdk", "api"]
|
|
19
|
+
classifiers = [
|
|
20
|
+
"Programming Language :: Python :: 3",
|
|
21
|
+
"Programming Language :: Python :: 3 :: Only",
|
|
22
|
+
"Operating System :: OS Independent",
|
|
23
|
+
"Intended Audience :: Developers",
|
|
24
|
+
"Topic :: Software Development :: Libraries"
|
|
25
|
+
]
|
|
26
|
+
|
|
27
|
+
[project.urls]
|
|
28
|
+
Homepage = "https://pfc-api.fly.dev"
|
|
29
|
+
Source = "https://github.com/danlevans1/PFC"
|
|
30
|
+
|
|
31
|
+
[tool.setuptools]
|
|
32
|
+
include-package-data = true
|
|
33
|
+
|
|
34
|
+
[tool.setuptools.packages.find]
|
|
35
|
+
include = ["pfc_client*"]
|