ctxprotocol 0.14.0__tar.gz → 0.16.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 (53) hide show
  1. {ctxprotocol-0.14.0 → ctxprotocol-0.16.0}/PKG-INFO +8 -9
  2. {ctxprotocol-0.14.0 → ctxprotocol-0.16.0}/README.md +7 -8
  3. {ctxprotocol-0.14.0 → ctxprotocol-0.16.0}/ctxprotocol/__init__.py +1 -1
  4. {ctxprotocol-0.14.0 → ctxprotocol-0.16.0}/ctxprotocol/client/resources/query.py +4 -2
  5. {ctxprotocol-0.14.0 → ctxprotocol-0.16.0}/ctxprotocol/client/types.py +6 -5
  6. {ctxprotocol-0.14.0 → ctxprotocol-0.16.0}/ctxprotocol/context/hyperliquid.py +13 -0
  7. {ctxprotocol-0.14.0 → ctxprotocol-0.16.0}/ctxprotocol/context/polymarket.py +13 -2
  8. {ctxprotocol-0.14.0 → ctxprotocol-0.16.0}/examples/server/hummingbot-contributor/requirements.txt +1 -1
  9. {ctxprotocol-0.14.0 → ctxprotocol-0.16.0}/pyproject.toml +1 -1
  10. {ctxprotocol-0.14.0 → ctxprotocol-0.16.0}/.codexignore +0 -0
  11. {ctxprotocol-0.14.0 → ctxprotocol-0.16.0}/.gitignore +0 -0
  12. {ctxprotocol-0.14.0 → ctxprotocol-0.16.0}/ctxprotocol/auth/__init__.py +0 -0
  13. {ctxprotocol-0.14.0 → ctxprotocol-0.16.0}/ctxprotocol/client/__init__.py +0 -0
  14. {ctxprotocol-0.14.0 → ctxprotocol-0.16.0}/ctxprotocol/client/client.py +0 -0
  15. {ctxprotocol-0.14.0 → ctxprotocol-0.16.0}/ctxprotocol/client/resources/__init__.py +0 -0
  16. {ctxprotocol-0.14.0 → ctxprotocol-0.16.0}/ctxprotocol/client/resources/developer.py +0 -0
  17. {ctxprotocol-0.14.0 → ctxprotocol-0.16.0}/ctxprotocol/client/resources/discovery.py +0 -0
  18. {ctxprotocol-0.14.0 → ctxprotocol-0.16.0}/ctxprotocol/client/resources/tools.py +0 -0
  19. {ctxprotocol-0.14.0 → ctxprotocol-0.16.0}/ctxprotocol/context/__init__.py +0 -0
  20. {ctxprotocol-0.14.0 → ctxprotocol-0.16.0}/ctxprotocol/context/wallet.py +0 -0
  21. {ctxprotocol-0.14.0 → ctxprotocol-0.16.0}/ctxprotocol/contrib/__init__.py +0 -0
  22. {ctxprotocol-0.14.0 → ctxprotocol-0.16.0}/ctxprotocol/contrib/search/__init__.py +0 -0
  23. {ctxprotocol-0.14.0 → ctxprotocol-0.16.0}/ctxprotocol/contrib/search/core.py +0 -0
  24. {ctxprotocol-0.14.0 → ctxprotocol-0.16.0}/ctxprotocol/contrib/search/trace.py +0 -0
  25. {ctxprotocol-0.14.0 → ctxprotocol-0.16.0}/ctxprotocol/contrib/search/types.py +0 -0
  26. {ctxprotocol-0.14.0 → ctxprotocol-0.16.0}/ctxprotocol/contrib/search/validation.py +0 -0
  27. {ctxprotocol-0.14.0 → ctxprotocol-0.16.0}/ctxprotocol/handshake/__init__.py +0 -0
  28. {ctxprotocol-0.14.0 → ctxprotocol-0.16.0}/ctxprotocol/py.typed +0 -0
  29. {ctxprotocol-0.14.0 → ctxprotocol-0.16.0}/docs/README.md +0 -0
  30. {ctxprotocol-0.14.0 → ctxprotocol-0.16.0}/examples/client/execute_client.py +0 -0
  31. {ctxprotocol-0.14.0 → ctxprotocol-0.16.0}/examples/client/polymarket_query_trace_validation.py +0 -0
  32. {ctxprotocol-0.14.0 → ctxprotocol-0.16.0}/examples/client/query_client.py +0 -0
  33. {ctxprotocol-0.14.0 → ctxprotocol-0.16.0}/examples/client/test_favorites_only.py +0 -0
  34. {ctxprotocol-0.14.0 → ctxprotocol-0.16.0}/examples/client/test_get_tool.py +0 -0
  35. {ctxprotocol-0.14.0 → ctxprotocol-0.16.0}/examples/client/two_surfaces_client.py +0 -0
  36. {ctxprotocol-0.14.0 → ctxprotocol-0.16.0}/examples/client/validation/generate_contributor_search_validation_artifacts.py +0 -0
  37. {ctxprotocol-0.14.0 → ctxprotocol-0.16.0}/examples/client/validation/named-regression-iran-boots-on-ground.json +0 -0
  38. {ctxprotocol-0.14.0 → ctxprotocol-0.16.0}/examples/client/validation/named-regression-supreme-court-tariffs.json +0 -0
  39. {ctxprotocol-0.14.0 → ctxprotocol-0.16.0}/examples/client/validation/shared-capability-miss-unsupported-venue.json +0 -0
  40. {ctxprotocol-0.14.0 → ctxprotocol-0.16.0}/examples/client/validation/shared-generic-overlap-best-match.json +0 -0
  41. {ctxprotocol-0.14.0 → ctxprotocol-0.16.0}/examples/client/validation/shared-still-ambiguous-shortlist.json +0 -0
  42. {ctxprotocol-0.14.0 → ctxprotocol-0.16.0}/examples/server/hummingbot-contributor/README.md +0 -0
  43. {ctxprotocol-0.14.0 → ctxprotocol-0.16.0}/examples/server/hummingbot-contributor/env.example +0 -0
  44. {ctxprotocol-0.14.0 → ctxprotocol-0.16.0}/examples/server/hummingbot-contributor/server.py +0 -0
  45. {ctxprotocol-0.14.0 → ctxprotocol-0.16.0}/polymarket-query-trace-results-py.json +0 -0
  46. {ctxprotocol-0.14.0 → ctxprotocol-0.16.0}/tests/__init__.py +0 -0
  47. {ctxprotocol-0.14.0 → ctxprotocol-0.16.0}/tests/contrib_search_validation_cases.py +0 -0
  48. {ctxprotocol-0.14.0 → ctxprotocol-0.16.0}/tests/test_client.py +0 -0
  49. {ctxprotocol-0.14.0 → ctxprotocol-0.16.0}/tests/test_contrib_search.py +0 -0
  50. {ctxprotocol-0.14.0 → ctxprotocol-0.16.0}/tests/test_discovery.py +0 -0
  51. {ctxprotocol-0.14.0 → ctxprotocol-0.16.0}/tests/test_query.py +0 -0
  52. {ctxprotocol-0.14.0 → ctxprotocol-0.16.0}/tests/test_tools.py +0 -0
  53. {ctxprotocol-0.14.0 → ctxprotocol-0.16.0}/uv.lock +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ctxprotocol
3
- Version: 0.14.0
3
+ Version: 0.16.0
4
4
  Summary: Official Python SDK for the Context Protocol - Discover and execute AI tools programmatically
5
5
  Project-URL: Homepage, https://ctxprotocol.com
6
6
  Project-URL: Documentation, https://docs.ctxprotocol.com
@@ -42,7 +42,7 @@ Description-Content-Type: text/markdown
42
42
 
43
43
  Give your agent the live facts it's missing. Context is a pay-per-response data marketplace: your agent discovers tools at runtime, buys the data its question needs, and drops it straight into its context window — no API keys, no servers, no per-source integration work.
44
44
 
45
- Context Protocol is **pip for AI capabilities**. Just as you install packages to add functionality to your code, use the Context SDK to give your Agent instant access to thousands of live data sources and actions—from DeFi and Gas Oracles to Weather and Search.
45
+ Context Protocol is **pip for AI capabilities**. Just as you install packages to add functionality to your code, use the Context SDK to give your Agent instant access to premium data feeds and live tools: the market intelligence usually locked behind steep monthly or annual subscriptions, unbundled into pay-per-response, from crypto and on-chain analytics to gas oracles, weather, and search.
46
46
 
47
47
  [![PyPI version](https://img.shields.io/pypi/v/ctxprotocol.svg)](https://pypi.org/project/ctxprotocol/)
48
48
  [![Python versions](https://img.shields.io/pypi/pyversions/ctxprotocol.svg)](https://pypi.org/project/ctxprotocol/)
@@ -65,7 +65,7 @@ Grant batches open periodically — see [Developer Grants](https://docs.ctxproto
65
65
  ## Why use Context?
66
66
 
67
67
  - **🔌 One Interface, Everything:** Stop integrating APIs one by one. Use a single SDK to access any tool in the marketplace.
68
- - **🧠 Zero-Ops:** We're a gateway to the best MCP tools. Just send the JSON and get the result.
68
+ - **🧠 Zero-Ops:** We're the gateway to premium data feeds usually locked behind steep subscriptions. We host the connections; you just send the JSON and get the result.
69
69
  - **⚡️ Agentic Discovery:** Your Agent can search the marketplace at runtime to find tools it didn't know it needed.
70
70
  - **💸 Dual-Surface Economics:** Use Query for pay-per-response intelligence or Execute for session-budgeted method calls.
71
71
 
@@ -125,12 +125,12 @@ result = await client.tools.execute(
125
125
  print(result.session) # method_price, spent, remaining, max_spend, ...
126
126
  ```
127
127
 
128
- **Query mode** gives you a managed librarian contract — the server runs the live pipeline (`discover -> select -> iterative execute -> synthesize -> settle`) with model-aware context budgeting and can return plain answers or structured evidence packages for one flat fee:
128
+ **Query mode** gives you a managed librarian contract — the server runs the live pipeline (`discover -> select -> iterative execute -> synthesize -> settle`) with model-aware context budgeting and returns structured evidence packages for one flat fee:
129
129
  ```python
130
130
  answer = await client.query.run(
131
131
  query="What are the top whale movements on Base?",
132
132
  answer_model_id="glm-model", # optional: choose the final synthesis model
133
- response_shape="answer_with_evidence", # optional: answer | answer_with_evidence | evidence_only
133
+ response_shape="answer_with_evidence", # optional: answer_with_evidence (default) | evidence_only
134
134
  include_data_url=True, # optional: persist full execution data to blob
135
135
  include_developer_trace=True, # optional: include runtime developer trace
136
136
  )
@@ -156,9 +156,8 @@ print(answer.orchestration_metrics) # Optional first-pass / rediscovery metrics
156
156
 
157
157
  `response_shape` options:
158
158
 
159
- - `answer`: backward-compatible prose answer
160
- - `answer_with_evidence`: prose plus `summary`, `evidence`, `artifacts`, `freshness`, `confidence`, `usage`, `outcome`, and `controller`
161
- - `evidence_only`: machine-friendly summary plus the same evidence package for downstream agents
159
+ - `answer_with_evidence` (default): prose plus `summary`, `evidence`, `artifacts`, `freshness`, `confidence`, `usage`, `outcome`, and `controller`
160
+ - `evidence_only`: raw fetched data, computed artifacts, and provenance for downstream agents (no prose synthesis)
162
161
 
163
162
  Premium wedge answers can also expose `evidence.market_intelligence`, `view.rows`, `view.columns`, and the top-level controller fields `stop_reason`, `issue_class`, and `actions_taken`.
164
163
 
@@ -300,7 +299,7 @@ closed = await client.tools.close_session("sess_123")
300
299
 
301
300
  #### `client.query.run(query, tools?, answer_model_id?, include_data?, include_data_url?, include_developer_trace?, idempotency_key?)`
302
301
 
303
- Run an agentic query. The server applies the live librarian pipeline (`discover -> select -> iterative execute -> synthesize -> settle`) with up to 100 MCP calls per response turn, then returns the selected Query response contract (`answer`, `answer_with_evidence`, or `evidence_only`).
302
+ Run an agentic query. The server applies the live librarian pipeline (`discover -> select -> iterative execute -> synthesize -> settle`) with up to 100 MCP calls per response turn, then returns the selected Query response contract (`answer_with_evidence` or `evidence_only`, default `answer_with_evidence`).
304
303
 
305
304
  `client.query.run()` buffers the same SSE transport used by `client.query.stream()` and returns the final `done` result. This keeps Python aligned with the TypeScript SDK and the live query runtime.
306
305
 
@@ -4,7 +4,7 @@
4
4
 
5
5
  Give your agent the live facts it's missing. Context is a pay-per-response data marketplace: your agent discovers tools at runtime, buys the data its question needs, and drops it straight into its context window — no API keys, no servers, no per-source integration work.
6
6
 
7
- Context Protocol is **pip for AI capabilities**. Just as you install packages to add functionality to your code, use the Context SDK to give your Agent instant access to thousands of live data sources and actions—from DeFi and Gas Oracles to Weather and Search.
7
+ Context Protocol is **pip for AI capabilities**. Just as you install packages to add functionality to your code, use the Context SDK to give your Agent instant access to premium data feeds and live tools: the market intelligence usually locked behind steep monthly or annual subscriptions, unbundled into pay-per-response, from crypto and on-chain analytics to gas oracles, weather, and search.
8
8
 
9
9
  [![PyPI version](https://img.shields.io/pypi/v/ctxprotocol.svg)](https://pypi.org/project/ctxprotocol/)
10
10
  [![Python versions](https://img.shields.io/pypi/pyversions/ctxprotocol.svg)](https://pypi.org/project/ctxprotocol/)
@@ -27,7 +27,7 @@ Grant batches open periodically — see [Developer Grants](https://docs.ctxproto
27
27
  ## Why use Context?
28
28
 
29
29
  - **🔌 One Interface, Everything:** Stop integrating APIs one by one. Use a single SDK to access any tool in the marketplace.
30
- - **🧠 Zero-Ops:** We're a gateway to the best MCP tools. Just send the JSON and get the result.
30
+ - **🧠 Zero-Ops:** We're the gateway to premium data feeds usually locked behind steep subscriptions. We host the connections; you just send the JSON and get the result.
31
31
  - **⚡️ Agentic Discovery:** Your Agent can search the marketplace at runtime to find tools it didn't know it needed.
32
32
  - **💸 Dual-Surface Economics:** Use Query for pay-per-response intelligence or Execute for session-budgeted method calls.
33
33
 
@@ -87,12 +87,12 @@ result = await client.tools.execute(
87
87
  print(result.session) # method_price, spent, remaining, max_spend, ...
88
88
  ```
89
89
 
90
- **Query mode** gives you a managed librarian contract — the server runs the live pipeline (`discover -> select -> iterative execute -> synthesize -> settle`) with model-aware context budgeting and can return plain answers or structured evidence packages for one flat fee:
90
+ **Query mode** gives you a managed librarian contract — the server runs the live pipeline (`discover -> select -> iterative execute -> synthesize -> settle`) with model-aware context budgeting and returns structured evidence packages for one flat fee:
91
91
  ```python
92
92
  answer = await client.query.run(
93
93
  query="What are the top whale movements on Base?",
94
94
  answer_model_id="glm-model", # optional: choose the final synthesis model
95
- response_shape="answer_with_evidence", # optional: answer | answer_with_evidence | evidence_only
95
+ response_shape="answer_with_evidence", # optional: answer_with_evidence (default) | evidence_only
96
96
  include_data_url=True, # optional: persist full execution data to blob
97
97
  include_developer_trace=True, # optional: include runtime developer trace
98
98
  )
@@ -118,9 +118,8 @@ print(answer.orchestration_metrics) # Optional first-pass / rediscovery metrics
118
118
 
119
119
  `response_shape` options:
120
120
 
121
- - `answer`: backward-compatible prose answer
122
- - `answer_with_evidence`: prose plus `summary`, `evidence`, `artifacts`, `freshness`, `confidence`, `usage`, `outcome`, and `controller`
123
- - `evidence_only`: machine-friendly summary plus the same evidence package for downstream agents
121
+ - `answer_with_evidence` (default): prose plus `summary`, `evidence`, `artifacts`, `freshness`, `confidence`, `usage`, `outcome`, and `controller`
122
+ - `evidence_only`: raw fetched data, computed artifacts, and provenance for downstream agents (no prose synthesis)
124
123
 
125
124
  Premium wedge answers can also expose `evidence.market_intelligence`, `view.rows`, `view.columns`, and the top-level controller fields `stop_reason`, `issue_class`, and `actions_taken`.
126
125
 
@@ -262,7 +261,7 @@ closed = await client.tools.close_session("sess_123")
262
261
 
263
262
  #### `client.query.run(query, tools?, answer_model_id?, include_data?, include_data_url?, include_developer_trace?, idempotency_key?)`
264
263
 
265
- Run an agentic query. The server applies the live librarian pipeline (`discover -> select -> iterative execute -> synthesize -> settle`) with up to 100 MCP calls per response turn, then returns the selected Query response contract (`answer`, `answer_with_evidence`, or `evidence_only`).
264
+ Run an agentic query. The server applies the live librarian pipeline (`discover -> select -> iterative execute -> synthesize -> settle`) with up to 100 MCP calls per response turn, then returns the selected Query response contract (`answer_with_evidence` or `evidence_only`, default `answer_with_evidence`).
266
265
 
267
266
  `client.query.run()` buffers the same SSE transport used by `client.query.stream()` and returns the final `done` result. This keeps Python aligned with the TypeScript SDK and the live query runtime.
268
267
 
@@ -31,7 +31,7 @@ Example:
31
31
  For more information, visit: https://ctxprotocol.com
32
32
  """
33
33
 
34
- __version__ = "0.14.0"
34
+ __version__ = "0.15.0"
35
35
 
36
36
  # Re-export everything from client module
37
37
  from ctxprotocol.client import (
@@ -216,7 +216,8 @@ class Query:
216
216
  tools: Optional tool IDs to use (auto-discover if not provided)
217
217
  favorites_only: Restrict auto-discovery to favorite tools for this request
218
218
  answer_model_id: Optional answer model ID for final synthesis
219
- response_shape: Structured response mode for query answers
219
+ response_shape: Structured response mode (`answer_with_evidence` or
220
+ `evidence_only`; server default `answer_with_evidence`)
220
221
  include_data: Include execution data inline in the query response
221
222
  include_data_url: Persist execution data to blob and return URL
222
223
  include_developer_trace: Include machine-readable Developer Mode traces
@@ -304,7 +305,8 @@ class Query:
304
305
  tools: Optional tool IDs to use (auto-discover if not provided)
305
306
  favorites_only: Restrict auto-discovery to favorite tools for this request
306
307
  answer_model_id: Optional answer model ID for final synthesis
307
- response_shape: Structured response mode for query answers
308
+ response_shape: Structured response mode (`answer_with_evidence` or
309
+ `evidence_only`; server default `answer_with_evidence`)
308
310
  include_data: Include execution data inline in the query response
309
311
  include_data_url: Persist execution data to blob and return URL
310
312
  include_developer_trace: Include machine-readable Developer Mode traces
@@ -601,7 +601,7 @@ class ExecuteSessionResult(BaseModel):
601
601
  # from the query; this is a soft hint rather than a hard switch.
602
602
  QueryDepth = Literal["fast", "auto", "deep"]
603
603
  QueryOutcomeType = Literal["answer", "capability_miss"]
604
- QueryResponseShape = Literal["answer", "answer_with_evidence", "evidence_only"]
604
+ QueryResponseShape = Literal["answer_with_evidence", "evidence_only"]
605
605
  QueryAttemptForkReason = Literal[
606
606
  "manual_fork",
607
607
  "bounded_rediscovery",
@@ -712,13 +712,14 @@ class QueryOptions(BaseModel):
712
712
  default=None,
713
713
  alias="responseShape",
714
714
  description=(
715
- "Structured response mode. The runtime always produces a grounded "
716
- "result (raw data + computed artifacts + provenance); this controls "
717
- "whether a prose synthesis layer is added on top. "
715
+ "Structured response mode. Defaults to `answer_with_evidence` on the "
716
+ "server when omitted. The runtime always produces a grounded result "
717
+ "(raw data + computed artifacts + provenance); this controls whether "
718
+ "a prose synthesis layer is added on top. "
718
719
  "`answer_with_evidence` returns prose plus the structured grounding "
719
720
  "(chat parity); `evidence_only` returns grounding only with no prose "
720
721
  "(the agent-harness shape, with raw data + computed_artifacts + "
721
- "grounding by default); `answer` is the legacy prose-only shape."
722
+ "grounding by default)."
722
723
  ),
723
724
  )
724
725
  include_data: bool | None = Field(
@@ -212,6 +212,7 @@ class HyperliquidContext(BaseModel):
212
212
 
213
213
  Attributes:
214
214
  wallet_address: The wallet address this context is for
215
+ active_wallet_address: The single EOA actually connected to Hyperliquid
215
216
  perp_positions: Perpetual positions
216
217
  open_orders: Open orders
217
218
  spot_balances: Spot balances
@@ -224,6 +225,18 @@ class HyperliquidContext(BaseModel):
224
225
  alias="walletAddress",
225
226
  description="The wallet address this context is for",
226
227
  )
228
+ active_wallet_address: str | None = Field(
229
+ default=None,
230
+ alias="activeWalletAddress",
231
+ description=(
232
+ "The active wallet address for querying/signing. When multiple EOAs "
233
+ "are linked, this is the single externally-owned account actually "
234
+ "connected to Hyperliquid (determined by activity detection on the "
235
+ "client). Contributors should prefer this over wallet_address when "
236
+ "issuing Hyperliquid API calls, since wallet_address may be "
237
+ "comma-joined across multiple linked wallets."
238
+ ),
239
+ )
227
240
  perp_positions: list[HyperliquidPerpPosition] = Field(
228
241
  ...,
229
242
  alias="perpPositions",
@@ -72,7 +72,8 @@ class PolymarketContext(BaseModel):
72
72
  This is what gets passed to MCP tools for personalized analysis.
73
73
 
74
74
  Attributes:
75
- wallet_address: The wallet address this context is for
75
+ wallet_address: The wallet address this context is for (may be comma-separated if multiple)
76
+ active_wallet_address: The active wallet address for signing (the one with Polymarket activity)
76
77
  positions: All open positions
77
78
  open_orders: All open orders
78
79
  total_value: Total portfolio value in USD (sum of position values)
@@ -82,7 +83,17 @@ class PolymarketContext(BaseModel):
82
83
  wallet_address: str = Field(
83
84
  ...,
84
85
  alias="walletAddress",
85
- description="The wallet address this context is for",
86
+ description="The wallet address this context is for (may be comma-separated if multiple)",
87
+ )
88
+ active_wallet_address: str | None = Field(
89
+ default=None,
90
+ alias="activeWalletAddress",
91
+ description=(
92
+ "The active wallet address for signing (the one with Polymarket "
93
+ "activity). When multiple wallets are linked, this is the wallet that "
94
+ "should be used for placing orders. Determined by activity detection "
95
+ "on the client."
96
+ ),
86
97
  )
87
98
  positions: list[PolymarketPosition] = Field(..., description="All open positions")
88
99
  open_orders: list[PolymarketOrder] = Field(
@@ -14,7 +14,7 @@ uvicorn[standard]>=0.30.0
14
14
  hummingbot-api-client>=1.2.6
15
15
 
16
16
  # Context Protocol SDK for payment verification
17
- ctxprotocol>=0.8.3
17
+ ctxprotocol>=0.16.0
18
18
 
19
19
  # Environment management
20
20
  python-dotenv>=1.0.0
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "ctxprotocol"
7
- version = "0.14.0"
7
+ version = "0.16.0"
8
8
  description = "Official Python SDK for the Context Protocol - Discover and execute AI tools programmatically"
9
9
  readme = "README.md"
10
10
  license = "MIT"
File without changes
File without changes
File without changes