mirror of
https://github.com/anomalyco/opencode-sdk-python.git
synced 2026-04-26 11:40:54 +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
|
||||
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/opencode%2Fopencode-5748199af356c3243a46a466e73b5d0bab7eaa0c56895e1d0f903d637f61d0bb.yml
|
||||
openapi_spec_hash: c04f6b6be54b05d9b1283c24e870163b
|
||||
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/opencode%2Fopencode-be4c3fb58765ee2b56c3b548182b9d0f1a9d5ebb7c340083bc578bcf3876b026.yml
|
||||
openapi_spec_hash: dd5d801d838fd6b522b1dd892a75fce1
|
||||
config_hash: 1ae82c93499b9f0b9ba828b8919f9cb3
|
||||
|
|
|
|||
8
api.md
8
api.md
|
|
@ -46,13 +46,7 @@ Methods:
|
|||
Types:
|
||||
|
||||
```python
|
||||
from opencode_ai.types import (
|
||||
Match,
|
||||
Symbol,
|
||||
FindFilesResponse,
|
||||
FindSymbolsResponse,
|
||||
FindTextResponse,
|
||||
)
|
||||
from opencode_ai.types import Symbol, FindFilesResponse, FindSymbolsResponse, FindTextResponse
|
||||
```
|
||||
|
||||
Methods:
|
||||
|
|
|
|||
|
|
@ -163,6 +163,7 @@ class SessionResource(SyncAPIResource):
|
|||
provider_id: str,
|
||||
message_id: str | NotGiven = NOT_GIVEN,
|
||||
mode: str | NotGiven = NOT_GIVEN,
|
||||
system: 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.
|
||||
|
|
@ -196,6 +197,7 @@ class SessionResource(SyncAPIResource):
|
|||
"provider_id": provider_id,
|
||||
"message_id": message_id,
|
||||
"mode": mode,
|
||||
"system": system,
|
||||
"tools": tools,
|
||||
},
|
||||
session_chat_params.SessionChatParams,
|
||||
|
|
@ -606,6 +608,7 @@ class AsyncSessionResource(AsyncAPIResource):
|
|||
provider_id: str,
|
||||
message_id: str | NotGiven = NOT_GIVEN,
|
||||
mode: str | NotGiven = NOT_GIVEN,
|
||||
system: 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.
|
||||
|
|
@ -639,6 +642,7 @@ class AsyncSessionResource(AsyncAPIResource):
|
|||
"provider_id": provider_id,
|
||||
"message_id": message_id,
|
||||
"mode": mode,
|
||||
"system": system,
|
||||
"tools": tools,
|
||||
},
|
||||
session_chat_params.SessionChatParams,
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@ from .app import App as App
|
|||
from .file import File as File
|
||||
from .mode import Mode as Mode
|
||||
from .part import Part as Part
|
||||
from .match import Match as Match
|
||||
from .model import Model as Model
|
||||
from .config import Config as Config
|
||||
from .shared import (
|
||||
|
|
|
|||
|
|
@ -14,6 +14,9 @@ from .mcp_remote_config import McpRemoteConfig
|
|||
|
||||
__all__ = [
|
||||
"Config",
|
||||
"Agent",
|
||||
"AgentGeneral",
|
||||
"AgentAgentItem",
|
||||
"Experimental",
|
||||
"ExperimentalHook",
|
||||
"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):
|
||||
command: List[str]
|
||||
|
||||
|
|
@ -137,6 +159,9 @@ class Config(BaseModel):
|
|||
schema_: Optional[str] = FieldInfo(alias="$schema", default=None)
|
||||
"""JSON schema reference for configuration validation"""
|
||||
|
||||
agent: Optional[Agent] = None
|
||||
"""Modes configuration, see https://opencode.ai/docs/modes"""
|
||||
|
||||
autoshare: Optional[bool] = None
|
||||
"""@deprecated Use 'share' field instead.
|
||||
|
||||
|
|
|
|||
|
|
@ -16,15 +16,10 @@ from .shared.message_aborted_error import MessageAbortedError
|
|||
|
||||
__all__ = [
|
||||
"EventListResponse",
|
||||
"EventLspClientDiagnostics",
|
||||
"EventLspClientDiagnosticsProperties",
|
||||
"EventPermissionUpdated",
|
||||
"EventPermissionUpdatedProperties",
|
||||
"EventPermissionUpdatedPropertiesTime",
|
||||
"EventFileEdited",
|
||||
"EventFileEditedProperties",
|
||||
"EventInstallationUpdated",
|
||||
"EventInstallationUpdatedProperties",
|
||||
"EventLspClientDiagnostics",
|
||||
"EventLspClientDiagnosticsProperties",
|
||||
"EventMessageUpdated",
|
||||
"EventMessageUpdatedProperties",
|
||||
"EventMessageRemoved",
|
||||
|
|
@ -35,6 +30,11 @@ __all__ = [
|
|||
"EventMessagePartRemovedProperties",
|
||||
"EventStorageWrite",
|
||||
"EventStorageWriteProperties",
|
||||
"EventPermissionUpdated",
|
||||
"EventPermissionUpdatedProperties",
|
||||
"EventPermissionUpdatedPropertiesTime",
|
||||
"EventFileEdited",
|
||||
"EventFileEditedProperties",
|
||||
"EventSessionUpdated",
|
||||
"EventSessionUpdatedProperties",
|
||||
"EventSessionDeleted",
|
||||
|
|
@ -52,6 +52,16 @@ __all__ = [
|
|||
]
|
||||
|
||||
|
||||
class EventInstallationUpdatedProperties(BaseModel):
|
||||
version: str
|
||||
|
||||
|
||||
class EventInstallationUpdated(BaseModel):
|
||||
properties: EventInstallationUpdatedProperties
|
||||
|
||||
type: Literal["installation.updated"]
|
||||
|
||||
|
||||
class EventLspClientDiagnosticsProperties(BaseModel):
|
||||
path: str
|
||||
|
||||
|
|
@ -64,48 +74,6 @@ class EventLspClientDiagnostics(BaseModel):
|
|||
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):
|
||||
info: Message
|
||||
|
||||
|
|
@ -162,6 +130,38 @@ class EventStorageWrite(BaseModel):
|
|||
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):
|
||||
info: Session
|
||||
|
||||
|
|
@ -242,15 +242,15 @@ class EventIdeInstalled(BaseModel):
|
|||
|
||||
EventListResponse: TypeAlias = Annotated[
|
||||
Union[
|
||||
EventLspClientDiagnostics,
|
||||
EventPermissionUpdated,
|
||||
EventFileEdited,
|
||||
EventInstallationUpdated,
|
||||
EventLspClientDiagnostics,
|
||||
EventMessageUpdated,
|
||||
EventMessageRemoved,
|
||||
EventMessagePartUpdated,
|
||||
EventMessagePartRemoved,
|
||||
EventStorageWrite,
|
||||
EventPermissionUpdated,
|
||||
EventFileEdited,
|
||||
EventSessionUpdated,
|
||||
EventSessionDeleted,
|
||||
EventSessionIdle,
|
||||
|
|
|
|||
|
|
@ -3,8 +3,48 @@
|
|||
from typing import List
|
||||
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
|
||||
|
||||
prompt: Optional[str] = None
|
||||
|
||||
temperature: Optional[float] = None
|
||||
|
|
|
|||
|
|
@ -8,8 +8,12 @@ __all__ = ["ModeConfig"]
|
|||
|
||||
|
||||
class ModeConfig(BaseModel):
|
||||
disable: Optional[bool] = None
|
||||
|
||||
model: Optional[str] = None
|
||||
|
||||
prompt: Optional[str] = None
|
||||
|
||||
temperature: Optional[float] = None
|
||||
|
||||
tools: Optional[Dict[str, bool]] = None
|
||||
|
|
|
|||
|
|
@ -18,6 +18,8 @@ class Time(BaseModel):
|
|||
class Revert(BaseModel):
|
||||
message_id: str = FieldInfo(alias="messageID")
|
||||
|
||||
diff: Optional[str] = None
|
||||
|
||||
part_id: Optional[str] = FieldInfo(alias="partID", default=None)
|
||||
|
||||
snapshot: Optional[str] = None
|
||||
|
|
|
|||
|
|
@ -23,6 +23,8 @@ class SessionChatParams(TypedDict, total=False):
|
|||
|
||||
mode: str
|
||||
|
||||
system: str
|
||||
|
||||
tools: Dict[str, bool]
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -203,6 +203,7 @@ class TestSession:
|
|||
provider_id="providerID",
|
||||
message_id="msg",
|
||||
mode="mode",
|
||||
system="system",
|
||||
tools={"foo": True},
|
||||
)
|
||||
assert_matches_type(AssistantMessage, session, path=["response"])
|
||||
|
|
@ -776,6 +777,7 @@ class TestAsyncSession:
|
|||
provider_id="providerID",
|
||||
message_id="msg",
|
||||
mode="mode",
|
||||
system="system",
|
||||
tools={"foo": True},
|
||||
)
|
||||
assert_matches_type(AssistantMessage, session, path=["response"])
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue