mirror of
https://github.com/anomalyco/opencode-sdk-python.git
synced 2026-04-28 04:29:50 +00:00
feat(api): api update
This commit is contained in:
parent
06577e9685
commit
e2e1f1d384
18 changed files with 205 additions and 18 deletions
|
|
@ -1,4 +1,4 @@
|
|||
configured_endpoints: 22
|
||||
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/opencode%2Fopencode-a1da357fcefd3105736841fbf44018022fade78e67ffc81e178cf9196da723ee.yml
|
||||
openapi_spec_hash: 9bd27afcc5b8f43d8e4223f7c984035f
|
||||
config_hash: 62b73a3397120578a992bffd1e69386a
|
||||
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/opencode%2Fopencode-5e3b108daef12bb43f728ee42261cd1322e8909e6225db58d6fe0617f3b5904c.yml
|
||||
openapi_spec_hash: 1f9d2853ba0c1179e45426560e082ef4
|
||||
config_hash: 6d56a7ca0d6ed899ecdb5c053a8278ae
|
||||
|
|
|
|||
5
api.md
5
api.md
|
|
@ -23,7 +23,6 @@ Types:
|
|||
```python
|
||||
from opencode_ai.types import (
|
||||
App,
|
||||
LogLevel,
|
||||
Mode,
|
||||
Model,
|
||||
Provider,
|
||||
|
|
@ -96,12 +95,16 @@ from opencode_ai.types import (
|
|||
AssistantMessage,
|
||||
FilePart,
|
||||
FilePartInput,
|
||||
FilePartSource,
|
||||
FilePartSourceText,
|
||||
FileSource,
|
||||
Message,
|
||||
Part,
|
||||
Session,
|
||||
SnapshotPart,
|
||||
StepFinishPart,
|
||||
StepStartPart,
|
||||
SymbolSource,
|
||||
TextPart,
|
||||
TextPartInput,
|
||||
ToolPart,
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Iterable
|
||||
from typing import Dict, Iterable
|
||||
|
||||
import httpx
|
||||
|
||||
|
|
@ -163,6 +163,7 @@ class SessionResource(SyncAPIResource):
|
|||
provider_id: str,
|
||||
message_id: str | NotGiven = NOT_GIVEN,
|
||||
mode: str | NotGiven = NOT_GIVEN,
|
||||
tools: Dict[str, bool] | 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,
|
||||
|
|
@ -195,6 +196,7 @@ class SessionResource(SyncAPIResource):
|
|||
"provider_id": provider_id,
|
||||
"message_id": message_id,
|
||||
"mode": mode,
|
||||
"tools": tools,
|
||||
},
|
||||
session_chat_params.SessionChatParams,
|
||||
),
|
||||
|
|
@ -529,6 +531,7 @@ class AsyncSessionResource(AsyncAPIResource):
|
|||
provider_id: str,
|
||||
message_id: str | NotGiven = NOT_GIVEN,
|
||||
mode: str | NotGiven = NOT_GIVEN,
|
||||
tools: Dict[str, bool] | 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,
|
||||
|
|
@ -561,6 +564,7 @@ class AsyncSessionResource(AsyncAPIResource):
|
|||
"provider_id": provider_id,
|
||||
"message_id": message_id,
|
||||
"mode": mode,
|
||||
"tools": tools,
|
||||
},
|
||||
session_chat_params.SessionChatParams,
|
||||
),
|
||||
|
|
|
|||
|
|
@ -19,16 +19,18 @@ from .message import Message as Message
|
|||
from .session import Session as Session
|
||||
from .provider import Provider as Provider
|
||||
from .file_part import FilePart as FilePart
|
||||
from .log_level import LogLevel as LogLevel
|
||||
from .text_part import TextPart as TextPart
|
||||
from .tool_part import ToolPart as ToolPart
|
||||
from .file_source import FileSource as FileSource
|
||||
from .mode_config import ModeConfig as ModeConfig
|
||||
from .user_message import UserMessage as UserMessage
|
||||
from .snapshot_part import SnapshotPart as SnapshotPart
|
||||
from .symbol_source import SymbolSource as SymbolSource
|
||||
from .app_log_params import AppLogParams as AppLogParams
|
||||
from .keybinds_config import KeybindsConfig as KeybindsConfig
|
||||
from .step_start_part import StepStartPart as StepStartPart
|
||||
from .app_log_response import AppLogResponse as AppLogResponse
|
||||
from .file_part_source import FilePartSource as FilePartSource
|
||||
from .file_read_params import FileReadParams as FileReadParams
|
||||
from .find_text_params import FindTextParams as FindTextParams
|
||||
from .mcp_local_config import McpLocalConfig as McpLocalConfig
|
||||
|
|
@ -36,6 +38,7 @@ from .step_finish_part import StepFinishPart as StepFinishPart
|
|||
from .tool_state_error import ToolStateError as ToolStateError
|
||||
from .app_init_response import AppInitResponse as AppInitResponse
|
||||
from .assistant_message import AssistantMessage as AssistantMessage
|
||||
from .file_source_param import FileSourceParam as FileSourceParam
|
||||
from .find_files_params import FindFilesParams as FindFilesParams
|
||||
from .mcp_remote_config import McpRemoteConfig as McpRemoteConfig
|
||||
from .app_modes_response import AppModesResponse as AppModesResponse
|
||||
|
|
@ -48,16 +51,20 @@ from .find_files_response import FindFilesResponse as FindFilesResponse
|
|||
from .find_symbols_params import FindSymbolsParams as FindSymbolsParams
|
||||
from .session_chat_params import SessionChatParams as SessionChatParams
|
||||
from .session_init_params import SessionInitParams as SessionInitParams
|
||||
from .symbol_source_param import SymbolSourceParam as SymbolSourceParam
|
||||
from .file_status_response import FileStatusResponse as FileStatusResponse
|
||||
from .tool_state_completed import ToolStateCompleted as ToolStateCompleted
|
||||
from .file_part_input_param import FilePartInputParam as FilePartInputParam
|
||||
from .file_part_source_text import FilePartSourceText as FilePartSourceText
|
||||
from .find_symbols_response import FindSymbolsResponse as FindSymbolsResponse
|
||||
from .session_init_response import SessionInitResponse as SessionInitResponse
|
||||
from .session_list_response import SessionListResponse as SessionListResponse
|
||||
from .text_part_input_param import TextPartInputParam as TextPartInputParam
|
||||
from .app_providers_response import AppProvidersResponse as AppProvidersResponse
|
||||
from .file_part_source_param import FilePartSourceParam as FilePartSourceParam
|
||||
from .session_abort_response import SessionAbortResponse as SessionAbortResponse
|
||||
from .session_delete_response import SessionDeleteResponse as SessionDeleteResponse
|
||||
from .session_summarize_params import SessionSummarizeParams as SessionSummarizeParams
|
||||
from .session_messages_response import SessionMessagesResponse as SessionMessagesResponse
|
||||
from .session_summarize_response import SessionSummarizeResponse as SessionSummarizeResponse
|
||||
from .file_part_source_text_param import FilePartSourceTextParam as FilePartSourceTextParam
|
||||
|
|
|
|||
|
|
@ -7,7 +7,6 @@ from pydantic import Field as FieldInfo
|
|||
|
||||
from .._utils import PropertyInfo
|
||||
from .._models import BaseModel
|
||||
from .log_level import LogLevel
|
||||
from .mode_config import ModeConfig
|
||||
from .keybinds_config import KeybindsConfig
|
||||
from .mcp_local_config import McpLocalConfig
|
||||
|
|
@ -146,9 +145,6 @@ class Config(BaseModel):
|
|||
layout: Optional[Literal["auto", "stretch"]] = None
|
||||
"""@deprecated Always uses stretch layout."""
|
||||
|
||||
log_level: Optional[LogLevel] = None
|
||||
"""Minimum log level to write to log files"""
|
||||
|
||||
mcp: Optional[Dict[str, Mcp]] = None
|
||||
"""MCP (Model Context Protocol) server configurations"""
|
||||
|
||||
|
|
@ -167,6 +163,12 @@ class Config(BaseModel):
|
|||
enables automatic sharing, 'disabled' disables all sharing
|
||||
"""
|
||||
|
||||
small_model: Optional[str] = None
|
||||
"""
|
||||
Small model to use for tasks like summarization and title generation in the
|
||||
format of provider/model
|
||||
"""
|
||||
|
||||
theme: Optional[str] = None
|
||||
"""Theme name to use for the interface"""
|
||||
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ from typing_extensions import Literal
|
|||
from pydantic import Field as FieldInfo
|
||||
|
||||
from .._models import BaseModel
|
||||
from .file_part_source import FilePartSource
|
||||
|
||||
__all__ = ["FilePart"]
|
||||
|
||||
|
|
@ -24,3 +25,5 @@ class FilePart(BaseModel):
|
|||
url: str
|
||||
|
||||
filename: Optional[str] = None
|
||||
|
||||
source: Optional[FilePartSource] = None
|
||||
|
|
|
|||
|
|
@ -4,6 +4,8 @@ from __future__ import annotations
|
|||
|
||||
from typing_extensions import Literal, Required, TypedDict
|
||||
|
||||
from .file_part_source_param import FilePartSourceParam
|
||||
|
||||
__all__ = ["FilePartInputParam"]
|
||||
|
||||
|
||||
|
|
@ -17,3 +19,5 @@ class FilePartInputParam(TypedDict, total=False):
|
|||
id: str
|
||||
|
||||
filename: str
|
||||
|
||||
source: FilePartSourceParam
|
||||
|
|
|
|||
12
src/opencode_ai/types/file_part_source.py
Normal file
12
src/opencode_ai/types/file_part_source.py
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
||||
|
||||
from typing import Union
|
||||
from typing_extensions import Annotated, TypeAlias
|
||||
|
||||
from .._utils import PropertyInfo
|
||||
from .file_source import FileSource
|
||||
from .symbol_source import SymbolSource
|
||||
|
||||
__all__ = ["FilePartSource"]
|
||||
|
||||
FilePartSource: TypeAlias = Annotated[Union[FileSource, SymbolSource], PropertyInfo(discriminator="type")]
|
||||
13
src/opencode_ai/types/file_part_source_param.py
Normal file
13
src/opencode_ai/types/file_part_source_param.py
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Union
|
||||
from typing_extensions import TypeAlias
|
||||
|
||||
from .file_source_param import FileSourceParam
|
||||
from .symbol_source_param import SymbolSourceParam
|
||||
|
||||
__all__ = ["FilePartSourceParam"]
|
||||
|
||||
FilePartSourceParam: TypeAlias = Union[FileSourceParam, SymbolSourceParam]
|
||||
13
src/opencode_ai/types/file_part_source_text.py
Normal file
13
src/opencode_ai/types/file_part_source_text.py
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
||||
|
||||
from .._models import BaseModel
|
||||
|
||||
__all__ = ["FilePartSourceText"]
|
||||
|
||||
|
||||
class FilePartSourceText(BaseModel):
|
||||
end: int
|
||||
|
||||
start: int
|
||||
|
||||
value: str
|
||||
15
src/opencode_ai/types/file_part_source_text_param.py
Normal file
15
src/opencode_ai/types/file_part_source_text_param.py
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from typing_extensions import Required, TypedDict
|
||||
|
||||
__all__ = ["FilePartSourceTextParam"]
|
||||
|
||||
|
||||
class FilePartSourceTextParam(TypedDict, total=False):
|
||||
end: Required[int]
|
||||
|
||||
start: Required[int]
|
||||
|
||||
value: Required[str]
|
||||
16
src/opencode_ai/types/file_source.py
Normal file
16
src/opencode_ai/types/file_source.py
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
||||
|
||||
from typing_extensions import Literal
|
||||
|
||||
from .._models import BaseModel
|
||||
from .file_part_source_text import FilePartSourceText
|
||||
|
||||
__all__ = ["FileSource"]
|
||||
|
||||
|
||||
class FileSource(BaseModel):
|
||||
path: str
|
||||
|
||||
text: FilePartSourceText
|
||||
|
||||
type: Literal["file"]
|
||||
17
src/opencode_ai/types/file_source_param.py
Normal file
17
src/opencode_ai/types/file_source_param.py
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from typing_extensions import Literal, Required, TypedDict
|
||||
|
||||
from .file_part_source_text_param import FilePartSourceTextParam
|
||||
|
||||
__all__ = ["FileSourceParam"]
|
||||
|
||||
|
||||
class FileSourceParam(TypedDict, total=False):
|
||||
path: Required[str]
|
||||
|
||||
text: Required[FilePartSourceTextParam]
|
||||
|
||||
type: Required[Literal["file"]]
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
||||
|
||||
from typing_extensions import Literal, TypeAlias
|
||||
|
||||
__all__ = ["LogLevel"]
|
||||
|
||||
LogLevel: TypeAlias = Literal["DEBUG", "INFO", "WARN", "ERROR"]
|
||||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Union, Iterable
|
||||
from typing import Dict, Union, Iterable
|
||||
from typing_extensions import Required, Annotated, TypeAlias, TypedDict
|
||||
|
||||
from .._utils import PropertyInfo
|
||||
|
|
@ -23,5 +23,7 @@ class SessionChatParams(TypedDict, total=False):
|
|||
|
||||
mode: str
|
||||
|
||||
tools: Dict[str, bool]
|
||||
|
||||
|
||||
Part: TypeAlias = Union[TextPartInputParam, FilePartInputParam]
|
||||
|
|
|
|||
40
src/opencode_ai/types/symbol_source.py
Normal file
40
src/opencode_ai/types/symbol_source.py
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
||||
|
||||
from typing_extensions import Literal
|
||||
|
||||
from .._models import BaseModel
|
||||
from .file_part_source_text import FilePartSourceText
|
||||
|
||||
__all__ = ["SymbolSource", "Range", "RangeEnd", "RangeStart"]
|
||||
|
||||
|
||||
class RangeEnd(BaseModel):
|
||||
character: float
|
||||
|
||||
line: float
|
||||
|
||||
|
||||
class RangeStart(BaseModel):
|
||||
character: float
|
||||
|
||||
line: float
|
||||
|
||||
|
||||
class Range(BaseModel):
|
||||
end: RangeEnd
|
||||
|
||||
start: RangeStart
|
||||
|
||||
|
||||
class SymbolSource(BaseModel):
|
||||
kind: int
|
||||
|
||||
name: str
|
||||
|
||||
path: str
|
||||
|
||||
range: Range
|
||||
|
||||
text: FilePartSourceText
|
||||
|
||||
type: Literal["symbol"]
|
||||
41
src/opencode_ai/types/symbol_source_param.py
Normal file
41
src/opencode_ai/types/symbol_source_param.py
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from typing_extensions import Literal, Required, TypedDict
|
||||
|
||||
from .file_part_source_text_param import FilePartSourceTextParam
|
||||
|
||||
__all__ = ["SymbolSourceParam", "Range", "RangeEnd", "RangeStart"]
|
||||
|
||||
|
||||
class RangeEnd(TypedDict, total=False):
|
||||
character: Required[float]
|
||||
|
||||
line: Required[float]
|
||||
|
||||
|
||||
class RangeStart(TypedDict, total=False):
|
||||
character: Required[float]
|
||||
|
||||
line: Required[float]
|
||||
|
||||
|
||||
class Range(TypedDict, total=False):
|
||||
end: Required[RangeEnd]
|
||||
|
||||
start: Required[RangeStart]
|
||||
|
||||
|
||||
class SymbolSourceParam(TypedDict, total=False):
|
||||
kind: Required[int]
|
||||
|
||||
name: Required[str]
|
||||
|
||||
path: Required[str]
|
||||
|
||||
range: Required[Range]
|
||||
|
||||
text: Required[FilePartSourceTextParam]
|
||||
|
||||
type: Required[Literal["symbol"]]
|
||||
|
|
@ -203,6 +203,7 @@ class TestSession:
|
|||
provider_id="providerID",
|
||||
message_id="msg",
|
||||
mode="mode",
|
||||
tools={"foo": True},
|
||||
)
|
||||
assert_matches_type(AssistantMessage, session, path=["response"])
|
||||
|
||||
|
|
@ -677,6 +678,7 @@ class TestAsyncSession:
|
|||
provider_id="providerID",
|
||||
message_id="msg",
|
||||
mode="mode",
|
||||
tools={"foo": True},
|
||||
)
|
||||
assert_matches_type(AssistantMessage, session, path=["response"])
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue