mirror of
https://github.com/anomalyco/opencode-sdk-python.git
synced 2026-05-01 22:10:28 +00:00
feat(api): api update
This commit is contained in:
parent
3214ae78d3
commit
731f553f04
14 changed files with 167 additions and 143 deletions
|
|
@ -1,4 +1,4 @@
|
||||||
configured_endpoints: 22
|
configured_endpoints: 22
|
||||||
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/opencode%2Fopencode-8792f91dd070f7b4ee671fc86e8a03976dc7fb6ee49f8c99ad989e1597003774.yml
|
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/opencode%2Fopencode-8792f91dd070f7b4ee671fc86e8a03976dc7fb6ee49f8c99ad989e1597003774.yml
|
||||||
openapi_spec_hash: fe9dc3a074be560de0b97df9b5af2c1b
|
openapi_spec_hash: fe9dc3a074be560de0b97df9b5af2c1b
|
||||||
config_hash: 2a888f284ea87b2dfdb7e548938a55ea
|
config_hash: b7f3d9742335715c458494988498b183
|
||||||
|
|
|
||||||
26
api.md
26
api.md
|
|
@ -21,7 +21,17 @@ Methods:
|
||||||
Types:
|
Types:
|
||||||
|
|
||||||
```python
|
```python
|
||||||
from opencode_ai.types import App, LogLevel, Mode, AppInitResponse, AppLogResponse, AppModesResponse
|
from opencode_ai.types import (
|
||||||
|
App,
|
||||||
|
LogLevel,
|
||||||
|
Mode,
|
||||||
|
Model,
|
||||||
|
Provider,
|
||||||
|
AppInitResponse,
|
||||||
|
AppLogResponse,
|
||||||
|
AppModesResponse,
|
||||||
|
AppProvidersResponse,
|
||||||
|
)
|
||||||
```
|
```
|
||||||
|
|
||||||
Methods:
|
Methods:
|
||||||
|
|
@ -30,6 +40,7 @@ Methods:
|
||||||
- <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 /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="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>
|
- <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>
|
||||||
|
- <code title="get /config/providers">client.app.<a href="./src/opencode_ai/resources/app.py">providers</a>() -> <a href="./src/opencode_ai/types/app_providers_response.py">AppProvidersResponse</a></code>
|
||||||
|
|
||||||
# Find
|
# Find
|
||||||
|
|
||||||
|
|
@ -71,20 +82,17 @@ Types:
|
||||||
```python
|
```python
|
||||||
from opencode_ai.types import (
|
from opencode_ai.types import (
|
||||||
Config,
|
Config,
|
||||||
Keybinds,
|
KeybindsConfig,
|
||||||
McpLocal,
|
LayoutConfig,
|
||||||
McpRemote,
|
McpLocalConfig,
|
||||||
Mode,
|
McpRemoteConfig,
|
||||||
Model,
|
ModeConfig,
|
||||||
Provider,
|
|
||||||
ConfigProvidersResponse,
|
|
||||||
)
|
)
|
||||||
```
|
```
|
||||||
|
|
||||||
Methods:
|
Methods:
|
||||||
|
|
||||||
- <code title="get /config">client.config.<a href="./src/opencode_ai/resources/config.py">get</a>() -> <a href="./src/opencode_ai/types/config.py">Config</a></code>
|
- <code title="get /config">client.config.<a href="./src/opencode_ai/resources/config.py">get</a>() -> <a href="./src/opencode_ai/types/config.py">Config</a></code>
|
||||||
- <code title="get /config/providers">client.config.<a href="./src/opencode_ai/resources/config.py">providers</a>() -> <a href="./src/opencode_ai/types/config_providers_response.py">ConfigProvidersResponse</a></code>
|
|
||||||
|
|
||||||
# Session
|
# Session
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,7 @@ from .._base_client import make_request_options
|
||||||
from ..types.app_log_response import AppLogResponse
|
from ..types.app_log_response import AppLogResponse
|
||||||
from ..types.app_init_response import AppInitResponse
|
from ..types.app_init_response import AppInitResponse
|
||||||
from ..types.app_modes_response import AppModesResponse
|
from ..types.app_modes_response import AppModesResponse
|
||||||
|
from ..types.app_providers_response import AppProvidersResponse
|
||||||
|
|
||||||
__all__ = ["AppResource", "AsyncAppResource"]
|
__all__ = ["AppResource", "AsyncAppResource"]
|
||||||
|
|
||||||
|
|
@ -155,6 +156,25 @@ class AppResource(SyncAPIResource):
|
||||||
cast_to=AppModesResponse,
|
cast_to=AppModesResponse,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
def providers(
|
||||||
|
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,
|
||||||
|
) -> AppProvidersResponse:
|
||||||
|
"""List all providers"""
|
||||||
|
return self._get(
|
||||||
|
"/config/providers",
|
||||||
|
options=make_request_options(
|
||||||
|
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
||||||
|
),
|
||||||
|
cast_to=AppProvidersResponse,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
class AsyncAppResource(AsyncAPIResource):
|
class AsyncAppResource(AsyncAPIResource):
|
||||||
@cached_property
|
@cached_property
|
||||||
|
|
@ -284,6 +304,25 @@ class AsyncAppResource(AsyncAPIResource):
|
||||||
cast_to=AppModesResponse,
|
cast_to=AppModesResponse,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
async def providers(
|
||||||
|
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,
|
||||||
|
) -> AppProvidersResponse:
|
||||||
|
"""List all providers"""
|
||||||
|
return await self._get(
|
||||||
|
"/config/providers",
|
||||||
|
options=make_request_options(
|
||||||
|
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
||||||
|
),
|
||||||
|
cast_to=AppProvidersResponse,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
class AppResourceWithRawResponse:
|
class AppResourceWithRawResponse:
|
||||||
def __init__(self, app: AppResource) -> None:
|
def __init__(self, app: AppResource) -> None:
|
||||||
|
|
@ -301,6 +340,9 @@ class AppResourceWithRawResponse:
|
||||||
self.modes = to_raw_response_wrapper(
|
self.modes = to_raw_response_wrapper(
|
||||||
app.modes,
|
app.modes,
|
||||||
)
|
)
|
||||||
|
self.providers = to_raw_response_wrapper(
|
||||||
|
app.providers,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
class AsyncAppResourceWithRawResponse:
|
class AsyncAppResourceWithRawResponse:
|
||||||
|
|
@ -319,6 +361,9 @@ class AsyncAppResourceWithRawResponse:
|
||||||
self.modes = async_to_raw_response_wrapper(
|
self.modes = async_to_raw_response_wrapper(
|
||||||
app.modes,
|
app.modes,
|
||||||
)
|
)
|
||||||
|
self.providers = async_to_raw_response_wrapper(
|
||||||
|
app.providers,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
class AppResourceWithStreamingResponse:
|
class AppResourceWithStreamingResponse:
|
||||||
|
|
@ -337,6 +382,9 @@ class AppResourceWithStreamingResponse:
|
||||||
self.modes = to_streamed_response_wrapper(
|
self.modes = to_streamed_response_wrapper(
|
||||||
app.modes,
|
app.modes,
|
||||||
)
|
)
|
||||||
|
self.providers = to_streamed_response_wrapper(
|
||||||
|
app.providers,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
class AsyncAppResourceWithStreamingResponse:
|
class AsyncAppResourceWithStreamingResponse:
|
||||||
|
|
@ -355,3 +403,6 @@ class AsyncAppResourceWithStreamingResponse:
|
||||||
self.modes = async_to_streamed_response_wrapper(
|
self.modes = async_to_streamed_response_wrapper(
|
||||||
app.modes,
|
app.modes,
|
||||||
)
|
)
|
||||||
|
self.providers = async_to_streamed_response_wrapper(
|
||||||
|
app.providers,
|
||||||
|
)
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,6 @@ from .._response import (
|
||||||
)
|
)
|
||||||
from .._base_client import make_request_options
|
from .._base_client import make_request_options
|
||||||
from ..types.config import Config
|
from ..types.config import Config
|
||||||
from ..types.config_providers_response import ConfigProvidersResponse
|
|
||||||
|
|
||||||
__all__ = ["ConfigResource", "AsyncConfigResource"]
|
__all__ = ["ConfigResource", "AsyncConfigResource"]
|
||||||
|
|
||||||
|
|
@ -59,25 +58,6 @@ class ConfigResource(SyncAPIResource):
|
||||||
cast_to=Config,
|
cast_to=Config,
|
||||||
)
|
)
|
||||||
|
|
||||||
def providers(
|
|
||||||
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,
|
|
||||||
) -> ConfigProvidersResponse:
|
|
||||||
"""List all providers"""
|
|
||||||
return self._get(
|
|
||||||
"/config/providers",
|
|
||||||
options=make_request_options(
|
|
||||||
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
||||||
),
|
|
||||||
cast_to=ConfigProvidersResponse,
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
class AsyncConfigResource(AsyncAPIResource):
|
class AsyncConfigResource(AsyncAPIResource):
|
||||||
@cached_property
|
@cached_property
|
||||||
|
|
@ -118,25 +98,6 @@ class AsyncConfigResource(AsyncAPIResource):
|
||||||
cast_to=Config,
|
cast_to=Config,
|
||||||
)
|
)
|
||||||
|
|
||||||
async def providers(
|
|
||||||
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,
|
|
||||||
) -> ConfigProvidersResponse:
|
|
||||||
"""List all providers"""
|
|
||||||
return await self._get(
|
|
||||||
"/config/providers",
|
|
||||||
options=make_request_options(
|
|
||||||
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
||||||
),
|
|
||||||
cast_to=ConfigProvidersResponse,
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
class ConfigResourceWithRawResponse:
|
class ConfigResourceWithRawResponse:
|
||||||
def __init__(self, config: ConfigResource) -> None:
|
def __init__(self, config: ConfigResource) -> None:
|
||||||
|
|
@ -145,9 +106,6 @@ class ConfigResourceWithRawResponse:
|
||||||
self.get = to_raw_response_wrapper(
|
self.get = to_raw_response_wrapper(
|
||||||
config.get,
|
config.get,
|
||||||
)
|
)
|
||||||
self.providers = to_raw_response_wrapper(
|
|
||||||
config.providers,
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
class AsyncConfigResourceWithRawResponse:
|
class AsyncConfigResourceWithRawResponse:
|
||||||
|
|
@ -157,9 +115,6 @@ class AsyncConfigResourceWithRawResponse:
|
||||||
self.get = async_to_raw_response_wrapper(
|
self.get = async_to_raw_response_wrapper(
|
||||||
config.get,
|
config.get,
|
||||||
)
|
)
|
||||||
self.providers = async_to_raw_response_wrapper(
|
|
||||||
config.providers,
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
class ConfigResourceWithStreamingResponse:
|
class ConfigResourceWithStreamingResponse:
|
||||||
|
|
@ -169,9 +124,6 @@ class ConfigResourceWithStreamingResponse:
|
||||||
self.get = to_streamed_response_wrapper(
|
self.get = to_streamed_response_wrapper(
|
||||||
config.get,
|
config.get,
|
||||||
)
|
)
|
||||||
self.providers = to_streamed_response_wrapper(
|
|
||||||
config.providers,
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
class AsyncConfigResourceWithStreamingResponse:
|
class AsyncConfigResourceWithStreamingResponse:
|
||||||
|
|
@ -181,6 +133,3 @@ class AsyncConfigResourceWithStreamingResponse:
|
||||||
self.get = async_to_streamed_response_wrapper(
|
self.get = async_to_streamed_response_wrapper(
|
||||||
config.get,
|
config.get,
|
||||||
)
|
)
|
||||||
self.providers = async_to_streamed_response_wrapper(
|
|
||||||
config.providers,
|
|
||||||
)
|
|
||||||
|
|
|
||||||
|
|
@ -17,28 +17,30 @@ from .shared import (
|
||||||
from .symbol import Symbol as Symbol
|
from .symbol import Symbol as Symbol
|
||||||
from .message import Message as Message
|
from .message import Message as Message
|
||||||
from .session import Session as Session
|
from .session import Session as Session
|
||||||
from .keybinds import Keybinds as Keybinds
|
|
||||||
from .provider import Provider as Provider
|
from .provider import Provider as Provider
|
||||||
from .file_part import FilePart as FilePart
|
from .file_part import FilePart as FilePart
|
||||||
from .log_level import LogLevel as LogLevel
|
from .log_level import LogLevel as LogLevel
|
||||||
from .mcp_local import McpLocal as McpLocal
|
|
||||||
from .text_part import TextPart as TextPart
|
from .text_part import TextPart as TextPart
|
||||||
from .tool_part import ToolPart as ToolPart
|
from .tool_part import ToolPart as ToolPart
|
||||||
from .mcp_remote import McpRemote as McpRemote
|
from .mode_config import ModeConfig as ModeConfig
|
||||||
from .user_message import UserMessage as UserMessage
|
from .user_message import UserMessage as UserMessage
|
||||||
|
from .layout_config import LayoutConfig as LayoutConfig
|
||||||
from .snapshot_part import SnapshotPart as SnapshotPart
|
from .snapshot_part import SnapshotPart as SnapshotPart
|
||||||
from .app_log_params import AppLogParams as AppLogParams
|
from .app_log_params import AppLogParams as AppLogParams
|
||||||
from .file_part_param import FilePartParam as FilePartParam
|
from .file_part_param import FilePartParam as FilePartParam
|
||||||
|
from .keybinds_config import KeybindsConfig as KeybindsConfig
|
||||||
from .step_start_part import StepStartPart as StepStartPart
|
from .step_start_part import StepStartPart as StepStartPart
|
||||||
from .text_part_param import TextPartParam as TextPartParam
|
from .text_part_param import TextPartParam as TextPartParam
|
||||||
from .app_log_response import AppLogResponse as AppLogResponse
|
from .app_log_response import AppLogResponse as AppLogResponse
|
||||||
from .file_read_params import FileReadParams as FileReadParams
|
from .file_read_params import FileReadParams as FileReadParams
|
||||||
from .find_text_params import FindTextParams as FindTextParams
|
from .find_text_params import FindTextParams as FindTextParams
|
||||||
|
from .mcp_local_config import McpLocalConfig as McpLocalConfig
|
||||||
from .step_finish_part import StepFinishPart as StepFinishPart
|
from .step_finish_part import StepFinishPart as StepFinishPart
|
||||||
from .tool_state_error import ToolStateError as ToolStateError
|
from .tool_state_error import ToolStateError as ToolStateError
|
||||||
from .app_init_response import AppInitResponse as AppInitResponse
|
from .app_init_response import AppInitResponse as AppInitResponse
|
||||||
from .assistant_message import AssistantMessage as AssistantMessage
|
from .assistant_message import AssistantMessage as AssistantMessage
|
||||||
from .find_files_params import FindFilesParams as FindFilesParams
|
from .find_files_params import FindFilesParams as FindFilesParams
|
||||||
|
from .mcp_remote_config import McpRemoteConfig as McpRemoteConfig
|
||||||
from .app_modes_response import AppModesResponse as AppModesResponse
|
from .app_modes_response import AppModesResponse as AppModesResponse
|
||||||
from .file_read_response import FileReadResponse as FileReadResponse
|
from .file_read_response import FileReadResponse as FileReadResponse
|
||||||
from .find_text_response import FindTextResponse as FindTextResponse
|
from .find_text_response import FindTextResponse as FindTextResponse
|
||||||
|
|
@ -54,9 +56,9 @@ from .tool_state_completed import ToolStateCompleted as ToolStateCompleted
|
||||||
from .find_symbols_response import FindSymbolsResponse as FindSymbolsResponse
|
from .find_symbols_response import FindSymbolsResponse as FindSymbolsResponse
|
||||||
from .session_init_response import SessionInitResponse as SessionInitResponse
|
from .session_init_response import SessionInitResponse as SessionInitResponse
|
||||||
from .session_list_response import SessionListResponse as SessionListResponse
|
from .session_list_response import SessionListResponse as SessionListResponse
|
||||||
|
from .app_providers_response import AppProvidersResponse as AppProvidersResponse
|
||||||
from .session_abort_response import SessionAbortResponse as SessionAbortResponse
|
from .session_abort_response import SessionAbortResponse as SessionAbortResponse
|
||||||
from .session_delete_response import SessionDeleteResponse as SessionDeleteResponse
|
from .session_delete_response import SessionDeleteResponse as SessionDeleteResponse
|
||||||
from .session_summarize_params import SessionSummarizeParams as SessionSummarizeParams
|
from .session_summarize_params import SessionSummarizeParams as SessionSummarizeParams
|
||||||
from .config_providers_response import ConfigProvidersResponse as ConfigProvidersResponse
|
|
||||||
from .session_messages_response import SessionMessagesResponse as SessionMessagesResponse
|
from .session_messages_response import SessionMessagesResponse as SessionMessagesResponse
|
||||||
from .session_summarize_response import SessionSummarizeResponse as SessionSummarizeResponse
|
from .session_summarize_response import SessionSummarizeResponse as SessionSummarizeResponse
|
||||||
|
|
|
||||||
|
|
@ -5,10 +5,10 @@ from typing import Dict, List
|
||||||
from .._models import BaseModel
|
from .._models import BaseModel
|
||||||
from .provider import Provider
|
from .provider import Provider
|
||||||
|
|
||||||
__all__ = ["ConfigProvidersResponse"]
|
__all__ = ["AppProvidersResponse"]
|
||||||
|
|
||||||
|
|
||||||
class ConfigProvidersResponse(BaseModel):
|
class AppProvidersResponse(BaseModel):
|
||||||
default: Dict[str, str]
|
default: Dict[str, str]
|
||||||
|
|
||||||
providers: List[Provider]
|
providers: List[Provider]
|
||||||
|
|
@ -5,13 +5,14 @@ from typing_extensions import Literal, Annotated, TypeAlias
|
||||||
|
|
||||||
from pydantic import Field as FieldInfo
|
from pydantic import Field as FieldInfo
|
||||||
|
|
||||||
from . import mode
|
|
||||||
from .._utils import PropertyInfo
|
from .._utils import PropertyInfo
|
||||||
from .._models import BaseModel
|
from .._models import BaseModel
|
||||||
from .keybinds import Keybinds
|
|
||||||
from .log_level import LogLevel
|
from .log_level import LogLevel
|
||||||
from .mcp_local import McpLocal
|
from .mode_config import ModeConfig
|
||||||
from .mcp_remote import McpRemote
|
from .layout_config import LayoutConfig
|
||||||
|
from .keybinds_config import KeybindsConfig
|
||||||
|
from .mcp_local_config import McpLocalConfig
|
||||||
|
from .mcp_remote_config import McpRemoteConfig
|
||||||
|
|
||||||
__all__ = [
|
__all__ = [
|
||||||
"Config",
|
"Config",
|
||||||
|
|
@ -50,19 +51,19 @@ class Experimental(BaseModel):
|
||||||
hook: Optional[ExperimentalHook] = None
|
hook: Optional[ExperimentalHook] = None
|
||||||
|
|
||||||
|
|
||||||
Mcp: TypeAlias = Annotated[Union[McpLocal, McpRemote], PropertyInfo(discriminator="type")]
|
Mcp: TypeAlias = Annotated[Union[McpLocalConfig, McpRemoteConfig], PropertyInfo(discriminator="type")]
|
||||||
|
|
||||||
|
|
||||||
class Mode(BaseModel):
|
class Mode(BaseModel):
|
||||||
build: Optional[mode.Mode] = None
|
build: Optional[ModeConfig] = None
|
||||||
|
|
||||||
plan: Optional[mode.Mode] = None
|
plan: Optional[ModeConfig] = None
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
# Stub to indicate that arbitrary properties are accepted.
|
# Stub to indicate that arbitrary properties are accepted.
|
||||||
# To access properties that are not valid identifiers you can use `getattr`, e.g.
|
# To access properties that are not valid identifiers you can use `getattr`, e.g.
|
||||||
# `getattr(obj, '$type')`
|
# `getattr(obj, '$type')`
|
||||||
def __getattr__(self, attr: str) -> mode.Mode: ...
|
def __getattr__(self, attr: str) -> ModeConfig: ...
|
||||||
|
|
||||||
|
|
||||||
class ProviderModelsCost(BaseModel):
|
class ProviderModelsCost(BaseModel):
|
||||||
|
|
@ -140,10 +141,10 @@ class Config(BaseModel):
|
||||||
instructions: Optional[List[str]] = None
|
instructions: Optional[List[str]] = None
|
||||||
"""Additional instruction files or patterns to include"""
|
"""Additional instruction files or patterns to include"""
|
||||||
|
|
||||||
keybinds: Optional[Keybinds] = None
|
keybinds: Optional[KeybindsConfig] = None
|
||||||
"""Custom keybind configurations"""
|
"""Custom keybind configurations"""
|
||||||
|
|
||||||
layout: Optional[Literal["auto", "stretch"]] = None
|
layout: Optional[LayoutConfig] = None
|
||||||
"""Layout to use for the TUI"""
|
"""Layout to use for the TUI"""
|
||||||
|
|
||||||
log_level: Optional[LogLevel] = None
|
log_level: Optional[LogLevel] = None
|
||||||
|
|
|
||||||
|
|
@ -4,10 +4,10 @@ from pydantic import Field as FieldInfo
|
||||||
|
|
||||||
from .._models import BaseModel
|
from .._models import BaseModel
|
||||||
|
|
||||||
__all__ = ["Keybinds"]
|
__all__ = ["KeybindsConfig"]
|
||||||
|
|
||||||
|
|
||||||
class Keybinds(BaseModel):
|
class KeybindsConfig(BaseModel):
|
||||||
app_exit: str
|
app_exit: str
|
||||||
"""Exit the application"""
|
"""Exit the application"""
|
||||||
|
|
||||||
7
src/opencode_ai/types/layout_config.py
Normal file
7
src/opencode_ai/types/layout_config.py
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
||||||
|
|
||||||
|
from typing_extensions import Literal, TypeAlias
|
||||||
|
|
||||||
|
__all__ = ["LayoutConfig"]
|
||||||
|
|
||||||
|
LayoutConfig: TypeAlias = Literal["auto", "stretch"]
|
||||||
|
|
@ -5,10 +5,10 @@ from typing_extensions import Literal
|
||||||
|
|
||||||
from .._models import BaseModel
|
from .._models import BaseModel
|
||||||
|
|
||||||
__all__ = ["McpLocal"]
|
__all__ = ["McpLocalConfig"]
|
||||||
|
|
||||||
|
|
||||||
class McpLocal(BaseModel):
|
class McpLocalConfig(BaseModel):
|
||||||
command: List[str]
|
command: List[str]
|
||||||
"""Command and arguments to run the MCP server"""
|
"""Command and arguments to run the MCP server"""
|
||||||
|
|
||||||
|
|
@ -5,10 +5,10 @@ from typing_extensions import Literal
|
||||||
|
|
||||||
from .._models import BaseModel
|
from .._models import BaseModel
|
||||||
|
|
||||||
__all__ = ["McpRemote"]
|
__all__ = ["McpRemoteConfig"]
|
||||||
|
|
||||||
|
|
||||||
class McpRemote(BaseModel):
|
class McpRemoteConfig(BaseModel):
|
||||||
type: Literal["remote"]
|
type: Literal["remote"]
|
||||||
"""Type of MCP server connection"""
|
"""Type of MCP server connection"""
|
||||||
|
|
||||||
|
|
@ -4,10 +4,10 @@ from typing import Dict, Optional
|
||||||
|
|
||||||
from .._models import BaseModel
|
from .._models import BaseModel
|
||||||
|
|
||||||
__all__ = ["Mode"]
|
__all__ = ["ModeConfig"]
|
||||||
|
|
||||||
|
|
||||||
class Mode(BaseModel):
|
class ModeConfig(BaseModel):
|
||||||
model: Optional[str] = None
|
model: Optional[str] = None
|
||||||
|
|
||||||
prompt: Optional[str] = None
|
prompt: Optional[str] = None
|
||||||
|
|
@ -9,7 +9,13 @@ import pytest
|
||||||
|
|
||||||
from opencode_ai import Opencode, AsyncOpencode
|
from opencode_ai import Opencode, AsyncOpencode
|
||||||
from tests.utils import assert_matches_type
|
from tests.utils import assert_matches_type
|
||||||
from opencode_ai.types import App, AppLogResponse, AppInitResponse, AppModesResponse
|
from opencode_ai.types import (
|
||||||
|
App,
|
||||||
|
AppLogResponse,
|
||||||
|
AppInitResponse,
|
||||||
|
AppModesResponse,
|
||||||
|
AppProvidersResponse,
|
||||||
|
)
|
||||||
|
|
||||||
base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010")
|
base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010")
|
||||||
|
|
||||||
|
|
@ -152,6 +158,34 @@ class TestApp:
|
||||||
|
|
||||||
assert cast(Any, response.is_closed) is True
|
assert cast(Any, response.is_closed) is True
|
||||||
|
|
||||||
|
@pytest.mark.skip()
|
||||||
|
@parametrize
|
||||||
|
def test_method_providers(self, client: Opencode) -> None:
|
||||||
|
app = client.app.providers()
|
||||||
|
assert_matches_type(AppProvidersResponse, app, path=["response"])
|
||||||
|
|
||||||
|
@pytest.mark.skip()
|
||||||
|
@parametrize
|
||||||
|
def test_raw_response_providers(self, client: Opencode) -> None:
|
||||||
|
response = client.app.with_raw_response.providers()
|
||||||
|
|
||||||
|
assert response.is_closed is True
|
||||||
|
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||||
|
app = response.parse()
|
||||||
|
assert_matches_type(AppProvidersResponse, app, path=["response"])
|
||||||
|
|
||||||
|
@pytest.mark.skip()
|
||||||
|
@parametrize
|
||||||
|
def test_streaming_response_providers(self, client: Opencode) -> None:
|
||||||
|
with client.app.with_streaming_response.providers() as response:
|
||||||
|
assert not response.is_closed
|
||||||
|
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||||
|
|
||||||
|
app = response.parse()
|
||||||
|
assert_matches_type(AppProvidersResponse, app, path=["response"])
|
||||||
|
|
||||||
|
assert cast(Any, response.is_closed) is True
|
||||||
|
|
||||||
|
|
||||||
class TestAsyncApp:
|
class TestAsyncApp:
|
||||||
parametrize = pytest.mark.parametrize(
|
parametrize = pytest.mark.parametrize(
|
||||||
|
|
@ -292,3 +326,31 @@ class TestAsyncApp:
|
||||||
assert_matches_type(AppModesResponse, app, path=["response"])
|
assert_matches_type(AppModesResponse, app, path=["response"])
|
||||||
|
|
||||||
assert cast(Any, response.is_closed) is True
|
assert cast(Any, response.is_closed) is True
|
||||||
|
|
||||||
|
@pytest.mark.skip()
|
||||||
|
@parametrize
|
||||||
|
async def test_method_providers(self, async_client: AsyncOpencode) -> None:
|
||||||
|
app = await async_client.app.providers()
|
||||||
|
assert_matches_type(AppProvidersResponse, app, path=["response"])
|
||||||
|
|
||||||
|
@pytest.mark.skip()
|
||||||
|
@parametrize
|
||||||
|
async def test_raw_response_providers(self, async_client: AsyncOpencode) -> None:
|
||||||
|
response = await async_client.app.with_raw_response.providers()
|
||||||
|
|
||||||
|
assert response.is_closed is True
|
||||||
|
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||||
|
app = await response.parse()
|
||||||
|
assert_matches_type(AppProvidersResponse, app, path=["response"])
|
||||||
|
|
||||||
|
@pytest.mark.skip()
|
||||||
|
@parametrize
|
||||||
|
async def test_streaming_response_providers(self, async_client: AsyncOpencode) -> None:
|
||||||
|
async with async_client.app.with_streaming_response.providers() as response:
|
||||||
|
assert not response.is_closed
|
||||||
|
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||||
|
|
||||||
|
app = await response.parse()
|
||||||
|
assert_matches_type(AppProvidersResponse, app, path=["response"])
|
||||||
|
|
||||||
|
assert cast(Any, response.is_closed) is True
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@ import pytest
|
||||||
|
|
||||||
from opencode_ai import Opencode, AsyncOpencode
|
from opencode_ai import Opencode, AsyncOpencode
|
||||||
from tests.utils import assert_matches_type
|
from tests.utils import assert_matches_type
|
||||||
from opencode_ai.types import Config, ConfigProvidersResponse
|
from opencode_ai.types import Config
|
||||||
|
|
||||||
base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010")
|
base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010")
|
||||||
|
|
||||||
|
|
@ -45,34 +45,6 @@ class TestConfig:
|
||||||
|
|
||||||
assert cast(Any, response.is_closed) is True
|
assert cast(Any, response.is_closed) is True
|
||||||
|
|
||||||
@pytest.mark.skip()
|
|
||||||
@parametrize
|
|
||||||
def test_method_providers(self, client: Opencode) -> None:
|
|
||||||
config = client.config.providers()
|
|
||||||
assert_matches_type(ConfigProvidersResponse, config, path=["response"])
|
|
||||||
|
|
||||||
@pytest.mark.skip()
|
|
||||||
@parametrize
|
|
||||||
def test_raw_response_providers(self, client: Opencode) -> None:
|
|
||||||
response = client.config.with_raw_response.providers()
|
|
||||||
|
|
||||||
assert response.is_closed is True
|
|
||||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
|
||||||
config = response.parse()
|
|
||||||
assert_matches_type(ConfigProvidersResponse, config, path=["response"])
|
|
||||||
|
|
||||||
@pytest.mark.skip()
|
|
||||||
@parametrize
|
|
||||||
def test_streaming_response_providers(self, client: Opencode) -> None:
|
|
||||||
with client.config.with_streaming_response.providers() as response:
|
|
||||||
assert not response.is_closed
|
|
||||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
|
||||||
|
|
||||||
config = response.parse()
|
|
||||||
assert_matches_type(ConfigProvidersResponse, config, path=["response"])
|
|
||||||
|
|
||||||
assert cast(Any, response.is_closed) is True
|
|
||||||
|
|
||||||
|
|
||||||
class TestAsyncConfig:
|
class TestAsyncConfig:
|
||||||
parametrize = pytest.mark.parametrize(
|
parametrize = pytest.mark.parametrize(
|
||||||
|
|
@ -106,31 +78,3 @@ class TestAsyncConfig:
|
||||||
assert_matches_type(Config, config, path=["response"])
|
assert_matches_type(Config, config, path=["response"])
|
||||||
|
|
||||||
assert cast(Any, response.is_closed) is True
|
assert cast(Any, response.is_closed) is True
|
||||||
|
|
||||||
@pytest.mark.skip()
|
|
||||||
@parametrize
|
|
||||||
async def test_method_providers(self, async_client: AsyncOpencode) -> None:
|
|
||||||
config = await async_client.config.providers()
|
|
||||||
assert_matches_type(ConfigProvidersResponse, config, path=["response"])
|
|
||||||
|
|
||||||
@pytest.mark.skip()
|
|
||||||
@parametrize
|
|
||||||
async def test_raw_response_providers(self, async_client: AsyncOpencode) -> None:
|
|
||||||
response = await async_client.config.with_raw_response.providers()
|
|
||||||
|
|
||||||
assert response.is_closed is True
|
|
||||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
|
||||||
config = await response.parse()
|
|
||||||
assert_matches_type(ConfigProvidersResponse, config, path=["response"])
|
|
||||||
|
|
||||||
@pytest.mark.skip()
|
|
||||||
@parametrize
|
|
||||||
async def test_streaming_response_providers(self, async_client: AsyncOpencode) -> None:
|
|
||||||
async with async_client.config.with_streaming_response.providers() as response:
|
|
||||||
assert not response.is_closed
|
|
||||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
|
||||||
|
|
||||||
config = await response.parse()
|
|
||||||
assert_matches_type(ConfigProvidersResponse, config, path=["response"])
|
|
||||||
|
|
||||||
assert cast(Any, response.is_closed) is True
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue