ctxprotocol 0.18.0__tar.gz → 0.19.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 (55) hide show
  1. ctxprotocol-0.19.0/CHANGELOG.md +13 -0
  2. {ctxprotocol-0.18.0 → ctxprotocol-0.19.0}/PKG-INFO +1 -1
  3. {ctxprotocol-0.18.0 → ctxprotocol-0.19.0}/ctxprotocol/__init__.py +1 -1
  4. {ctxprotocol-0.18.0 → ctxprotocol-0.19.0}/ctxprotocol/client/__init__.py +2 -0
  5. {ctxprotocol-0.18.0 → ctxprotocol-0.19.0}/ctxprotocol/client/types.py +26 -2
  6. {ctxprotocol-0.18.0 → ctxprotocol-0.19.0}/pyproject.toml +1 -1
  7. {ctxprotocol-0.18.0 → ctxprotocol-0.19.0}/tests/test_query.py +35 -0
  8. {ctxprotocol-0.18.0 → ctxprotocol-0.19.0}/uv.lock +1 -1
  9. ctxprotocol-0.18.0/CHANGELOG.md +0 -7
  10. {ctxprotocol-0.18.0 → ctxprotocol-0.19.0}/.codexignore +0 -0
  11. {ctxprotocol-0.18.0 → ctxprotocol-0.19.0}/.gitignore +0 -0
  12. {ctxprotocol-0.18.0 → ctxprotocol-0.19.0}/README.md +0 -0
  13. {ctxprotocol-0.18.0 → ctxprotocol-0.19.0}/ctxprotocol/auth/__init__.py +0 -0
  14. {ctxprotocol-0.18.0 → ctxprotocol-0.19.0}/ctxprotocol/client/client.py +0 -0
  15. {ctxprotocol-0.18.0 → ctxprotocol-0.19.0}/ctxprotocol/client/resources/__init__.py +0 -0
  16. {ctxprotocol-0.18.0 → ctxprotocol-0.19.0}/ctxprotocol/client/resources/developer.py +0 -0
  17. {ctxprotocol-0.18.0 → ctxprotocol-0.19.0}/ctxprotocol/client/resources/discovery.py +0 -0
  18. {ctxprotocol-0.18.0 → ctxprotocol-0.19.0}/ctxprotocol/client/resources/query.py +0 -0
  19. {ctxprotocol-0.18.0 → ctxprotocol-0.19.0}/ctxprotocol/client/resources/tools.py +0 -0
  20. {ctxprotocol-0.18.0 → ctxprotocol-0.19.0}/ctxprotocol/context/__init__.py +0 -0
  21. {ctxprotocol-0.18.0 → ctxprotocol-0.19.0}/ctxprotocol/context/hyperliquid.py +0 -0
  22. {ctxprotocol-0.18.0 → ctxprotocol-0.19.0}/ctxprotocol/context/polymarket.py +0 -0
  23. {ctxprotocol-0.18.0 → ctxprotocol-0.19.0}/ctxprotocol/context/wallet.py +0 -0
  24. {ctxprotocol-0.18.0 → ctxprotocol-0.19.0}/ctxprotocol/contrib/__init__.py +0 -0
  25. {ctxprotocol-0.18.0 → ctxprotocol-0.19.0}/ctxprotocol/contrib/search/__init__.py +0 -0
  26. {ctxprotocol-0.18.0 → ctxprotocol-0.19.0}/ctxprotocol/contrib/search/core.py +0 -0
  27. {ctxprotocol-0.18.0 → ctxprotocol-0.19.0}/ctxprotocol/contrib/search/trace.py +0 -0
  28. {ctxprotocol-0.18.0 → ctxprotocol-0.19.0}/ctxprotocol/contrib/search/types.py +0 -0
  29. {ctxprotocol-0.18.0 → ctxprotocol-0.19.0}/ctxprotocol/contrib/search/validation.py +0 -0
  30. {ctxprotocol-0.18.0 → ctxprotocol-0.19.0}/ctxprotocol/handshake/__init__.py +0 -0
  31. {ctxprotocol-0.18.0 → ctxprotocol-0.19.0}/ctxprotocol/py.typed +0 -0
  32. {ctxprotocol-0.18.0 → ctxprotocol-0.19.0}/docs/README.md +0 -0
  33. {ctxprotocol-0.18.0 → ctxprotocol-0.19.0}/examples/client/execute_client.py +0 -0
  34. {ctxprotocol-0.18.0 → ctxprotocol-0.19.0}/examples/client/polymarket_query_trace_validation.py +0 -0
  35. {ctxprotocol-0.18.0 → ctxprotocol-0.19.0}/examples/client/query_client.py +0 -0
  36. {ctxprotocol-0.18.0 → ctxprotocol-0.19.0}/examples/client/test_favorites_only.py +0 -0
  37. {ctxprotocol-0.18.0 → ctxprotocol-0.19.0}/examples/client/test_get_tool.py +0 -0
  38. {ctxprotocol-0.18.0 → ctxprotocol-0.19.0}/examples/client/two_surfaces_client.py +0 -0
  39. {ctxprotocol-0.18.0 → ctxprotocol-0.19.0}/examples/client/validation/generate_contributor_search_validation_artifacts.py +0 -0
  40. {ctxprotocol-0.18.0 → ctxprotocol-0.19.0}/examples/client/validation/named-regression-iran-boots-on-ground.json +0 -0
  41. {ctxprotocol-0.18.0 → ctxprotocol-0.19.0}/examples/client/validation/named-regression-supreme-court-tariffs.json +0 -0
  42. {ctxprotocol-0.18.0 → ctxprotocol-0.19.0}/examples/client/validation/shared-capability-miss-unsupported-venue.json +0 -0
  43. {ctxprotocol-0.18.0 → ctxprotocol-0.19.0}/examples/client/validation/shared-generic-overlap-best-match.json +0 -0
  44. {ctxprotocol-0.18.0 → ctxprotocol-0.19.0}/examples/client/validation/shared-still-ambiguous-shortlist.json +0 -0
  45. {ctxprotocol-0.18.0 → ctxprotocol-0.19.0}/examples/server/hummingbot-contributor/README.md +0 -0
  46. {ctxprotocol-0.18.0 → ctxprotocol-0.19.0}/examples/server/hummingbot-contributor/env.example +0 -0
  47. {ctxprotocol-0.18.0 → ctxprotocol-0.19.0}/examples/server/hummingbot-contributor/requirements.txt +0 -0
  48. {ctxprotocol-0.18.0 → ctxprotocol-0.19.0}/examples/server/hummingbot-contributor/server.py +0 -0
  49. {ctxprotocol-0.18.0 → ctxprotocol-0.19.0}/polymarket-query-trace-results-py.json +0 -0
  50. {ctxprotocol-0.18.0 → ctxprotocol-0.19.0}/tests/__init__.py +0 -0
  51. {ctxprotocol-0.18.0 → ctxprotocol-0.19.0}/tests/contrib_search_validation_cases.py +0 -0
  52. {ctxprotocol-0.18.0 → ctxprotocol-0.19.0}/tests/test_client.py +0 -0
  53. {ctxprotocol-0.18.0 → ctxprotocol-0.19.0}/tests/test_contrib_search.py +0 -0
  54. {ctxprotocol-0.18.0 → ctxprotocol-0.19.0}/tests/test_discovery.py +0 -0
  55. {ctxprotocol-0.18.0 → ctxprotocol-0.19.0}/tests/test_tools.py +0 -0
@@ -0,0 +1,13 @@
1
+ # Changelog
2
+
3
+ ## 0.19.0
4
+
5
+ - Fixed `client.query.run()`/`client.query.stream()` raising a `ValidationError` on queries that returned a rendered image artifact (e.g. server-rendered chart PNGs). `computedArtifacts` now accepts both `chart` (structured spec + data) and `image` (hosted URL) variants.
6
+ - Added `QueryImageArtifact` (`kind: "image"` with `url`, `alt`, `title`, `content_hash`, `bytes`, `width`, `height`) and made `QueryComputedArtifact` a discriminated union over `kind`.
7
+ - Exported `QueryImageArtifact` from the client entry point alongside `QueryChartArtifact`.
8
+
9
+ ## 0.18.0
10
+
11
+ - Added durable async Query jobs with `client.query.start()`, `client.query.get_status()`, and `client.query.poll()`.
12
+ - Exported `QueryJobStartResult`, `QueryJobStatusResult`, and `QueryJobStatus` from the root and client entry points.
13
+ - Kept existing `client.query.run()` and `client.query.stream()` behavior unchanged.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ctxprotocol
3
- Version: 0.18.0
3
+ Version: 0.19.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
@@ -31,7 +31,7 @@ Example:
31
31
  For more information, visit: https://ctxprotocol.com
32
32
  """
33
33
 
34
- __version__ = "0.18.0"
34
+ __version__ = "0.19.0"
35
35
 
36
36
  # Re-export everything from client module
37
37
  from ctxprotocol.client import (
@@ -44,6 +44,7 @@ from ctxprotocol.client.types import (
44
44
  QueryChartType,
45
45
  QueryChartValueFormat,
46
46
  QueryComputedArtifact,
47
+ QueryImageArtifact,
47
48
  QueryCost,
48
49
  QueryCompletenessRepairEvent,
49
50
  QueryDeveloperTrace,
@@ -133,6 +134,7 @@ __all__ = [
133
134
  "QueryChartType",
134
135
  "QueryChartValueFormat",
135
136
  "QueryComputedArtifact",
137
+ "QueryImageArtifact",
136
138
  "QueryStreamToolStatusEvent",
137
139
  "QueryStreamTextDeltaEvent",
138
140
  "QueryStreamDeveloperTraceEvent",
@@ -6,7 +6,7 @@ This module contains all Pydantic models and type definitions used by the client
6
6
 
7
7
  from __future__ import annotations
8
8
 
9
- from typing import Any, Literal, Union
9
+ from typing import Annotated, Any, Literal, Union
10
10
 
11
11
  from pydantic import BaseModel, Field
12
12
 
@@ -929,7 +929,31 @@ class QueryChartArtifact(BaseModel):
929
929
  title: str | None = None
930
930
 
931
931
 
932
- QueryComputedArtifact = QueryChartArtifact
932
+ class QueryImageArtifact(BaseModel):
933
+ """Rendered image artifact (e.g. a server-rendered chart PNG).
934
+
935
+ Emitted by the code interpreter alongside or instead of the structured
936
+ ``chart`` spec. ``url`` points at a hosted, already-rendered image so
937
+ consumers that cannot render a chart spec (image-first surfaces such as
938
+ social posting) can attach it directly.
939
+ """
940
+
941
+ kind: Literal["image"]
942
+ url: str
943
+ alt: str | None = None
944
+ title: str | None = None
945
+ content_hash: str | None = Field(default=None, alias="contentHash")
946
+ bytes: int | None = None
947
+ width: int | None = None
948
+ height: int | None = None
949
+
950
+ model_config = {"populate_by_name": True}
951
+
952
+
953
+ QueryComputedArtifact = Annotated[
954
+ Union[QueryChartArtifact, QueryImageArtifact],
955
+ Field(discriminator="kind"),
956
+ ]
933
957
 
934
958
 
935
959
  class QueryToolCallFailureSample(BaseModel):
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "ctxprotocol"
7
- version = "0.18.0"
7
+ version = "0.19.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"
@@ -897,6 +897,41 @@ class TestQueryRun:
897
897
  assert mixed_axis.spec.series[1].y_axis == "right"
898
898
  assert mixed_axis.spec.series[1].satisfies == "volume"
899
899
 
900
+ async def test_parses_rendered_image_artifact(self) -> None:
901
+ """Rendered image artifacts (kind: image) deserialize without error."""
902
+ client = ContextClient(api_key="ctx_test_key_1234567890abcdef12345678")
903
+ response = {
904
+ **MOCK_SUCCESS_RESPONSE,
905
+ "computedArtifacts": [
906
+ {
907
+ "kind": "image",
908
+ "url": "https://blob.example.com/charts/abc123.png",
909
+ "alt": "Sector ETF YTD normalized performance chart",
910
+ "title": "Sector ETF YTD Performance",
911
+ "contentHash": "abc123",
912
+ "bytes": 320749,
913
+ "width": 1926,
914
+ "height": 1030,
915
+ },
916
+ ],
917
+ }
918
+ with patch.object(
919
+ client, "fetch_stream", new_callable=AsyncMock
920
+ ) as mock_stream:
921
+ mock_stream.return_value = _make_done_stream_response(response)
922
+ result = await client.query.run("Render a chart image")
923
+
924
+ assert result.computed_artifacts is not None
925
+ assert len(result.computed_artifacts) == 1
926
+ image = result.computed_artifacts[0]
927
+ assert image.kind == "image"
928
+ assert image.url == "https://blob.example.com/charts/abc123.png"
929
+ assert image.title == "Sector ETF YTD Performance"
930
+ assert image.content_hash == "abc123"
931
+ assert image.bytes == 320749
932
+ assert image.width == 1926
933
+ assert image.height == 1030
934
+
900
935
  async def test_parses_shared_ungrounded_capability_miss_fixture(self) -> None:
901
936
  """Ungrounded runtime outcomes deserialize as capability_miss."""
902
937
  client = ContextClient(api_key="ctx_test_key_1234567890abcdef12345678")
@@ -205,7 +205,7 @@ wheels = [
205
205
 
206
206
  [[package]]
207
207
  name = "ctxprotocol"
208
- version = "0.18.0"
208
+ version = "0.19.0"
209
209
  source = { editable = "." }
210
210
  dependencies = [
211
211
  { name = "cryptography" },
@@ -1,7 +0,0 @@
1
- # Changelog
2
-
3
- ## 0.18.0
4
-
5
- - Added durable async Query jobs with `client.query.start()`, `client.query.get_status()`, and `client.query.poll()`.
6
- - Exported `QueryJobStartResult`, `QueryJobStatusResult`, and `QueryJobStatus` from the root and client entry points.
7
- - Kept existing `client.query.run()` and `client.query.stream()` behavior unchanged.
File without changes
File without changes
File without changes