diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 315f7d3..7657c56 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.1.0-alpha.26" + ".": "0.1.0-alpha.27" } \ No newline at end of file diff --git a/.stats.yml b/.stats.yml index 2ff039c..56337c0 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ -configured_endpoints: 23 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/opencode%2Fopencode-04eaffcca7fcec3eba3c34ba4e91ba830867173c552015a0abfd65e25084d9b5.yml -openapi_spec_hash: 4dfbcc2ce25451592f610e372ecad0cb +configured_endpoints: 24 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/opencode%2Fopencode-d10809ab68e48a338167e5504d69db2a0a80739adf6ecd3f065644a4139bc374.yml +openapi_spec_hash: 4875565ef8df3446dbab11f450e04c51 config_hash: 0032a76356d31c6b4c218b39fff635bb diff --git a/CHANGELOG.md b/CHANGELOG.md index 4d97d3d..de31979 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,18 @@ # Changelog +## 0.1.0-alpha.27 (2025-07-22) + +Full Changelog: [v0.1.0-alpha.26...v0.1.0-alpha.27](https://github.com/sst/opencode-sdk-python/compare/v0.1.0-alpha.26...v0.1.0-alpha.27) + +### Features + +* **api:** api update ([50c887c](https://github.com/sst/opencode-sdk-python/commit/50c887c4202f587317afecb8998181c6de78b7b4)) + + +### Bug Fixes + +* **parsing:** ignore empty metadata ([8ee35ae](https://github.com/sst/opencode-sdk-python/commit/8ee35ae762cb0ade81b08cc41a9f496afe9fd484)) + ## 0.1.0-alpha.26 (2025-07-21) Full Changelog: [v0.1.0-alpha.25...v0.1.0-alpha.26](https://github.com/sst/opencode-sdk-python/compare/v0.1.0-alpha.25...v0.1.0-alpha.26) diff --git a/api.md b/api.md index e4866ed..efcd86b 100644 --- a/api.md +++ b/api.md @@ -140,9 +140,10 @@ Methods: Types: ```python -from opencode_ai.types import TuiPromptResponse +from opencode_ai.types import TuiOpenHelpResponse, TuiPromptResponse ``` Methods: +- client.tui.open_help() -> TuiOpenHelpResponse - client.tui.prompt(\*\*params) -> TuiPromptResponse diff --git a/pyproject.toml b/pyproject.toml index 349aa84..5ab2607 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "opencode-ai" -version = "0.1.0-alpha.26" +version = "0.1.0-alpha.27" description = "The official Python library for the opencode API" dynamic = ["readme"] license = "Apache-2.0" diff --git a/src/opencode_ai/_models.py b/src/opencode_ai/_models.py index 528d568..ffcbf67 100644 --- a/src/opencode_ai/_models.py +++ b/src/opencode_ai/_models.py @@ -439,7 +439,7 @@ def construct_type(*, value: object, type_: object, metadata: Optional[List[Any] type_ = type_.__value__ # type: ignore[unreachable] # unwrap `Annotated[T, ...]` -> `T` - if metadata is not None: + if metadata is not None and len(metadata) > 0: meta: tuple[Any, ...] = tuple(metadata) elif is_annotated_type(type_): meta = get_args(type_)[1:] diff --git a/src/opencode_ai/_version.py b/src/opencode_ai/_version.py index 6d9c11d..f753b1d 100644 --- a/src/opencode_ai/_version.py +++ b/src/opencode_ai/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "opencode_ai" -__version__ = "0.1.0-alpha.26" # x-release-please-version +__version__ = "0.1.0-alpha.27" # x-release-please-version diff --git a/src/opencode_ai/resources/tui.py b/src/opencode_ai/resources/tui.py index fd3cb73..9a37ba8 100644 --- a/src/opencode_ai/resources/tui.py +++ b/src/opencode_ai/resources/tui.py @@ -20,6 +20,7 @@ from .._base_client import make_request_options from ..types.part_param import PartParam from ..types.tui_prompt_response import TuiPromptResponse +from ..types.tui_open_help_response import TuiOpenHelpResponse __all__ = ["TuiResource", "AsyncTuiResource"] @@ -44,6 +45,25 @@ def with_streaming_response(self) -> TuiResourceWithStreamingResponse: """ return TuiResourceWithStreamingResponse(self) + def open_help( + self, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> TuiOpenHelpResponse: + """Open the help dialog""" + return self._post( + "/tui/open-help", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=TuiOpenHelpResponse, + ) + def prompt( self, *, @@ -104,6 +124,25 @@ def with_streaming_response(self) -> AsyncTuiResourceWithStreamingResponse: """ return AsyncTuiResourceWithStreamingResponse(self) + async def open_help( + self, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> TuiOpenHelpResponse: + """Open the help dialog""" + return await self._post( + "/tui/open-help", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=TuiOpenHelpResponse, + ) + async def prompt( self, *, @@ -148,6 +187,9 @@ class TuiResourceWithRawResponse: def __init__(self, tui: TuiResource) -> None: self._tui = tui + self.open_help = to_raw_response_wrapper( + tui.open_help, + ) self.prompt = to_raw_response_wrapper( tui.prompt, ) @@ -157,6 +199,9 @@ class AsyncTuiResourceWithRawResponse: def __init__(self, tui: AsyncTuiResource) -> None: self._tui = tui + self.open_help = async_to_raw_response_wrapper( + tui.open_help, + ) self.prompt = async_to_raw_response_wrapper( tui.prompt, ) @@ -166,6 +211,9 @@ class TuiResourceWithStreamingResponse: def __init__(self, tui: TuiResource) -> None: self._tui = tui + self.open_help = to_streamed_response_wrapper( + tui.open_help, + ) self.prompt = to_streamed_response_wrapper( tui.prompt, ) @@ -175,6 +223,9 @@ class AsyncTuiResourceWithStreamingResponse: def __init__(self, tui: AsyncTuiResource) -> None: self._tui = tui + self.open_help = async_to_streamed_response_wrapper( + tui.open_help, + ) self.prompt = async_to_streamed_response_wrapper( tui.prompt, ) diff --git a/src/opencode_ai/types/__init__.py b/src/opencode_ai/types/__init__.py index 6621bb7..4a81598 100644 --- a/src/opencode_ai/types/__init__.py +++ b/src/opencode_ai/types/__init__.py @@ -73,6 +73,7 @@ from .session_abort_response import SessionAbortResponse as SessionAbortResponse from .step_finish_part_param import StepFinishPartParam as StepFinishPartParam from .tool_state_error_param import ToolStateErrorParam as ToolStateErrorParam +from .tui_open_help_response import TuiOpenHelpResponse as TuiOpenHelpResponse from .session_delete_response import SessionDeleteResponse as SessionDeleteResponse from .session_summarize_params import SessionSummarizeParams as SessionSummarizeParams from .tool_state_pending_param import ToolStatePendingParam as ToolStatePendingParam diff --git a/src/opencode_ai/types/tui_open_help_response.py b/src/opencode_ai/types/tui_open_help_response.py new file mode 100644 index 0000000..59df1f1 --- /dev/null +++ b/src/opencode_ai/types/tui_open_help_response.py @@ -0,0 +1,7 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing_extensions import TypeAlias + +__all__ = ["TuiOpenHelpResponse"] + +TuiOpenHelpResponse: TypeAlias = bool diff --git a/tests/api_resources/test_tui.py b/tests/api_resources/test_tui.py index dbcfd75..6478963 100644 --- a/tests/api_resources/test_tui.py +++ b/tests/api_resources/test_tui.py @@ -9,7 +9,7 @@ from opencode_ai import Opencode, AsyncOpencode from tests.utils import assert_matches_type -from opencode_ai.types import TuiPromptResponse +from opencode_ai.types import TuiPromptResponse, TuiOpenHelpResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -17,6 +17,34 @@ class TestTui: parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + @pytest.mark.skip() + @parametrize + def test_method_open_help(self, client: Opencode) -> None: + tui = client.tui.open_help() + assert_matches_type(TuiOpenHelpResponse, tui, path=["response"]) + + @pytest.mark.skip() + @parametrize + def test_raw_response_open_help(self, client: Opencode) -> None: + response = client.tui.with_raw_response.open_help() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + tui = response.parse() + assert_matches_type(TuiOpenHelpResponse, tui, path=["response"]) + + @pytest.mark.skip() + @parametrize + def test_streaming_response_open_help(self, client: Opencode) -> None: + with client.tui.with_streaming_response.open_help() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + tui = response.parse() + assert_matches_type(TuiOpenHelpResponse, tui, path=["response"]) + + assert cast(Any, response.is_closed) is True + @pytest.mark.skip() @parametrize def test_method_prompt(self, client: Opencode) -> None: @@ -84,6 +112,34 @@ class TestAsyncTui: "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] ) + @pytest.mark.skip() + @parametrize + async def test_method_open_help(self, async_client: AsyncOpencode) -> None: + tui = await async_client.tui.open_help() + assert_matches_type(TuiOpenHelpResponse, tui, path=["response"]) + + @pytest.mark.skip() + @parametrize + async def test_raw_response_open_help(self, async_client: AsyncOpencode) -> None: + response = await async_client.tui.with_raw_response.open_help() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + tui = await response.parse() + assert_matches_type(TuiOpenHelpResponse, tui, path=["response"]) + + @pytest.mark.skip() + @parametrize + async def test_streaming_response_open_help(self, async_client: AsyncOpencode) -> None: + async with async_client.tui.with_streaming_response.open_help() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + tui = await response.parse() + assert_matches_type(TuiOpenHelpResponse, tui, path=["response"]) + + assert cast(Any, response.is_closed) is True + @pytest.mark.skip() @parametrize async def test_method_prompt(self, async_client: AsyncOpencode) -> None: