Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "0.1.0-alpha.12"
".": "0.1.0-alpha.13"
}
8 changes: 4 additions & 4 deletions .stats.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
configured_endpoints: 20
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/opencode%2Fopencode-15eeb028f79b9a065b4e54a6ea6a58631e9bd5004f97820f0c79d18e3f8bac84.yml
openapi_spec_hash: 38c8bacb6c8e4c46852a3e81e3fb9fda
config_hash: 348a85e725de595ca05a61f4333794ac
configured_endpoints: 22
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/opencode%2Fopencode-05150c78e0e6e97b0ce97ed685ebcf1cb01dc839beccb99e9d3ead5b783cfd47.yml
openapi_spec_hash: 833a5b6d53d98dc2beac2c4c394b20d5
config_hash: 3695cfc829cfaae14490850b4a1ed282
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Changelog

## 0.1.0-alpha.13 (2025-07-15)

Full Changelog: [v0.1.0-alpha.12...v0.1.0-alpha.13](https://github.com/sst/opencode-sdk-python/compare/v0.1.0-alpha.12...v0.1.0-alpha.13)

### Features

* **api:** api update ([a51d627](https://github.com/sst/opencode-sdk-python/commit/a51d627f3a39324ca769a688b63c95dc8f5eba35))

## 0.1.0-alpha.12 (2025-07-12)

Full Changelog: [v0.1.0-alpha.11...v0.1.0-alpha.12](https://github.com/sst/opencode-sdk-python/compare/v0.1.0-alpha.11...v0.1.0-alpha.12)
Expand Down
21 changes: 15 additions & 6 deletions api.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Shared Types

```python
from opencode_ai.types import ProviderAuthError, UnknownError
from opencode_ai.types import MessageAbortedError, ProviderAuthError, UnknownError
```

# Event
Expand All @@ -21,20 +21,28 @@ Methods:
Types:

```python
from opencode_ai.types import App, AppInitResponse
from opencode_ai.types import App, LogLevel, Mode, AppInitResponse, AppLogResponse, AppModesResponse
```

Methods:

- <code title="get /app">client.app.<a href="./src/opencode_ai/resources/app.py">get</a>() -> <a href="./src/opencode_ai/types/app.py">App</a></code>
- <code title="post /app/init">client.app.<a href="./src/opencode_ai/resources/app.py">init</a>() -> <a href="./src/opencode_ai/types/app_init_response.py">AppInitResponse</a></code>
- <code title="post /log">client.app.<a href="./src/opencode_ai/resources/app.py">log</a>(\*\*<a href="src/opencode_ai/types/app_log_params.py">params</a>) -> <a href="./src/opencode_ai/types/app_log_response.py">AppLogResponse</a></code>
- <code title="get /mode">client.app.<a href="./src/opencode_ai/resources/app.py">modes</a>() -> <a href="./src/opencode_ai/types/app_modes_response.py">AppModesResponse</a></code>

# Find

Types:

```python
from opencode_ai.types import FindFilesResponse, FindSymbolsResponse, FindTextResponse
from opencode_ai.types import (
Match,
Symbol,
FindFilesResponse,
FindSymbolsResponse,
FindTextResponse,
)
```

Methods:
Expand All @@ -48,7 +56,7 @@ Methods:
Types:

```python
from opencode_ai.types import FileReadResponse, FileStatusResponse
from opencode_ai.types import File, FileReadResponse, FileStatusResponse
```

Methods:
Expand Down Expand Up @@ -84,18 +92,19 @@ Types:
```python
from opencode_ai.types import (
AssistantMessage,
AssistantMessagePart,
FilePart,
Message,
Part,
Session,
StepFinishPart,
StepStartPart,
TextPart,
ToolPart,
ToolStateCompleted,
ToolStateError,
ToolStatePending,
ToolStateRunning,
UserMessagePart,
UserMessage,
SessionListResponse,
SessionDeleteResponse,
SessionAbortResponse,
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "opencode-ai"
version = "0.1.0-alpha.12"
version = "0.1.0-alpha.13"
description = "The official Python library for the opencode API"
dynamic = ["readme"]
license = "Apache-2.0"
Expand Down
2 changes: 1 addition & 1 deletion src/opencode_ai/_version.py
Original file line number Diff line number Diff line change
@@ -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.12" # x-release-please-version
__version__ = "0.1.0-alpha.13" # x-release-please-version
171 changes: 171 additions & 0 deletions src/opencode_ai/resources/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,14 @@

from __future__ import annotations

from typing import Dict
from typing_extensions import Literal

import httpx

from ..types import app_log_params
from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven
from .._utils import maybe_transform, async_maybe_transform
from .._compat import cached_property
from .._resource import SyncAPIResource, AsyncAPIResource
from .._response import (
Expand All @@ -15,7 +20,9 @@
)
from ..types.app import App
from .._base_client import make_request_options
from ..types.app_log_response import AppLogResponse
from ..types.app_init_response import AppInitResponse
from ..types.app_modes_response import AppModesResponse

__all__ = ["AppResource", "AsyncAppResource"]

Expand Down Expand Up @@ -78,6 +85,76 @@ def init(
cast_to=AppInitResponse,
)

def log(
self,
*,
level: Literal["debug", "info", "error", "warn"],
message: str,
service: str,
extra: Dict[str, object] | NotGiven = NOT_GIVEN,
# 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,
) -> AppLogResponse:
"""
Write a log entry to the server logs

Args:
level: Log level

message: Log message

service: Service name for the log entry

extra: Additional metadata for the log entry

extra_headers: Send extra headers

extra_query: Add additional query parameters to the request

extra_body: Add additional JSON properties to the request

timeout: Override the client-level default timeout for this request, in seconds
"""
return self._post(
"/log",
body=maybe_transform(
{
"level": level,
"message": message,
"service": service,
"extra": extra,
},
app_log_params.AppLogParams,
),
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
cast_to=AppLogResponse,
)

def modes(
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,
) -> AppModesResponse:
"""List all modes"""
return self._get(
"/mode",
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
cast_to=AppModesResponse,
)


class AsyncAppResource(AsyncAPIResource):
@cached_property
Expand Down Expand Up @@ -137,6 +214,76 @@ async def init(
cast_to=AppInitResponse,
)

async def log(
self,
*,
level: Literal["debug", "info", "error", "warn"],
message: str,
service: str,
extra: Dict[str, object] | NotGiven = NOT_GIVEN,
# 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,
) -> AppLogResponse:
"""
Write a log entry to the server logs

Args:
level: Log level

message: Log message

service: Service name for the log entry

extra: Additional metadata for the log entry

extra_headers: Send extra headers

extra_query: Add additional query parameters to the request

extra_body: Add additional JSON properties to the request

timeout: Override the client-level default timeout for this request, in seconds
"""
return await self._post(
"/log",
body=await async_maybe_transform(
{
"level": level,
"message": message,
"service": service,
"extra": extra,
},
app_log_params.AppLogParams,
),
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
cast_to=AppLogResponse,
)

async def modes(
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,
) -> AppModesResponse:
"""List all modes"""
return await self._get(
"/mode",
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
cast_to=AppModesResponse,
)


class AppResourceWithRawResponse:
def __init__(self, app: AppResource) -> None:
Expand All @@ -148,6 +295,12 @@ def __init__(self, app: AppResource) -> None:
self.init = to_raw_response_wrapper(
app.init,
)
self.log = to_raw_response_wrapper(
app.log,
)
self.modes = to_raw_response_wrapper(
app.modes,
)


class AsyncAppResourceWithRawResponse:
Expand All @@ -160,6 +313,12 @@ def __init__(self, app: AsyncAppResource) -> None:
self.init = async_to_raw_response_wrapper(
app.init,
)
self.log = async_to_raw_response_wrapper(
app.log,
)
self.modes = async_to_raw_response_wrapper(
app.modes,
)


class AppResourceWithStreamingResponse:
Expand All @@ -172,6 +331,12 @@ def __init__(self, app: AppResource) -> None:
self.init = to_streamed_response_wrapper(
app.init,
)
self.log = to_streamed_response_wrapper(
app.log,
)
self.modes = to_streamed_response_wrapper(
app.modes,
)


class AsyncAppResourceWithStreamingResponse:
Expand All @@ -184,3 +349,9 @@ def __init__(self, app: AsyncAppResource) -> None:
self.init = async_to_streamed_response_wrapper(
app.init,
)
self.log = async_to_streamed_response_wrapper(
app.log,
)
self.modes = async_to_streamed_response_wrapper(
app.modes,
)
Loading
Loading