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
4e7027e1d9
commit
1de4987d50
13 changed files with 139 additions and 104 deletions
|
|
@ -1,4 +1,4 @@
|
||||||
configured_endpoints: 26
|
configured_endpoints: 26
|
||||||
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/opencode%2Fopencode-5748199af356c3243a46a466e73b5d0bab7eaa0c56895e1d0f903d637f61d0bb.yml
|
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/opencode%2Fopencode-be4c3fb58765ee2b56c3b548182b9d0f1a9d5ebb7c340083bc578bcf3876b026.yml
|
||||||
openapi_spec_hash: c04f6b6be54b05d9b1283c24e870163b
|
openapi_spec_hash: dd5d801d838fd6b522b1dd892a75fce1
|
||||||
config_hash: 1ae82c93499b9f0b9ba828b8919f9cb3
|
config_hash: 1ae82c93499b9f0b9ba828b8919f9cb3
|
||||||
|
|
|
||||||
8
api.md
8
api.md
|
|
@ -46,13 +46,7 @@ Methods:
|
||||||
Types:
|
Types:
|
||||||
|
|
||||||
```python
|
```python
|
||||||
from opencode_ai.types import (
|
from opencode_ai.types import Symbol, FindFilesResponse, FindSymbolsResponse, FindTextResponse
|
||||||
Match,
|
|
||||||
Symbol,
|
|
||||||
FindFilesResponse,
|
|
||||||
FindSymbolsResponse,
|
|
||||||
FindTextResponse,
|
|
||||||
)
|
|
||||||
```
|
```
|
||||||
|
|
||||||
Methods:
|
Methods:
|
||||||
|
|
|
||||||
|
|
@ -163,6 +163,7 @@ class SessionResource(SyncAPIResource):
|
||||||
provider_id: str,
|
provider_id: str,
|
||||||
message_id: str | NotGiven = NOT_GIVEN,
|
message_id: str | NotGiven = NOT_GIVEN,
|
||||||
mode: str | NotGiven = NOT_GIVEN,
|
mode: str | NotGiven = NOT_GIVEN,
|
||||||
|
system: str | NotGiven = NOT_GIVEN,
|
||||||
tools: Dict[str, bool] | 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.
|
# 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.
|
# The extra values given here take precedence over values defined on the client or passed to this method.
|
||||||
|
|
@ -196,6 +197,7 @@ class SessionResource(SyncAPIResource):
|
||||||
"provider_id": provider_id,
|
"provider_id": provider_id,
|
||||||
"message_id": message_id,
|
"message_id": message_id,
|
||||||
"mode": mode,
|
"mode": mode,
|
||||||
|
"system": system,
|
||||||
"tools": tools,
|
"tools": tools,
|
||||||
},
|
},
|
||||||
session_chat_params.SessionChatParams,
|
session_chat_params.SessionChatParams,
|
||||||
|
|
@ -606,6 +608,7 @@ class AsyncSessionResource(AsyncAPIResource):
|
||||||
provider_id: str,
|
provider_id: str,
|
||||||
message_id: str | NotGiven = NOT_GIVEN,
|
message_id: str | NotGiven = NOT_GIVEN,
|
||||||
mode: str | NotGiven = NOT_GIVEN,
|
mode: str | NotGiven = NOT_GIVEN,
|
||||||
|
system: str | NotGiven = NOT_GIVEN,
|
||||||
tools: Dict[str, bool] | 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.
|
# 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.
|
# The extra values given here take precedence over values defined on the client or passed to this method.
|
||||||
|
|
@ -639,6 +642,7 @@ class AsyncSessionResource(AsyncAPIResource):
|
||||||
"provider_id": provider_id,
|
"provider_id": provider_id,
|
||||||
"message_id": message_id,
|
"message_id": message_id,
|
||||||
"mode": mode,
|
"mode": mode,
|
||||||
|
"system": system,
|
||||||
"tools": tools,
|
"tools": tools,
|
||||||
},
|
},
|
||||||
session_chat_params.SessionChatParams,
|
session_chat_params.SessionChatParams,
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,6 @@ from .app import App as App
|
||||||
from .file import File as File
|
from .file import File as File
|
||||||
from .mode import Mode as Mode
|
from .mode import Mode as Mode
|
||||||
from .part import Part as Part
|
from .part import Part as Part
|
||||||
from .match import Match as Match
|
|
||||||
from .model import Model as Model
|
from .model import Model as Model
|
||||||
from .config import Config as Config
|
from .config import Config as Config
|
||||||
from .shared import (
|
from .shared import (
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,9 @@ from .mcp_remote_config import McpRemoteConfig
|
||||||
|
|
||||||
__all__ = [
|
__all__ = [
|
||||||
"Config",
|
"Config",
|
||||||
|
"Agent",
|
||||||
|
"AgentGeneral",
|
||||||
|
"AgentAgentItem",
|
||||||
"Experimental",
|
"Experimental",
|
||||||
"ExperimentalHook",
|
"ExperimentalHook",
|
||||||
"ExperimentalHookFileEdited",
|
"ExperimentalHookFileEdited",
|
||||||
|
|
@ -28,6 +31,25 @@ __all__ = [
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
class AgentGeneral(ModeConfig):
|
||||||
|
description: str
|
||||||
|
|
||||||
|
|
||||||
|
class AgentAgentItem(ModeConfig):
|
||||||
|
description: str
|
||||||
|
|
||||||
|
|
||||||
|
class Agent(BaseModel):
|
||||||
|
general: Optional[AgentGeneral] = None
|
||||||
|
|
||||||
|
__pydantic_extra__: Dict[str, AgentAgentItem] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride]
|
||||||
|
if TYPE_CHECKING:
|
||||||
|
# Stub to indicate that arbitrary properties are accepted.
|
||||||
|
# To access properties that are not valid identifiers you can use `getattr`, e.g.
|
||||||
|
# `getattr(obj, '$type')`
|
||||||
|
def __getattr__(self, attr: str) -> AgentAgentItem: ...
|
||||||
|
|
||||||
|
|
||||||
class ExperimentalHookFileEdited(BaseModel):
|
class ExperimentalHookFileEdited(BaseModel):
|
||||||
command: List[str]
|
command: List[str]
|
||||||
|
|
||||||
|
|
@ -137,6 +159,9 @@ class Config(BaseModel):
|
||||||
schema_: Optional[str] = FieldInfo(alias="$schema", default=None)
|
schema_: Optional[str] = FieldInfo(alias="$schema", default=None)
|
||||||
"""JSON schema reference for configuration validation"""
|
"""JSON schema reference for configuration validation"""
|
||||||
|
|
||||||
|
agent: Optional[Agent] = None
|
||||||
|
"""Modes configuration, see https://opencode.ai/docs/modes"""
|
||||||
|
|
||||||
autoshare: Optional[bool] = None
|
autoshare: Optional[bool] = None
|
||||||
"""@deprecated Use 'share' field instead.
|
"""@deprecated Use 'share' field instead.
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -16,15 +16,10 @@ from .shared.message_aborted_error import MessageAbortedError
|
||||||
|
|
||||||
__all__ = [
|
__all__ = [
|
||||||
"EventListResponse",
|
"EventListResponse",
|
||||||
"EventLspClientDiagnostics",
|
|
||||||
"EventLspClientDiagnosticsProperties",
|
|
||||||
"EventPermissionUpdated",
|
|
||||||
"EventPermissionUpdatedProperties",
|
|
||||||
"EventPermissionUpdatedPropertiesTime",
|
|
||||||
"EventFileEdited",
|
|
||||||
"EventFileEditedProperties",
|
|
||||||
"EventInstallationUpdated",
|
"EventInstallationUpdated",
|
||||||
"EventInstallationUpdatedProperties",
|
"EventInstallationUpdatedProperties",
|
||||||
|
"EventLspClientDiagnostics",
|
||||||
|
"EventLspClientDiagnosticsProperties",
|
||||||
"EventMessageUpdated",
|
"EventMessageUpdated",
|
||||||
"EventMessageUpdatedProperties",
|
"EventMessageUpdatedProperties",
|
||||||
"EventMessageRemoved",
|
"EventMessageRemoved",
|
||||||
|
|
@ -35,6 +30,11 @@ __all__ = [
|
||||||
"EventMessagePartRemovedProperties",
|
"EventMessagePartRemovedProperties",
|
||||||
"EventStorageWrite",
|
"EventStorageWrite",
|
||||||
"EventStorageWriteProperties",
|
"EventStorageWriteProperties",
|
||||||
|
"EventPermissionUpdated",
|
||||||
|
"EventPermissionUpdatedProperties",
|
||||||
|
"EventPermissionUpdatedPropertiesTime",
|
||||||
|
"EventFileEdited",
|
||||||
|
"EventFileEditedProperties",
|
||||||
"EventSessionUpdated",
|
"EventSessionUpdated",
|
||||||
"EventSessionUpdatedProperties",
|
"EventSessionUpdatedProperties",
|
||||||
"EventSessionDeleted",
|
"EventSessionDeleted",
|
||||||
|
|
@ -52,6 +52,16 @@ __all__ = [
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
class EventInstallationUpdatedProperties(BaseModel):
|
||||||
|
version: str
|
||||||
|
|
||||||
|
|
||||||
|
class EventInstallationUpdated(BaseModel):
|
||||||
|
properties: EventInstallationUpdatedProperties
|
||||||
|
|
||||||
|
type: Literal["installation.updated"]
|
||||||
|
|
||||||
|
|
||||||
class EventLspClientDiagnosticsProperties(BaseModel):
|
class EventLspClientDiagnosticsProperties(BaseModel):
|
||||||
path: str
|
path: str
|
||||||
|
|
||||||
|
|
@ -64,48 +74,6 @@ class EventLspClientDiagnostics(BaseModel):
|
||||||
type: Literal["lsp.client.diagnostics"]
|
type: Literal["lsp.client.diagnostics"]
|
||||||
|
|
||||||
|
|
||||||
class EventPermissionUpdatedPropertiesTime(BaseModel):
|
|
||||||
created: float
|
|
||||||
|
|
||||||
|
|
||||||
class EventPermissionUpdatedProperties(BaseModel):
|
|
||||||
id: str
|
|
||||||
|
|
||||||
metadata: Dict[str, object]
|
|
||||||
|
|
||||||
session_id: str = FieldInfo(alias="sessionID")
|
|
||||||
|
|
||||||
time: EventPermissionUpdatedPropertiesTime
|
|
||||||
|
|
||||||
title: str
|
|
||||||
|
|
||||||
|
|
||||||
class EventPermissionUpdated(BaseModel):
|
|
||||||
properties: EventPermissionUpdatedProperties
|
|
||||||
|
|
||||||
type: Literal["permission.updated"]
|
|
||||||
|
|
||||||
|
|
||||||
class EventFileEditedProperties(BaseModel):
|
|
||||||
file: str
|
|
||||||
|
|
||||||
|
|
||||||
class EventFileEdited(BaseModel):
|
|
||||||
properties: EventFileEditedProperties
|
|
||||||
|
|
||||||
type: Literal["file.edited"]
|
|
||||||
|
|
||||||
|
|
||||||
class EventInstallationUpdatedProperties(BaseModel):
|
|
||||||
version: str
|
|
||||||
|
|
||||||
|
|
||||||
class EventInstallationUpdated(BaseModel):
|
|
||||||
properties: EventInstallationUpdatedProperties
|
|
||||||
|
|
||||||
type: Literal["installation.updated"]
|
|
||||||
|
|
||||||
|
|
||||||
class EventMessageUpdatedProperties(BaseModel):
|
class EventMessageUpdatedProperties(BaseModel):
|
||||||
info: Message
|
info: Message
|
||||||
|
|
||||||
|
|
@ -162,6 +130,38 @@ class EventStorageWrite(BaseModel):
|
||||||
type: Literal["storage.write"]
|
type: Literal["storage.write"]
|
||||||
|
|
||||||
|
|
||||||
|
class EventPermissionUpdatedPropertiesTime(BaseModel):
|
||||||
|
created: float
|
||||||
|
|
||||||
|
|
||||||
|
class EventPermissionUpdatedProperties(BaseModel):
|
||||||
|
id: str
|
||||||
|
|
||||||
|
metadata: Dict[str, object]
|
||||||
|
|
||||||
|
session_id: str = FieldInfo(alias="sessionID")
|
||||||
|
|
||||||
|
time: EventPermissionUpdatedPropertiesTime
|
||||||
|
|
||||||
|
title: str
|
||||||
|
|
||||||
|
|
||||||
|
class EventPermissionUpdated(BaseModel):
|
||||||
|
properties: EventPermissionUpdatedProperties
|
||||||
|
|
||||||
|
type: Literal["permission.updated"]
|
||||||
|
|
||||||
|
|
||||||
|
class EventFileEditedProperties(BaseModel):
|
||||||
|
file: str
|
||||||
|
|
||||||
|
|
||||||
|
class EventFileEdited(BaseModel):
|
||||||
|
properties: EventFileEditedProperties
|
||||||
|
|
||||||
|
type: Literal["file.edited"]
|
||||||
|
|
||||||
|
|
||||||
class EventSessionUpdatedProperties(BaseModel):
|
class EventSessionUpdatedProperties(BaseModel):
|
||||||
info: Session
|
info: Session
|
||||||
|
|
||||||
|
|
@ -242,15 +242,15 @@ class EventIdeInstalled(BaseModel):
|
||||||
|
|
||||||
EventListResponse: TypeAlias = Annotated[
|
EventListResponse: TypeAlias = Annotated[
|
||||||
Union[
|
Union[
|
||||||
EventLspClientDiagnostics,
|
|
||||||
EventPermissionUpdated,
|
|
||||||
EventFileEdited,
|
|
||||||
EventInstallationUpdated,
|
EventInstallationUpdated,
|
||||||
|
EventLspClientDiagnostics,
|
||||||
EventMessageUpdated,
|
EventMessageUpdated,
|
||||||
EventMessageRemoved,
|
EventMessageRemoved,
|
||||||
EventMessagePartUpdated,
|
EventMessagePartUpdated,
|
||||||
EventMessagePartRemoved,
|
EventMessagePartRemoved,
|
||||||
EventStorageWrite,
|
EventStorageWrite,
|
||||||
|
EventPermissionUpdated,
|
||||||
|
EventFileEdited,
|
||||||
EventSessionUpdated,
|
EventSessionUpdated,
|
||||||
EventSessionDeleted,
|
EventSessionDeleted,
|
||||||
EventSessionIdle,
|
EventSessionIdle,
|
||||||
|
|
|
||||||
|
|
@ -3,8 +3,48 @@
|
||||||
from typing import List
|
from typing import List
|
||||||
from typing_extensions import TypeAlias
|
from typing_extensions import TypeAlias
|
||||||
|
|
||||||
from .match import Match
|
from .._models import BaseModel
|
||||||
|
|
||||||
__all__ = ["FindTextResponse"]
|
__all__ = [
|
||||||
|
"FindTextResponse",
|
||||||
|
"FindTextResponseItem",
|
||||||
|
"FindTextResponseItemLines",
|
||||||
|
"FindTextResponseItemPath",
|
||||||
|
"FindTextResponseItemSubmatch",
|
||||||
|
"FindTextResponseItemSubmatchMatch",
|
||||||
|
]
|
||||||
|
|
||||||
FindTextResponse: TypeAlias = List[Match]
|
|
||||||
|
class FindTextResponseItemLines(BaseModel):
|
||||||
|
text: str
|
||||||
|
|
||||||
|
|
||||||
|
class FindTextResponseItemPath(BaseModel):
|
||||||
|
text: str
|
||||||
|
|
||||||
|
|
||||||
|
class FindTextResponseItemSubmatchMatch(BaseModel):
|
||||||
|
text: str
|
||||||
|
|
||||||
|
|
||||||
|
class FindTextResponseItemSubmatch(BaseModel):
|
||||||
|
end: float
|
||||||
|
|
||||||
|
match: FindTextResponseItemSubmatchMatch
|
||||||
|
|
||||||
|
start: float
|
||||||
|
|
||||||
|
|
||||||
|
class FindTextResponseItem(BaseModel):
|
||||||
|
absolute_offset: float
|
||||||
|
|
||||||
|
line_number: float
|
||||||
|
|
||||||
|
lines: FindTextResponseItemLines
|
||||||
|
|
||||||
|
path: FindTextResponseItemPath
|
||||||
|
|
||||||
|
submatches: List[FindTextResponseItemSubmatch]
|
||||||
|
|
||||||
|
|
||||||
|
FindTextResponse: TypeAlias = List[FindTextResponseItem]
|
||||||
|
|
|
||||||
|
|
@ -1,39 +0,0 @@
|
||||||
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
||||||
|
|
||||||
from typing import List
|
|
||||||
|
|
||||||
from .._models import BaseModel
|
|
||||||
|
|
||||||
__all__ = ["Match", "Lines", "Path", "Submatch", "SubmatchMatch"]
|
|
||||||
|
|
||||||
|
|
||||||
class Lines(BaseModel):
|
|
||||||
text: str
|
|
||||||
|
|
||||||
|
|
||||||
class Path(BaseModel):
|
|
||||||
text: str
|
|
||||||
|
|
||||||
|
|
||||||
class SubmatchMatch(BaseModel):
|
|
||||||
text: str
|
|
||||||
|
|
||||||
|
|
||||||
class Submatch(BaseModel):
|
|
||||||
end: float
|
|
||||||
|
|
||||||
match: SubmatchMatch
|
|
||||||
|
|
||||||
start: float
|
|
||||||
|
|
||||||
|
|
||||||
class Match(BaseModel):
|
|
||||||
absolute_offset: float
|
|
||||||
|
|
||||||
line_number: float
|
|
||||||
|
|
||||||
lines: Lines
|
|
||||||
|
|
||||||
path: Path
|
|
||||||
|
|
||||||
submatches: List[Submatch]
|
|
||||||
|
|
@ -23,3 +23,5 @@ class Mode(BaseModel):
|
||||||
model: Optional[Model] = None
|
model: Optional[Model] = None
|
||||||
|
|
||||||
prompt: Optional[str] = None
|
prompt: Optional[str] = None
|
||||||
|
|
||||||
|
temperature: Optional[float] = None
|
||||||
|
|
|
||||||
|
|
@ -8,8 +8,12 @@ __all__ = ["ModeConfig"]
|
||||||
|
|
||||||
|
|
||||||
class ModeConfig(BaseModel):
|
class ModeConfig(BaseModel):
|
||||||
|
disable: Optional[bool] = None
|
||||||
|
|
||||||
model: Optional[str] = None
|
model: Optional[str] = None
|
||||||
|
|
||||||
prompt: Optional[str] = None
|
prompt: Optional[str] = None
|
||||||
|
|
||||||
|
temperature: Optional[float] = None
|
||||||
|
|
||||||
tools: Optional[Dict[str, bool]] = None
|
tools: Optional[Dict[str, bool]] = None
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,8 @@ class Time(BaseModel):
|
||||||
class Revert(BaseModel):
|
class Revert(BaseModel):
|
||||||
message_id: str = FieldInfo(alias="messageID")
|
message_id: str = FieldInfo(alias="messageID")
|
||||||
|
|
||||||
|
diff: Optional[str] = None
|
||||||
|
|
||||||
part_id: Optional[str] = FieldInfo(alias="partID", default=None)
|
part_id: Optional[str] = FieldInfo(alias="partID", default=None)
|
||||||
|
|
||||||
snapshot: Optional[str] = None
|
snapshot: Optional[str] = None
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,8 @@ class SessionChatParams(TypedDict, total=False):
|
||||||
|
|
||||||
mode: str
|
mode: str
|
||||||
|
|
||||||
|
system: str
|
||||||
|
|
||||||
tools: Dict[str, bool]
|
tools: Dict[str, bool]
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -203,6 +203,7 @@ class TestSession:
|
||||||
provider_id="providerID",
|
provider_id="providerID",
|
||||||
message_id="msg",
|
message_id="msg",
|
||||||
mode="mode",
|
mode="mode",
|
||||||
|
system="system",
|
||||||
tools={"foo": True},
|
tools={"foo": True},
|
||||||
)
|
)
|
||||||
assert_matches_type(AssistantMessage, session, path=["response"])
|
assert_matches_type(AssistantMessage, session, path=["response"])
|
||||||
|
|
@ -776,6 +777,7 @@ class TestAsyncSession:
|
||||||
provider_id="providerID",
|
provider_id="providerID",
|
||||||
message_id="msg",
|
message_id="msg",
|
||||||
mode="mode",
|
mode="mode",
|
||||||
|
system="system",
|
||||||
tools={"foo": True},
|
tools={"foo": True},
|
||||||
)
|
)
|
||||||
assert_matches_type(AssistantMessage, session, path=["response"])
|
assert_matches_type(AssistantMessage, session, path=["response"])
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue