Skip to content

Commit 1de4987

Browse files
feat(api): api update
1 parent 4e7027e commit 1de4987

File tree

13 files changed

+139
-104
lines changed

13 files changed

+139
-104
lines changed

.stats.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 26
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/opencode%2Fopencode-5748199af356c3243a46a466e73b5d0bab7eaa0c56895e1d0f903d637f61d0bb.yml
3-
openapi_spec_hash: c04f6b6be54b05d9b1283c24e870163b
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/opencode%2Fopencode-be4c3fb58765ee2b56c3b548182b9d0f1a9d5ebb7c340083bc578bcf3876b026.yml
3+
openapi_spec_hash: dd5d801d838fd6b522b1dd892a75fce1
44
config_hash: 1ae82c93499b9f0b9ba828b8919f9cb3

api.md

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,7 @@ Methods:
4646
Types:
4747

4848
```python
49-
from opencode_ai.types import (
50-
Match,
51-
Symbol,
52-
FindFilesResponse,
53-
FindSymbolsResponse,
54-
FindTextResponse,
55-
)
49+
from opencode_ai.types import Symbol, FindFilesResponse, FindSymbolsResponse, FindTextResponse
5650
```
5751

5852
Methods:

src/opencode_ai/resources/session.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,7 @@ def chat(
163163
provider_id: str,
164164
message_id: str | NotGiven = NOT_GIVEN,
165165
mode: str | NotGiven = NOT_GIVEN,
166+
system: str | NotGiven = NOT_GIVEN,
166167
tools: Dict[str, bool] | NotGiven = NOT_GIVEN,
167168
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
168169
# The extra values given here take precedence over values defined on the client or passed to this method.
@@ -196,6 +197,7 @@ def chat(
196197
"provider_id": provider_id,
197198
"message_id": message_id,
198199
"mode": mode,
200+
"system": system,
199201
"tools": tools,
200202
},
201203
session_chat_params.SessionChatParams,
@@ -606,6 +608,7 @@ async def chat(
606608
provider_id: str,
607609
message_id: str | NotGiven = NOT_GIVEN,
608610
mode: str | NotGiven = NOT_GIVEN,
611+
system: str | NotGiven = NOT_GIVEN,
609612
tools: Dict[str, bool] | NotGiven = NOT_GIVEN,
610613
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
611614
# The extra values given here take precedence over values defined on the client or passed to this method.
@@ -639,6 +642,7 @@ async def chat(
639642
"provider_id": provider_id,
640643
"message_id": message_id,
641644
"mode": mode,
645+
"system": system,
642646
"tools": tools,
643647
},
644648
session_chat_params.SessionChatParams,

src/opencode_ai/types/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
from .file import File as File
77
from .mode import Mode as Mode
88
from .part import Part as Part
9-
from .match import Match as Match
109
from .model import Model as Model
1110
from .config import Config as Config
1211
from .shared import (

src/opencode_ai/types/config.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@
1414

1515
__all__ = [
1616
"Config",
17+
"Agent",
18+
"AgentGeneral",
19+
"AgentAgentItem",
1720
"Experimental",
1821
"ExperimentalHook",
1922
"ExperimentalHookFileEdited",
@@ -28,6 +31,25 @@
2831
]
2932

3033

34+
class AgentGeneral(ModeConfig):
35+
description: str
36+
37+
38+
class AgentAgentItem(ModeConfig):
39+
description: str
40+
41+
42+
class Agent(BaseModel):
43+
general: Optional[AgentGeneral] = None
44+
45+
__pydantic_extra__: Dict[str, AgentAgentItem] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride]
46+
if TYPE_CHECKING:
47+
# Stub to indicate that arbitrary properties are accepted.
48+
# To access properties that are not valid identifiers you can use `getattr`, e.g.
49+
# `getattr(obj, '$type')`
50+
def __getattr__(self, attr: str) -> AgentAgentItem: ...
51+
52+
3153
class ExperimentalHookFileEdited(BaseModel):
3254
command: List[str]
3355

@@ -137,6 +159,9 @@ class Config(BaseModel):
137159
schema_: Optional[str] = FieldInfo(alias="$schema", default=None)
138160
"""JSON schema reference for configuration validation"""
139161

162+
agent: Optional[Agent] = None
163+
"""Modes configuration, see https://opencode.ai/docs/modes"""
164+
140165
autoshare: Optional[bool] = None
141166
"""@deprecated Use 'share' field instead.
142167

src/opencode_ai/types/event_list_response.py

Lines changed: 52 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,10 @@
1616

1717
__all__ = [
1818
"EventListResponse",
19-
"EventLspClientDiagnostics",
20-
"EventLspClientDiagnosticsProperties",
21-
"EventPermissionUpdated",
22-
"EventPermissionUpdatedProperties",
23-
"EventPermissionUpdatedPropertiesTime",
24-
"EventFileEdited",
25-
"EventFileEditedProperties",
2619
"EventInstallationUpdated",
2720
"EventInstallationUpdatedProperties",
21+
"EventLspClientDiagnostics",
22+
"EventLspClientDiagnosticsProperties",
2823
"EventMessageUpdated",
2924
"EventMessageUpdatedProperties",
3025
"EventMessageRemoved",
@@ -35,6 +30,11 @@
3530
"EventMessagePartRemovedProperties",
3631
"EventStorageWrite",
3732
"EventStorageWriteProperties",
33+
"EventPermissionUpdated",
34+
"EventPermissionUpdatedProperties",
35+
"EventPermissionUpdatedPropertiesTime",
36+
"EventFileEdited",
37+
"EventFileEditedProperties",
3838
"EventSessionUpdated",
3939
"EventSessionUpdatedProperties",
4040
"EventSessionDeleted",
@@ -52,6 +52,16 @@
5252
]
5353

5454

55+
class EventInstallationUpdatedProperties(BaseModel):
56+
version: str
57+
58+
59+
class EventInstallationUpdated(BaseModel):
60+
properties: EventInstallationUpdatedProperties
61+
62+
type: Literal["installation.updated"]
63+
64+
5565
class EventLspClientDiagnosticsProperties(BaseModel):
5666
path: str
5767

@@ -64,48 +74,6 @@ class EventLspClientDiagnostics(BaseModel):
6474
type: Literal["lsp.client.diagnostics"]
6575

6676

67-
class EventPermissionUpdatedPropertiesTime(BaseModel):
68-
created: float
69-
70-
71-
class EventPermissionUpdatedProperties(BaseModel):
72-
id: str
73-
74-
metadata: Dict[str, object]
75-
76-
session_id: str = FieldInfo(alias="sessionID")
77-
78-
time: EventPermissionUpdatedPropertiesTime
79-
80-
title: str
81-
82-
83-
class EventPermissionUpdated(BaseModel):
84-
properties: EventPermissionUpdatedProperties
85-
86-
type: Literal["permission.updated"]
87-
88-
89-
class EventFileEditedProperties(BaseModel):
90-
file: str
91-
92-
93-
class EventFileEdited(BaseModel):
94-
properties: EventFileEditedProperties
95-
96-
type: Literal["file.edited"]
97-
98-
99-
class EventInstallationUpdatedProperties(BaseModel):
100-
version: str
101-
102-
103-
class EventInstallationUpdated(BaseModel):
104-
properties: EventInstallationUpdatedProperties
105-
106-
type: Literal["installation.updated"]
107-
108-
10977
class EventMessageUpdatedProperties(BaseModel):
11078
info: Message
11179

@@ -162,6 +130,38 @@ class EventStorageWrite(BaseModel):
162130
type: Literal["storage.write"]
163131

164132

133+
class EventPermissionUpdatedPropertiesTime(BaseModel):
134+
created: float
135+
136+
137+
class EventPermissionUpdatedProperties(BaseModel):
138+
id: str
139+
140+
metadata: Dict[str, object]
141+
142+
session_id: str = FieldInfo(alias="sessionID")
143+
144+
time: EventPermissionUpdatedPropertiesTime
145+
146+
title: str
147+
148+
149+
class EventPermissionUpdated(BaseModel):
150+
properties: EventPermissionUpdatedProperties
151+
152+
type: Literal["permission.updated"]
153+
154+
155+
class EventFileEditedProperties(BaseModel):
156+
file: str
157+
158+
159+
class EventFileEdited(BaseModel):
160+
properties: EventFileEditedProperties
161+
162+
type: Literal["file.edited"]
163+
164+
165165
class EventSessionUpdatedProperties(BaseModel):
166166
info: Session
167167

@@ -242,15 +242,15 @@ class EventIdeInstalled(BaseModel):
242242

243243
EventListResponse: TypeAlias = Annotated[
244244
Union[
245-
EventLspClientDiagnostics,
246-
EventPermissionUpdated,
247-
EventFileEdited,
248245
EventInstallationUpdated,
246+
EventLspClientDiagnostics,
249247
EventMessageUpdated,
250248
EventMessageRemoved,
251249
EventMessagePartUpdated,
252250
EventMessagePartRemoved,
253251
EventStorageWrite,
252+
EventPermissionUpdated,
253+
EventFileEdited,
254254
EventSessionUpdated,
255255
EventSessionDeleted,
256256
EventSessionIdle,

src/opencode_ai/types/find_text_response.py

Lines changed: 43 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,48 @@
33
from typing import List
44
from typing_extensions import TypeAlias
55

6-
from .match import Match
6+
from .._models import BaseModel
77

8-
__all__ = ["FindTextResponse"]
8+
__all__ = [
9+
"FindTextResponse",
10+
"FindTextResponseItem",
11+
"FindTextResponseItemLines",
12+
"FindTextResponseItemPath",
13+
"FindTextResponseItemSubmatch",
14+
"FindTextResponseItemSubmatchMatch",
15+
]
916

10-
FindTextResponse: TypeAlias = List[Match]
17+
18+
class FindTextResponseItemLines(BaseModel):
19+
text: str
20+
21+
22+
class FindTextResponseItemPath(BaseModel):
23+
text: str
24+
25+
26+
class FindTextResponseItemSubmatchMatch(BaseModel):
27+
text: str
28+
29+
30+
class FindTextResponseItemSubmatch(BaseModel):
31+
end: float
32+
33+
match: FindTextResponseItemSubmatchMatch
34+
35+
start: float
36+
37+
38+
class FindTextResponseItem(BaseModel):
39+
absolute_offset: float
40+
41+
line_number: float
42+
43+
lines: FindTextResponseItemLines
44+
45+
path: FindTextResponseItemPath
46+
47+
submatches: List[FindTextResponseItemSubmatch]
48+
49+
50+
FindTextResponse: TypeAlias = List[FindTextResponseItem]

src/opencode_ai/types/match.py

Lines changed: 0 additions & 39 deletions
This file was deleted.

src/opencode_ai/types/mode.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,5 @@ class Mode(BaseModel):
2323
model: Optional[Model] = None
2424

2525
prompt: Optional[str] = None
26+
27+
temperature: Optional[float] = None

src/opencode_ai/types/mode_config.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,12 @@
88

99

1010
class ModeConfig(BaseModel):
11+
disable: Optional[bool] = None
12+
1113
model: Optional[str] = None
1214

1315
prompt: Optional[str] = None
1416

17+
temperature: Optional[float] = None
18+
1519
tools: Optional[Dict[str, bool]] = None

0 commit comments

Comments
 (0)