forked from anomalyco/opencode-sdk-python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconfig.py
More file actions
216 lines (138 loc) · 5.88 KB
/
Copy pathconfig.py
File metadata and controls
216 lines (138 loc) · 5.88 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
from typing import TYPE_CHECKING, Dict, List, Union, Optional
from typing_extensions import Literal, Annotated, TypeAlias
from pydantic import Field as FieldInfo
from .._utils import PropertyInfo
from .._models import BaseModel
from .mode_config import ModeConfig
from .keybinds_config import KeybindsConfig
from .mcp_local_config import McpLocalConfig
from .mcp_remote_config import McpRemoteConfig
__all__ = [
"Config",
"Agent",
"AgentGeneral",
"AgentAgentItem",
"Experimental",
"ExperimentalHook",
"ExperimentalHookFileEdited",
"ExperimentalHookSessionCompleted",
"Mcp",
"Mode",
"Provider",
"ProviderModels",
"ProviderModelsCost",
"ProviderModelsLimit",
"ProviderOptions",
]
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]
environment: Optional[Dict[str, str]] = None
class ExperimentalHookSessionCompleted(BaseModel):
command: List[str]
environment: Optional[Dict[str, str]] = None
class ExperimentalHook(BaseModel):
file_edited: Optional[Dict[str, List[ExperimentalHookFileEdited]]] = None
session_completed: Optional[List[ExperimentalHookSessionCompleted]] = None
class Experimental(BaseModel):
hook: Optional[ExperimentalHook] = None
Mcp: TypeAlias = Annotated[Union[McpLocalConfig, McpRemoteConfig], PropertyInfo(discriminator="type")]
class Mode(BaseModel):
build: Optional[ModeConfig] = None
plan: Optional[ModeConfig] = None
__pydantic_extra__: Dict[str, ModeConfig] = 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) -> ModeConfig: ...
class ProviderModelsCost(BaseModel):
input: float
output: float
cache_read: Optional[float] = None
cache_write: Optional[float] = None
class ProviderModelsLimit(BaseModel):
context: float
output: float
class ProviderModels(BaseModel):
id: Optional[str] = None
attachment: Optional[bool] = None
cost: Optional[ProviderModelsCost] = None
limit: Optional[ProviderModelsLimit] = None
name: Optional[str] = None
options: Optional[Dict[str, object]] = None
reasoning: Optional[bool] = None
release_date: Optional[str] = None
temperature: Optional[bool] = None
tool_call: Optional[bool] = None
class ProviderOptions(BaseModel):
api_key: Optional[str] = FieldInfo(alias="apiKey", default=None)
base_url: Optional[str] = FieldInfo(alias="baseURL", default=None)
__pydantic_extra__: Dict[str, object] = 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) -> object: ...
class Provider(BaseModel):
models: Dict[str, ProviderModels]
id: Optional[str] = None
api: Optional[str] = None
env: Optional[List[str]] = None
name: Optional[str] = None
npm: Optional[str] = None
options: Optional[ProviderOptions] = None
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.
Share newly created sessions automatically
"""
autoupdate: Optional[bool] = None
"""Automatically update to the latest version"""
disabled_providers: Optional[List[str]] = None
"""Disable providers that are loaded automatically"""
experimental: Optional[Experimental] = None
instructions: Optional[List[str]] = None
"""Additional instruction files or patterns to include"""
keybinds: Optional[KeybindsConfig] = None
"""Custom keybind configurations"""
layout: Optional[Literal["auto", "stretch"]] = None
"""@deprecated Always uses stretch layout."""
mcp: Optional[Dict[str, Mcp]] = None
"""MCP (Model Context Protocol) server configurations"""
mode: Optional[Mode] = None
"""Modes configuration, see https://opencode.ai/docs/modes"""
model: Optional[str] = None
"""Model to use in the format of provider/model, eg anthropic/claude-2"""
provider: Optional[Dict[str, Provider]] = None
"""Custom provider configurations and model overrides"""
share: Optional[Literal["manual", "auto", "disabled"]] = None
"""
Control sharing behavior:'manual' allows manual sharing via commands, 'auto'
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"""
username: Optional[str] = None
"""Custom username to display in conversations instead of system username"""