twzrd-agent-intel 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.
Files changed (50) hide show
  1. twzrd_agent_intel-0.1.0/PKG-INFO +167 -0
  2. twzrd_agent_intel-0.1.0/README.md +125 -0
  3. twzrd_agent_intel-0.1.0/pyproject.toml +79 -0
  4. twzrd_agent_intel-0.1.0/setup.cfg +4 -0
  5. twzrd_agent_intel-0.1.0/src/twzrd_agent_intel/__init__.py +3 -0
  6. twzrd_agent_intel-0.1.0/src/twzrd_agent_intel/batch_artifact.py +542 -0
  7. twzrd_agent_intel-0.1.0/src/twzrd_agent_intel/config.py +48 -0
  8. twzrd_agent_intel-0.1.0/src/twzrd_agent_intel/db_ingest.py +402 -0
  9. twzrd_agent_intel-0.1.0/src/twzrd_agent_intel/mcp/preflight_registration_example.py +44 -0
  10. twzrd_agent_intel-0.1.0/src/twzrd_agent_intel/mcp/server.py +392 -0
  11. twzrd_agent_intel-0.1.0/src/twzrd_agent_intel/publisher.py +381 -0
  12. twzrd_agent_intel-0.1.0/src/twzrd_agent_intel/receipt.py +531 -0
  13. twzrd_agent_intel-0.1.0/src/twzrd_agent_intel/receipt_signing.py +263 -0
  14. twzrd_agent_intel-0.1.0/src/twzrd_agent_intel/server_http.py +1787 -0
  15. twzrd_agent_intel-0.1.0/src/twzrd_agent_intel/tools/__init__.py +45 -0
  16. twzrd_agent_intel-0.1.0/src/twzrd_agent_intel/tools/attention.py +81 -0
  17. twzrd_agent_intel-0.1.0/src/twzrd_agent_intel/tools/identity.py +47 -0
  18. twzrd_agent_intel-0.1.0/src/twzrd_agent_intel/tools/intel_scoring.py +272 -0
  19. twzrd_agent_intel-0.1.0/src/twzrd_agent_intel/tools/preflight.py +582 -0
  20. twzrd_agent_intel-0.1.0/src/twzrd_agent_intel/tools/provider_signals.py +244 -0
  21. twzrd_agent_intel-0.1.0/src/twzrd_agent_intel/tools/readiness_card.py +111 -0
  22. twzrd_agent_intel-0.1.0/src/twzrd_agent_intel/tools/reputation.py +99 -0
  23. twzrd_agent_intel-0.1.0/src/twzrd_agent_intel/tools/x402_receipts.py +148 -0
  24. twzrd_agent_intel-0.1.0/src/twzrd_agent_intel/trust_api.py +207 -0
  25. twzrd_agent_intel-0.1.0/src/twzrd_agent_intel/trust_renorm.py +132 -0
  26. twzrd_agent_intel-0.1.0/src/twzrd_agent_intel/wash_signal.py +157 -0
  27. twzrd_agent_intel-0.1.0/src/twzrd_agent_intel.egg-info/PKG-INFO +167 -0
  28. twzrd_agent_intel-0.1.0/src/twzrd_agent_intel.egg-info/SOURCES.txt +48 -0
  29. twzrd_agent_intel-0.1.0/src/twzrd_agent_intel.egg-info/dependency_links.txt +1 -0
  30. twzrd_agent_intel-0.1.0/src/twzrd_agent_intel.egg-info/entry_points.txt +2 -0
  31. twzrd_agent_intel-0.1.0/src/twzrd_agent_intel.egg-info/requires.txt +18 -0
  32. twzrd_agent_intel-0.1.0/src/twzrd_agent_intel.egg-info/top_level.txt +1 -0
  33. twzrd_agent_intel-0.1.0/tests/test_batch_artifact.py +743 -0
  34. twzrd_agent_intel-0.1.0/tests/test_cosign_feepayer.py +263 -0
  35. twzrd_agent_intel-0.1.0/tests/test_db_ingest.py +464 -0
  36. twzrd_agent_intel-0.1.0/tests/test_dflow_deliverable.py +77 -0
  37. twzrd_agent_intel-0.1.0/tests/test_intel_leaderboard_wash.py +38 -0
  38. twzrd_agent_intel-0.1.0/tests/test_mcp_server.py +124 -0
  39. twzrd_agent_intel-0.1.0/tests/test_preflight_http.py +189 -0
  40. twzrd_agent_intel-0.1.0/tests/test_preflight_v0.py +149 -0
  41. twzrd_agent_intel-0.1.0/tests/test_provider_signals.py +45 -0
  42. twzrd_agent_intel-0.1.0/tests/test_publisher.py +357 -0
  43. twzrd_agent_intel-0.1.0/tests/test_receipt_v5.py +280 -0
  44. twzrd_agent_intel-0.1.0/tests/test_server_http_cors.py +17 -0
  45. twzrd_agent_intel-0.1.0/tests/test_server_http_discovery_cards.py +46 -0
  46. twzrd_agent_intel-0.1.0/tests/test_server_http_signal_source.py +109 -0
  47. twzrd_agent_intel-0.1.0/tests/test_settle_when_deliverable.py +204 -0
  48. twzrd_agent_intel-0.1.0/tests/test_trust_api.py +68 -0
  49. twzrd_agent_intel-0.1.0/tests/test_trust_renorm.py +103 -0
  50. twzrd_agent_intel-0.1.0/tests/test_wash_signal.py +68 -0
@@ -0,0 +1,167 @@
1
+ Metadata-Version: 2.4
2
+ Name: twzrd-agent-intel
3
+ Version: 0.1.0
4
+ Summary: Trust + receipt layer that Solana agents call before and after paying over x402 — free preflight readiness cards, paid signed V5 trust receipts, and a wash/Sybil-resistant agent reputation corpus. MCP + HTTP.
5
+ Author-email: twzrd <twzrd@twzrd.xyz>
6
+ License: MIT
7
+ Project-URL: Homepage, https://intel.twzrd.xyz
8
+ Project-URL: Documentation, https://intel.twzrd.xyz/llms.txt
9
+ Project-URL: Agent Card, https://intel.twzrd.xyz/.well-known/agent-card.json
10
+ Project-URL: MCP Card, https://intel.twzrd.xyz/.well-known/mcp.json
11
+ Project-URL: Public Leaderboard, https://twzrd.xyz/leaderboard
12
+ Project-URL: Repository, https://github.com/twzrd-sol/wzrd-final
13
+ Keywords: x402,agent,agentic-commerce,reputation,trust,solana,micropayments,usdc,mcp,preflight,readiness-card,receipts,ai-agents,autonomous-agents
14
+ Classifier: Development Status :: 4 - Beta
15
+ Classifier: Intended Audience :: Developers
16
+ Classifier: License :: OSI Approved :: MIT License
17
+ Classifier: Programming Language :: Python :: 3
18
+ Classifier: Programming Language :: Python :: 3.11
19
+ Classifier: Programming Language :: Python :: 3.12
20
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
21
+ Classifier: Topic :: Office/Business :: Financial
22
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
23
+ Requires-Python: >=3.11
24
+ Description-Content-Type: text/markdown
25
+ Requires-Dist: fastapi>=0.104
26
+ Requires-Dist: uvicorn[standard]>=0.24
27
+ Requires-Dist: pydantic>=2.0
28
+ Requires-Dist: httpx>=0.25
29
+ Requires-Dist: python-dotenv>=1.0
30
+ Requires-Dist: solders>=0.21
31
+ Requires-Dist: solana>=0.36
32
+ Requires-Dist: x402[fastapi,svm]>=0.4.2
33
+ Requires-Dist: mcp>=1.10.1
34
+ Requires-Dist: pycryptodome>=3.20
35
+ Requires-Dist: psycopg2-binary>=2.9
36
+ Provides-Extra: dev
37
+ Requires-Dist: pytest>=7.4; extra == "dev"
38
+ Requires-Dist: pytest-asyncio>=0.21; extra == "dev"
39
+ Requires-Dist: pytest-cov>=4.1; extra == "dev"
40
+ Requires-Dist: ruff>=0.1; extra == "dev"
41
+ Requires-Dist: mypy>=1.5; extra == "dev"
42
+
43
+ # twzrd-agent-intel
44
+
45
+ **The trust + receipt layer that Solana agents call before and after paying over x402.**
46
+
47
+ Before an autonomous agent pays a stranger's API, it should be able to answer one
48
+ question: *should I pay this, and what proof will I get?* `twzrd-agent-intel` answers
49
+ it. Free **preflight readiness cards** score any x402 resource on a wash/Sybil-resistant
50
+ reputation corpus; a paid **trust endpoint** returns a portable, offline-verifiable
51
+ **signed V5 receipt**. Live on Solana mainnet.
52
+
53
+ - Live API: https://intel.twzrd.xyz
54
+ - Public agent leaderboard: https://twzrd.xyz/leaderboard
55
+ - Agent card: https://intel.twzrd.xyz/.well-known/agent-card.json
56
+ - MCP card: https://intel.twzrd.xyz/.well-known/mcp.json
57
+
58
+ ---
59
+
60
+ ## Install
61
+
62
+ ```bash
63
+ pip install twzrd-agent-intel
64
+ ```
65
+
66
+ This installs the MCP server console script `twzrd-agent-intel-mcp` and the Python
67
+ package `twzrd_agent_intel`.
68
+
69
+ ## Two surfaces, same data
70
+
71
+ | Surface | Best for | How to reach |
72
+ |---------|----------|--------------|
73
+ | **MCP** (recommended) | Claude Code, agent frameworks, tool-calling agents | `twzrd-agent-intel-mcp` (stdio) or `--sse` |
74
+ | **HTTP** | Direct calls, custom routers, testing | `POST /v1/intel/preflight` (free), `GET /v1/intel/trust/{pubkey}` (0.05 USDC) |
75
+
76
+ ## 60-second flow: don't pay blind
77
+
78
+ The canonical pattern a well-behaved agent follows before spending:
79
+
80
+ 1. Call the **free** preflight with the resource you're about to pay and your intent.
81
+ 2. Inspect `decision`, `can_spend`, and `trust_score`. Fail closed on `block`.
82
+ 3. If you proceed and want durable proof, fetch the **paid** trust receipt and store
83
+ the V5 leaf + preimage for later offline verification or on-chain anchoring.
84
+
85
+ ```bash
86
+ # 1. Free preflight against the live mainnet API
87
+ curl -s -X POST https://intel.twzrd.xyz/v1/intel/preflight \
88
+ -H "Content-Type: application/json" \
89
+ -d '{
90
+ "resource_name": "Jupiter Quote Preview",
91
+ "seller_wallet": "6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P",
92
+ "agent_intent": "swap_quote"
93
+ }'
94
+ ```
95
+
96
+ Returns the canonical `ReadinessCard` (`decision`, `trust_score`, `can_spend`, `proof`,
97
+ `caveats`, `next_fixes`, and the `paid_deep_dive` path).
98
+
99
+ ```bash
100
+ # 2. Verify a signed receipt offline BEFORE you ever spend — free sample, no wallet
101
+ curl -s https://intel.twzrd.xyz/v1/receipts/example
102
+ ```
103
+
104
+ The paid deep dive (`GET /v1/intel/trust/{pubkey}`, 0.05 USDC over x402) returns the
105
+ full trust object plus a portable, Ed25519-signed V5 receipt leaf you can verify
106
+ without trusting our server.
107
+
108
+ ## MCP: wire into Claude Code / Claude Desktop
109
+
110
+ ```json
111
+ {
112
+ "mcpServers": {
113
+ "twzrd-agent-intel": {
114
+ "command": "twzrd-agent-intel-mcp",
115
+ "type": "stdio"
116
+ }
117
+ }
118
+ }
119
+ ```
120
+
121
+ After restart, agents see tools including:
122
+
123
+ - `get_readiness_card_tool` — **primary**; returns the canonical ReadinessCard shape
124
+ - `dexter_preflight` — lower-level (full evidence, `max_spend_recommendation_usdc`, upsell)
125
+ - `get_top_intel_agents` — agent leaderboard discovery
126
+ - DFlow market-intelligence tools (orderbook depth, visibility map, market shape)
127
+
128
+ The paid trust receipt is intentionally exposed over HTTP x402, not MCP.
129
+
130
+ ## Run the servers locally
131
+
132
+ ```bash
133
+ # MCP (stdio — default for most agents)
134
+ twzrd-agent-intel-mcp
135
+ # MCP over SSE (remote / web agents)
136
+ twzrd-agent-intel-mcp --sse
137
+ # HTTP server
138
+ uvicorn twzrd_agent_intel.server_http:app --port 8001
139
+ ```
140
+
141
+ ## Signal sources
142
+
143
+ By default the surface uses a small static research registry (good for testing). Point
144
+ it at live data with environment variables:
145
+
146
+ | `TWZRD_SIGNAL_SOURCE` | What it does |
147
+ |-----------------------|--------------|
148
+ | `artifacts` | Aggregate your own real settlement volume from `TWZRD_ARTIFACTS_DIR` |
149
+ | `bazaar` | Pull the live cross-facilitator x402 catalog (CDP Bazaar `/resources` + `/merchant`) |
150
+
151
+ TWZRD is the **judgment layer** ("should this agent pay?") on top of the public x402
152
+ directories — it does not duplicate the listing function. Combine `bazaar` (discovery)
153
+ with `artifacts` (your receipt volume) for the strongest signal.
154
+
155
+ ## What makes the score trustworthy
156
+
157
+ - **Wash/Sybil-resistant**: circular-flow and reciprocal-wash discounting on a 42k-wallet
158
+ cross-facilitator corpus; breadth floor on counterparties.
159
+ - **Honest basis**: trust components are renormalized (`score_version intel_renorm_v1`) so
160
+ arbitrary wallets aren't penalized for lacking TWZRD-native execution history.
161
+ - **Verifiable**: every paid response carries a signed V5 receipt; verify it offline with
162
+ the free `/v1/receipts/example` + `/v1/receipts/verify` endpoints before you trust the
163
+ paid path.
164
+
165
+ ## License
166
+
167
+ MIT
@@ -0,0 +1,125 @@
1
+ # twzrd-agent-intel
2
+
3
+ **The trust + receipt layer that Solana agents call before and after paying over x402.**
4
+
5
+ Before an autonomous agent pays a stranger's API, it should be able to answer one
6
+ question: *should I pay this, and what proof will I get?* `twzrd-agent-intel` answers
7
+ it. Free **preflight readiness cards** score any x402 resource on a wash/Sybil-resistant
8
+ reputation corpus; a paid **trust endpoint** returns a portable, offline-verifiable
9
+ **signed V5 receipt**. Live on Solana mainnet.
10
+
11
+ - Live API: https://intel.twzrd.xyz
12
+ - Public agent leaderboard: https://twzrd.xyz/leaderboard
13
+ - Agent card: https://intel.twzrd.xyz/.well-known/agent-card.json
14
+ - MCP card: https://intel.twzrd.xyz/.well-known/mcp.json
15
+
16
+ ---
17
+
18
+ ## Install
19
+
20
+ ```bash
21
+ pip install twzrd-agent-intel
22
+ ```
23
+
24
+ This installs the MCP server console script `twzrd-agent-intel-mcp` and the Python
25
+ package `twzrd_agent_intel`.
26
+
27
+ ## Two surfaces, same data
28
+
29
+ | Surface | Best for | How to reach |
30
+ |---------|----------|--------------|
31
+ | **MCP** (recommended) | Claude Code, agent frameworks, tool-calling agents | `twzrd-agent-intel-mcp` (stdio) or `--sse` |
32
+ | **HTTP** | Direct calls, custom routers, testing | `POST /v1/intel/preflight` (free), `GET /v1/intel/trust/{pubkey}` (0.05 USDC) |
33
+
34
+ ## 60-second flow: don't pay blind
35
+
36
+ The canonical pattern a well-behaved agent follows before spending:
37
+
38
+ 1. Call the **free** preflight with the resource you're about to pay and your intent.
39
+ 2. Inspect `decision`, `can_spend`, and `trust_score`. Fail closed on `block`.
40
+ 3. If you proceed and want durable proof, fetch the **paid** trust receipt and store
41
+ the V5 leaf + preimage for later offline verification or on-chain anchoring.
42
+
43
+ ```bash
44
+ # 1. Free preflight against the live mainnet API
45
+ curl -s -X POST https://intel.twzrd.xyz/v1/intel/preflight \
46
+ -H "Content-Type: application/json" \
47
+ -d '{
48
+ "resource_name": "Jupiter Quote Preview",
49
+ "seller_wallet": "6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P",
50
+ "agent_intent": "swap_quote"
51
+ }'
52
+ ```
53
+
54
+ Returns the canonical `ReadinessCard` (`decision`, `trust_score`, `can_spend`, `proof`,
55
+ `caveats`, `next_fixes`, and the `paid_deep_dive` path).
56
+
57
+ ```bash
58
+ # 2. Verify a signed receipt offline BEFORE you ever spend — free sample, no wallet
59
+ curl -s https://intel.twzrd.xyz/v1/receipts/example
60
+ ```
61
+
62
+ The paid deep dive (`GET /v1/intel/trust/{pubkey}`, 0.05 USDC over x402) returns the
63
+ full trust object plus a portable, Ed25519-signed V5 receipt leaf you can verify
64
+ without trusting our server.
65
+
66
+ ## MCP: wire into Claude Code / Claude Desktop
67
+
68
+ ```json
69
+ {
70
+ "mcpServers": {
71
+ "twzrd-agent-intel": {
72
+ "command": "twzrd-agent-intel-mcp",
73
+ "type": "stdio"
74
+ }
75
+ }
76
+ }
77
+ ```
78
+
79
+ After restart, agents see tools including:
80
+
81
+ - `get_readiness_card_tool` — **primary**; returns the canonical ReadinessCard shape
82
+ - `dexter_preflight` — lower-level (full evidence, `max_spend_recommendation_usdc`, upsell)
83
+ - `get_top_intel_agents` — agent leaderboard discovery
84
+ - DFlow market-intelligence tools (orderbook depth, visibility map, market shape)
85
+
86
+ The paid trust receipt is intentionally exposed over HTTP x402, not MCP.
87
+
88
+ ## Run the servers locally
89
+
90
+ ```bash
91
+ # MCP (stdio — default for most agents)
92
+ twzrd-agent-intel-mcp
93
+ # MCP over SSE (remote / web agents)
94
+ twzrd-agent-intel-mcp --sse
95
+ # HTTP server
96
+ uvicorn twzrd_agent_intel.server_http:app --port 8001
97
+ ```
98
+
99
+ ## Signal sources
100
+
101
+ By default the surface uses a small static research registry (good for testing). Point
102
+ it at live data with environment variables:
103
+
104
+ | `TWZRD_SIGNAL_SOURCE` | What it does |
105
+ |-----------------------|--------------|
106
+ | `artifacts` | Aggregate your own real settlement volume from `TWZRD_ARTIFACTS_DIR` |
107
+ | `bazaar` | Pull the live cross-facilitator x402 catalog (CDP Bazaar `/resources` + `/merchant`) |
108
+
109
+ TWZRD is the **judgment layer** ("should this agent pay?") on top of the public x402
110
+ directories — it does not duplicate the listing function. Combine `bazaar` (discovery)
111
+ with `artifacts` (your receipt volume) for the strongest signal.
112
+
113
+ ## What makes the score trustworthy
114
+
115
+ - **Wash/Sybil-resistant**: circular-flow and reciprocal-wash discounting on a 42k-wallet
116
+ cross-facilitator corpus; breadth floor on counterparties.
117
+ - **Honest basis**: trust components are renormalized (`score_version intel_renorm_v1`) so
118
+ arbitrary wallets aren't penalized for lacking TWZRD-native execution history.
119
+ - **Verifiable**: every paid response carries a signed V5 receipt; verify it offline with
120
+ the free `/v1/receipts/example` + `/v1/receipts/verify` endpoints before you trust the
121
+ paid path.
122
+
123
+ ## License
124
+
125
+ MIT
@@ -0,0 +1,79 @@
1
+ [build-system]
2
+ requires = ["setuptools>=68.0", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "twzrd-agent-intel"
7
+ version = "0.1.0"
8
+ description = "Trust + receipt layer that Solana agents call before and after paying over x402 — free preflight readiness cards, paid signed V5 trust receipts, and a wash/Sybil-resistant agent reputation corpus. MCP + HTTP."
9
+ readme = "README.md"
10
+ license = { text = "MIT" }
11
+ authors = [{ name = "twzrd", email = "twzrd@twzrd.xyz" }]
12
+ keywords = [
13
+ "x402",
14
+ "agent",
15
+ "agentic-commerce",
16
+ "reputation",
17
+ "trust",
18
+ "solana",
19
+ "micropayments",
20
+ "usdc",
21
+ "mcp",
22
+ "preflight",
23
+ "readiness-card",
24
+ "receipts",
25
+ "ai-agents",
26
+ "autonomous-agents",
27
+ ]
28
+ classifiers = [
29
+ "Development Status :: 4 - Beta",
30
+ "Intended Audience :: Developers",
31
+ "License :: OSI Approved :: MIT License",
32
+ "Programming Language :: Python :: 3",
33
+ "Programming Language :: Python :: 3.11",
34
+ "Programming Language :: Python :: 3.12",
35
+ "Topic :: Scientific/Engineering :: Artificial Intelligence",
36
+ "Topic :: Office/Business :: Financial",
37
+ "Topic :: Software Development :: Libraries :: Python Modules",
38
+ ]
39
+ requires-python = ">=3.11"
40
+ dependencies = [
41
+ "fastapi>=0.104",
42
+ "uvicorn[standard]>=0.24",
43
+ "pydantic>=2.0",
44
+ "httpx>=0.25",
45
+ "python-dotenv>=1.0",
46
+ "solders>=0.21",
47
+ "solana>=0.36",
48
+ "x402[fastapi,svm]>=0.4.2",
49
+ "mcp>=1.10.1",
50
+ "pycryptodome>=3.20",
51
+ "psycopg2-binary>=2.9",
52
+ ]
53
+
54
+ [project.urls]
55
+ Homepage = "https://intel.twzrd.xyz"
56
+ Documentation = "https://intel.twzrd.xyz/llms.txt"
57
+ "Agent Card" = "https://intel.twzrd.xyz/.well-known/agent-card.json"
58
+ "MCP Card" = "https://intel.twzrd.xyz/.well-known/mcp.json"
59
+ "Public Leaderboard" = "https://twzrd.xyz/leaderboard"
60
+ Repository = "https://github.com/twzrd-sol/wzrd-final"
61
+
62
+ [project.optional-dependencies]
63
+ dev = [
64
+ "pytest>=7.4",
65
+ "pytest-asyncio>=0.21",
66
+ "pytest-cov>=4.1",
67
+ "ruff>=0.1",
68
+ "mypy>=1.5",
69
+ ]
70
+
71
+ [project.scripts]
72
+ twzrd-agent-intel-mcp = "twzrd_agent_intel.mcp.server:main"
73
+
74
+ [tool.pytest.ini_options]
75
+ # anyio handles async tests via @pytest.mark.anyio — no asyncio_mode needed
76
+
77
+ [tool.setuptools.packages.find]
78
+ where = ["src"]
79
+ exclude = []
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,3 @@
1
+ """TWZRD Agent Intelligence - Agent reputation and attention signals via x402."""
2
+
3
+ __version__ = "0.1.0"