patchr 0.1.0__py3-none-any.whl
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.
- apps/__init__.py +2 -0
- apps/api/__init__.py +2 -0
- apps/api/main.py +652 -0
- apps/benchmarks/__init__.py +1 -0
- apps/benchmarks/main.py +20 -0
- apps/sandbox/__init__.py +1 -0
- apps/sandbox/main.py +20 -0
- apps/worker/__init__.py +2 -0
- apps/worker/main.py +15 -0
- apps/worker/verify.py +14 -0
- patchr/__init__.py +12 -0
- patchr/sdk/__init__.py +20 -0
- patchr/sdk/client.py +12 -0
- patchr-0.1.0.dist-info/METADATA +137 -0
- patchr-0.1.0.dist-info/RECORD +116 -0
- patchr-0.1.0.dist-info/WHEEL +5 -0
- patchr-0.1.0.dist-info/entry_points.txt +5 -0
- patchr-0.1.0.dist-info/licenses/LICENSE +17 -0
- patchr-0.1.0.dist-info/top_level.txt +3 -0
- picux/__init__.py +6 -0
- picux/agents/__init__.py +5 -0
- picux/agents/registry.py +204 -0
- picux/api/__init__.py +5 -0
- picux/api/service.py +5075 -0
- picux/audit/__init__.py +31 -0
- picux/audit/activity.py +97 -0
- picux/audit/observability.py +55 -0
- picux/audit/verification/__init__.py +21 -0
- picux/audit/verification/ledger.py +633 -0
- picux/benchmarks/__init__.py +5 -0
- picux/benchmarks/local.py +286 -0
- picux/config.py +140 -0
- picux/contracts/__init__.py +22 -0
- picux/contracts/handshake.py +122 -0
- picux/contracts/integration.py +385 -0
- picux/contracts/openapi.py +187 -0
- picux/contracts/protocol_map.py +152 -0
- picux/contracts/routes.py +980 -0
- picux/contracts/schema_catalog.py +125 -0
- picux/core/__init__.py +17 -0
- picux/core/models.py +148 -0
- picux/core/router.py +131 -0
- picux/core/runtime.py +42 -0
- picux/core/state_machine.py +38 -0
- picux/domains/__init__.py +2 -0
- picux/domains/bridge/HostRun.py +1104 -0
- picux/domains/bridge/__init__.py +6 -0
- picux/domains/bridge/engine.py +345 -0
- picux/domains/hunt/__init__.py +6 -0
- picux/domains/hunt/engine.py +307 -0
- picux/domains/hunt/models.py +88 -0
- picux/domains/pay/__init__.py +16 -0
- picux/domains/pay/adapters.py +607 -0
- picux/domains/pay/engine.py +950 -0
- picux/domains/pay/models.py +95 -0
- picux/domains/proxy/__init__.py +5 -0
- picux/domains/proxy/engine.py +466 -0
- picux/domains/resolve/__init__.py +5 -0
- picux/domains/resolve/engine.py +546 -0
- picux/orchestrator/__init__.py +3 -0
- picux/orchestrator/engine.py +2840 -0
- picux/portals/__init__.py +17 -0
- picux/portals/templates.py +272 -0
- picux/protocols/__init__.py +1 -0
- picux/protocols/a2a/__init__.py +6 -0
- picux/protocols/a2a/client.py +51 -0
- picux/protocols/a2a/envelope.py +132 -0
- picux/protocols/mcp/__init__.py +7 -0
- picux/protocols/mcp/client.py +69 -0
- picux/protocols/mcp/contract.py +67 -0
- picux/protocols/mcp/server.py +76 -0
- picux/sandbox/__init__.py +6 -0
- picux/sandbox/midnight_arbitrage.py +215 -0
- picux/sandbox/models.py +90 -0
- picux/sdk/__init__.py +13 -0
- picux/sdk/client.py +768 -0
- picux/sdk/external.py +245 -0
- picux/security/__init__.py +18 -0
- picux/security/auth.py +86 -0
- picux/security/config_validator.py +58 -0
- picux/security/policy.py +158 -0
- picux/security/secrets.py +144 -0
- picux/signals/__init__.py +1 -0
- picux/signals/community/__init__.py +24 -0
- picux/signals/community/adapters/__init__.py +7 -0
- picux/signals/community/adapters/reddit.py +37 -0
- picux/signals/community/adapters/shopify.py +23 -0
- picux/signals/community/adapters/web.py +23 -0
- picux/signals/community/disambiguation.py +51 -0
- picux/signals/community/intake.py +227 -0
- picux/signals/community/models.py +102 -0
- picux/signals/community/rules.py +91 -0
- picux/signals/community/scoring.py +64 -0
- picux/storage/__init__.py +41 -0
- picux/storage/agents.py +50 -0
- picux/storage/cases.py +440 -0
- picux/storage/channels.py +476 -0
- picux/storage/connectors.py +411 -0
- picux/storage/envelopes.py +137 -0
- picux/storage/escrows.py +168 -0
- picux/storage/events.py +989 -0
- picux/storage/keyspace.py +60 -0
- picux/storage/mandates.py +107 -0
- picux/storage/portals.py +222 -0
- picux/storage/postgres.py +2049 -0
- picux/storage/providers.py +148 -0
- picux/storage/proxy.py +231 -0
- picux/storage/receipts.py +131 -0
- picux/storage/signals.py +147 -0
- picux/storage/tasks.py +179 -0
- picux/tools/__init__.py +11 -0
- picux/tools/shared.py +2048 -0
- picux/verification/__init__.py +5 -0
- picux/verification/rollout.py +183 -0
- picux/workflows/__init__.py +5 -0
- picux/workflows/templates.py +74 -0
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
import hashlib
|
|
4
|
+
import json
|
|
5
|
+
from typing import Any
|
|
6
|
+
|
|
7
|
+
from picux.contracts.integration import integrationManifest
|
|
8
|
+
from picux.contracts.routes import CONTRACT_ENDPOINTS
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
CORE_DOMAINS = ("hunt", "resolve", "bridge", "channels", "cases", "pay", "proxy")
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
def protocolMap() -> dict[str, Any]:
|
|
15
|
+
"""Return the JSON-LD protocol map for agent-readable discovery."""
|
|
16
|
+
|
|
17
|
+
payload = _protocolMapPayload()
|
|
18
|
+
payload["digest"] = protocolMapDigest(payload)
|
|
19
|
+
return payload
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
def protocolMapDigest(payload: dict[str, Any] | None = None) -> str:
|
|
23
|
+
"""Return a stable digest for protocol map cache validation."""
|
|
24
|
+
|
|
25
|
+
data = dict(payload or _protocolMapPayload())
|
|
26
|
+
data.pop("digest", None)
|
|
27
|
+
raw = json.dumps(data, ensure_ascii=True, sort_keys=True, separators=(",", ":"))
|
|
28
|
+
return "sha256:" + hashlib.sha256(raw.encode("utf-8")).hexdigest()
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
def _protocolMapPayload() -> dict[str, Any]:
|
|
32
|
+
manifest = integrationManifest()
|
|
33
|
+
contracts = manifest.get("contracts", {}) if isinstance(manifest.get("contracts"), dict) else {}
|
|
34
|
+
return {
|
|
35
|
+
"@context": {
|
|
36
|
+
"picux": "https://schemas.picux.io/",
|
|
37
|
+
"name": "https://schema.org/name",
|
|
38
|
+
"description": "https://schema.org/description",
|
|
39
|
+
"version": "picux:version",
|
|
40
|
+
"source": "picux:source",
|
|
41
|
+
"digest": "picux:digest",
|
|
42
|
+
"domain": "picux:domain",
|
|
43
|
+
"surface": "picux:surface",
|
|
44
|
+
"route": "picux:route",
|
|
45
|
+
"schemaId": "picux:schemaId",
|
|
46
|
+
"mcpTool": "picux:mcpTool",
|
|
47
|
+
"sdkHelper": "picux:sdkHelper",
|
|
48
|
+
"guide": "picux:guide",
|
|
49
|
+
"policy": "picux:policy",
|
|
50
|
+
"required": "picux:required",
|
|
51
|
+
"actions": "picux:actions",
|
|
52
|
+
"resource": "picux:resource",
|
|
53
|
+
"painPoint": "picux:painPoint",
|
|
54
|
+
"outcome": "picux:outcome",
|
|
55
|
+
"adoptionBlocker": "picux:adoptionBlocker",
|
|
56
|
+
"enhancement": "picux:enhancement",
|
|
57
|
+
"proofPack": "picux:proofPack",
|
|
58
|
+
"reviewProtocol": "picux:reviewProtocol",
|
|
59
|
+
},
|
|
60
|
+
"@id": "https://schemas.picux.io/protocol",
|
|
61
|
+
"@type": "picux:Protocol",
|
|
62
|
+
"name": "Picux Protocol",
|
|
63
|
+
"description": "Agentic economy infrastructure for external apps, services, and agents.",
|
|
64
|
+
"version": str(manifest.get("version", "")),
|
|
65
|
+
"source": {"name": "manifest", "route": str(contracts.get("manifest", "/v1/manifest"))},
|
|
66
|
+
"surface": _surfaces(manifest),
|
|
67
|
+
"domain": [_domainEntry(manifest["domains"][name]) for name in CORE_DOMAINS] + _supportDomains(),
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
def _surfaces(manifest: dict[str, Any]) -> list[dict[str, str]]:
|
|
72
|
+
contracts = manifest.get("contracts", {}) if isinstance(manifest.get("contracts"), dict) else {}
|
|
73
|
+
return [
|
|
74
|
+
{"name": "api", "route": str(contracts.get("api", "/openapi.json"))},
|
|
75
|
+
{"name": "status", "route": "/v1/status"},
|
|
76
|
+
{"name": "manifest", "route": str(contracts.get("manifest", "/v1/manifest"))},
|
|
77
|
+
{"name": "protocolMap", "route": str(contracts.get("protocolMap", "/v1/protocol-map"))},
|
|
78
|
+
{"name": "schemas", "route": str(contracts.get("schemas", "/v1/schemas"))},
|
|
79
|
+
{"name": "mcp", "route": str(contracts.get("mcp", "/mcp"))},
|
|
80
|
+
{"name": "a2a", "route": str(contracts.get("a2a", "/v1/a2a/contract"))},
|
|
81
|
+
{"name": "benchmarks", "route": "/v1/benchmarks/local"},
|
|
82
|
+
]
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
def _domainEntry(capability: dict[str, Any]) -> dict[str, Any]:
|
|
86
|
+
return {
|
|
87
|
+
"name": str(capability["id"]),
|
|
88
|
+
"description": str(capability["desc"]),
|
|
89
|
+
"route": [dict(route) for route in capability.get("routes", []) if isinstance(route, dict)],
|
|
90
|
+
"schemaId": list(capability.get("schemas", [])),
|
|
91
|
+
"mcpTool": list(capability.get("mcpTools", [])),
|
|
92
|
+
"sdkHelper": list(capability.get("sdkHelpers", [])),
|
|
93
|
+
"guide": str(capability.get("guide", "")),
|
|
94
|
+
"policy": capability.get("policy", {"required": False, "actions": [], "resource": ""}),
|
|
95
|
+
"painPoint": list(capability.get("painPoints", [])),
|
|
96
|
+
"outcome": list(capability.get("outcomes", [])),
|
|
97
|
+
"adoptionBlocker": list(capability.get("adoptionBlockers", [])),
|
|
98
|
+
"enhancement": list(capability.get("enhancements", [])),
|
|
99
|
+
"proofPack": str(capability.get("proofPack", "")),
|
|
100
|
+
"reviewProtocol": str(capability.get("reviewProtocol", "")),
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
def _supportDomains() -> list[dict[str, Any]]:
|
|
105
|
+
return [
|
|
106
|
+
{
|
|
107
|
+
"name": "workflows",
|
|
108
|
+
"description": "Use-case-first flagship templates for Hunt, Resolve, and Proxy.",
|
|
109
|
+
"route": _routeMapsForTags(("workflows",)),
|
|
110
|
+
"schemaId": ["workflowTemplate", "proofCard", "proofPack"],
|
|
111
|
+
"mcpTool": ["picux.listWorkflowTemplates", "picux.getWorkflowTemplate", "picux.runWorkflowTemplate"],
|
|
112
|
+
"sdkHelper": ["PicuxClient.listWorkflowTemplates", "PicuxClient.getWorkflowTemplate", "PicuxClient.runWorkflowTemplate"],
|
|
113
|
+
"guide": "docs/developers/workflows.md",
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
"name": "security",
|
|
117
|
+
"description": "Mandate-session decisions, capability grants, and redacted secret-reference checks.",
|
|
118
|
+
"route": _routeMapsForPaths(("/v1/status", "/v1/security/policy/evaluate", "/v1/security/secrets/check")),
|
|
119
|
+
"schemaId": ["apiStatus", "capabilityGrant", "mandateSession", "policyDecision", "secretCheck"],
|
|
120
|
+
"mcpTool": ["picux.apiStatus", "picux.evaluatePolicy", "picux.checkSecrets"],
|
|
121
|
+
"sdkHelper": ["PicuxClient.apiStatus", "PicuxClient.evaluatePolicy", "PicuxClient.checkSecrets"],
|
|
122
|
+
"guide": "docs/developers/security.md",
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
"name": "sandbox",
|
|
126
|
+
"description": "Developer test client for the Picux Orchestrator plus deterministic benchmark traces.",
|
|
127
|
+
"route": _routeMapsForTags(("sandbox", "orchestrator")),
|
|
128
|
+
"schemaId": ["sandboxRun"],
|
|
129
|
+
"mcpTool": ["picux.runSandbox", "picux.runOrchestrator"],
|
|
130
|
+
"sdkHelper": ["PicuxClient.runSandbox", "PicuxClient.runOrchestrator", "PicuxClient.streamOrchestrator"],
|
|
131
|
+
"guide": "docs/developers/getting-started.md",
|
|
132
|
+
},
|
|
133
|
+
{
|
|
134
|
+
"name": "benchmarks",
|
|
135
|
+
"description": "Local measured evidence and public-claim labels.",
|
|
136
|
+
"route": _routeMapsForTags(("benchmarks",)),
|
|
137
|
+
"schemaId": ["benchmarkReport"],
|
|
138
|
+
"mcpTool": ["picux.runBenchmark"],
|
|
139
|
+
"sdkHelper": ["PicuxClient.runBenchmark"],
|
|
140
|
+
"guide": "docs/developers/benchmarks.md",
|
|
141
|
+
},
|
|
142
|
+
]
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
def _routeMapsForPaths(paths: tuple[str, ...]) -> list[dict[str, Any]]:
|
|
146
|
+
wanted = set(paths)
|
|
147
|
+
return [endpoint.toMap() for endpoint in CONTRACT_ENDPOINTS if endpoint.path in wanted]
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
def _routeMapsForTags(tags: tuple[str, ...]) -> list[dict[str, Any]]:
|
|
151
|
+
wanted = set(tags)
|
|
152
|
+
return [endpoint.toMap() for endpoint in CONTRACT_ENDPOINTS if endpoint.tag in wanted]
|