mirror of
https://github.com/anomalyco/opencode-sdk-python.git
synced 2026-04-28 20:50:07 +00:00
feat(api): api update
This commit is contained in:
parent
730f1be142
commit
d63c6f6f73
43 changed files with 974 additions and 241 deletions
|
|
@ -2,9 +2,14 @@
|
|||
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Dict
|
||||
from typing_extensions import Literal
|
||||
|
||||
import httpx
|
||||
|
||||
from ..types import app_log_params
|
||||
from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven
|
||||
from .._utils import maybe_transform, async_maybe_transform
|
||||
from .._compat import cached_property
|
||||
from .._resource import SyncAPIResource, AsyncAPIResource
|
||||
from .._response import (
|
||||
|
|
@ -15,7 +20,9 @@ from .._response import (
|
|||
)
|
||||
from ..types.app import App
|
||||
from .._base_client import make_request_options
|
||||
from ..types.app_log_response import AppLogResponse
|
||||
from ..types.app_init_response import AppInitResponse
|
||||
from ..types.app_modes_response import AppModesResponse
|
||||
|
||||
__all__ = ["AppResource", "AsyncAppResource"]
|
||||
|
||||
|
|
@ -78,6 +85,76 @@ class AppResource(SyncAPIResource):
|
|||
cast_to=AppInitResponse,
|
||||
)
|
||||
|
||||
def log(
|
||||
self,
|
||||
*,
|
||||
level: Literal["debug", "info", "error", "warn"],
|
||||
message: str,
|
||||
service: str,
|
||||
extra: Dict[str, object] | 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,
|
||||
extra_query: Query | None = None,
|
||||
extra_body: Body | None = None,
|
||||
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
||||
) -> AppLogResponse:
|
||||
"""
|
||||
Write a log entry to the server logs
|
||||
|
||||
Args:
|
||||
level: Log level
|
||||
|
||||
message: Log message
|
||||
|
||||
service: Service name for the log entry
|
||||
|
||||
extra: Additional metadata for the log entry
|
||||
|
||||
extra_headers: Send extra headers
|
||||
|
||||
extra_query: Add additional query parameters to the request
|
||||
|
||||
extra_body: Add additional JSON properties to the request
|
||||
|
||||
timeout: Override the client-level default timeout for this request, in seconds
|
||||
"""
|
||||
return self._post(
|
||||
"/log",
|
||||
body=maybe_transform(
|
||||
{
|
||||
"level": level,
|
||||
"message": message,
|
||||
"service": service,
|
||||
"extra": extra,
|
||||
},
|
||||
app_log_params.AppLogParams,
|
||||
),
|
||||
options=make_request_options(
|
||||
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
||||
),
|
||||
cast_to=AppLogResponse,
|
||||
)
|
||||
|
||||
def modes(
|
||||
self,
|
||||
*,
|
||||
# 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,
|
||||
extra_query: Query | None = None,
|
||||
extra_body: Body | None = None,
|
||||
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
||||
) -> AppModesResponse:
|
||||
"""List all modes"""
|
||||
return self._get(
|
||||
"/mode",
|
||||
options=make_request_options(
|
||||
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
||||
),
|
||||
cast_to=AppModesResponse,
|
||||
)
|
||||
|
||||
|
||||
class AsyncAppResource(AsyncAPIResource):
|
||||
@cached_property
|
||||
|
|
@ -137,6 +214,76 @@ class AsyncAppResource(AsyncAPIResource):
|
|||
cast_to=AppInitResponse,
|
||||
)
|
||||
|
||||
async def log(
|
||||
self,
|
||||
*,
|
||||
level: Literal["debug", "info", "error", "warn"],
|
||||
message: str,
|
||||
service: str,
|
||||
extra: Dict[str, object] | 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,
|
||||
extra_query: Query | None = None,
|
||||
extra_body: Body | None = None,
|
||||
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
||||
) -> AppLogResponse:
|
||||
"""
|
||||
Write a log entry to the server logs
|
||||
|
||||
Args:
|
||||
level: Log level
|
||||
|
||||
message: Log message
|
||||
|
||||
service: Service name for the log entry
|
||||
|
||||
extra: Additional metadata for the log entry
|
||||
|
||||
extra_headers: Send extra headers
|
||||
|
||||
extra_query: Add additional query parameters to the request
|
||||
|
||||
extra_body: Add additional JSON properties to the request
|
||||
|
||||
timeout: Override the client-level default timeout for this request, in seconds
|
||||
"""
|
||||
return await self._post(
|
||||
"/log",
|
||||
body=await async_maybe_transform(
|
||||
{
|
||||
"level": level,
|
||||
"message": message,
|
||||
"service": service,
|
||||
"extra": extra,
|
||||
},
|
||||
app_log_params.AppLogParams,
|
||||
),
|
||||
options=make_request_options(
|
||||
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
||||
),
|
||||
cast_to=AppLogResponse,
|
||||
)
|
||||
|
||||
async def modes(
|
||||
self,
|
||||
*,
|
||||
# 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,
|
||||
extra_query: Query | None = None,
|
||||
extra_body: Body | None = None,
|
||||
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
||||
) -> AppModesResponse:
|
||||
"""List all modes"""
|
||||
return await self._get(
|
||||
"/mode",
|
||||
options=make_request_options(
|
||||
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
||||
),
|
||||
cast_to=AppModesResponse,
|
||||
)
|
||||
|
||||
|
||||
class AppResourceWithRawResponse:
|
||||
def __init__(self, app: AppResource) -> None:
|
||||
|
|
@ -148,6 +295,12 @@ class AppResourceWithRawResponse:
|
|||
self.init = to_raw_response_wrapper(
|
||||
app.init,
|
||||
)
|
||||
self.log = to_raw_response_wrapper(
|
||||
app.log,
|
||||
)
|
||||
self.modes = to_raw_response_wrapper(
|
||||
app.modes,
|
||||
)
|
||||
|
||||
|
||||
class AsyncAppResourceWithRawResponse:
|
||||
|
|
@ -160,6 +313,12 @@ class AsyncAppResourceWithRawResponse:
|
|||
self.init = async_to_raw_response_wrapper(
|
||||
app.init,
|
||||
)
|
||||
self.log = async_to_raw_response_wrapper(
|
||||
app.log,
|
||||
)
|
||||
self.modes = async_to_raw_response_wrapper(
|
||||
app.modes,
|
||||
)
|
||||
|
||||
|
||||
class AppResourceWithStreamingResponse:
|
||||
|
|
@ -172,6 +331,12 @@ class AppResourceWithStreamingResponse:
|
|||
self.init = to_streamed_response_wrapper(
|
||||
app.init,
|
||||
)
|
||||
self.log = to_streamed_response_wrapper(
|
||||
app.log,
|
||||
)
|
||||
self.modes = to_streamed_response_wrapper(
|
||||
app.modes,
|
||||
)
|
||||
|
||||
|
||||
class AsyncAppResourceWithStreamingResponse:
|
||||
|
|
@ -184,3 +349,9 @@ class AsyncAppResourceWithStreamingResponse:
|
|||
self.init = async_to_streamed_response_wrapper(
|
||||
app.init,
|
||||
)
|
||||
self.log = async_to_streamed_response_wrapper(
|
||||
app.log,
|
||||
)
|
||||
self.modes = async_to_streamed_response_wrapper(
|
||||
app.modes,
|
||||
)
|
||||
|
|
|
|||
|
|
@ -24,7 +24,6 @@ from ..types.session_init_response import SessionInitResponse
|
|||
from ..types.session_list_response import SessionListResponse
|
||||
from ..types.session_abort_response import SessionAbortResponse
|
||||
from ..types.session_delete_response import SessionDeleteResponse
|
||||
from ..types.user_message_part_param import UserMessagePartParam
|
||||
from ..types.session_messages_response import SessionMessagesResponse
|
||||
from ..types.session_summarize_response import SessionSummarizeResponse
|
||||
|
||||
|
|
@ -159,8 +158,10 @@ class SessionResource(SyncAPIResource):
|
|||
self,
|
||||
id: str,
|
||||
*,
|
||||
message_id: str,
|
||||
mode: str,
|
||||
model_id: str,
|
||||
parts: Iterable[UserMessagePartParam],
|
||||
parts: Iterable[session_chat_params.Part],
|
||||
provider_id: str,
|
||||
# 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.
|
||||
|
|
@ -189,6 +190,8 @@ class SessionResource(SyncAPIResource):
|
|||
f"/session/{id}/message",
|
||||
body=maybe_transform(
|
||||
{
|
||||
"message_id": message_id,
|
||||
"mode": mode,
|
||||
"model_id": model_id,
|
||||
"parts": parts,
|
||||
"provider_id": provider_id,
|
||||
|
|
@ -205,6 +208,7 @@ class SessionResource(SyncAPIResource):
|
|||
self,
|
||||
id: str,
|
||||
*,
|
||||
message_id: str,
|
||||
model_id: str,
|
||||
provider_id: str,
|
||||
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
||||
|
|
@ -234,6 +238,7 @@ class SessionResource(SyncAPIResource):
|
|||
f"/session/{id}/init",
|
||||
body=maybe_transform(
|
||||
{
|
||||
"message_id": message_id,
|
||||
"model_id": model_id,
|
||||
"provider_id": provider_id,
|
||||
},
|
||||
|
|
@ -519,8 +524,10 @@ class AsyncSessionResource(AsyncAPIResource):
|
|||
self,
|
||||
id: str,
|
||||
*,
|
||||
message_id: str,
|
||||
mode: str,
|
||||
model_id: str,
|
||||
parts: Iterable[UserMessagePartParam],
|
||||
parts: Iterable[session_chat_params.Part],
|
||||
provider_id: str,
|
||||
# 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.
|
||||
|
|
@ -549,6 +556,8 @@ class AsyncSessionResource(AsyncAPIResource):
|
|||
f"/session/{id}/message",
|
||||
body=await async_maybe_transform(
|
||||
{
|
||||
"message_id": message_id,
|
||||
"mode": mode,
|
||||
"model_id": model_id,
|
||||
"parts": parts,
|
||||
"provider_id": provider_id,
|
||||
|
|
@ -565,6 +574,7 @@ class AsyncSessionResource(AsyncAPIResource):
|
|||
self,
|
||||
id: str,
|
||||
*,
|
||||
message_id: str,
|
||||
model_id: str,
|
||||
provider_id: str,
|
||||
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
||||
|
|
@ -594,6 +604,7 @@ class AsyncSessionResource(AsyncAPIResource):
|
|||
f"/session/{id}/init",
|
||||
body=await async_maybe_transform(
|
||||
{
|
||||
"message_id": message_id,
|
||||
"model_id": model_id,
|
||||
"provider_id": provider_id,
|
||||
},
|
||||
|
|
|
|||
|
|
@ -3,28 +3,42 @@
|
|||
from __future__ import annotations
|
||||
|
||||
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 UnknownError as UnknownError, ProviderAuthError as ProviderAuthError
|
||||
from .shared import (
|
||||
UnknownError as UnknownError,
|
||||
ProviderAuthError as ProviderAuthError,
|
||||
MessageAbortedError as MessageAbortedError,
|
||||
)
|
||||
from .symbol import Symbol as Symbol
|
||||
from .message import Message as Message
|
||||
from .session import Session as Session
|
||||
from .keybinds import Keybinds as Keybinds
|
||||
from .provider import Provider as Provider
|
||||
from .file_part import FilePart as FilePart
|
||||
from .log_level import LogLevel as LogLevel
|
||||
from .mcp_local import McpLocal as McpLocal
|
||||
from .text_part import TextPart as TextPart
|
||||
from .tool_part import ToolPart as ToolPart
|
||||
from .mcp_remote import McpRemote as McpRemote
|
||||
from .user_message import UserMessage as UserMessage
|
||||
from .app_log_params import AppLogParams as AppLogParams
|
||||
from .file_part_param import FilePartParam as FilePartParam
|
||||
from .step_start_part import StepStartPart as StepStartPart
|
||||
from .text_part_param import TextPartParam as TextPartParam
|
||||
from .app_log_response import AppLogResponse as AppLogResponse
|
||||
from .file_read_params import FileReadParams as FileReadParams
|
||||
from .find_text_params import FindTextParams as FindTextParams
|
||||
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 .find_files_params import FindFilesParams as FindFilesParams
|
||||
from .user_message_part import UserMessagePart as UserMessagePart
|
||||
from .app_modes_response import AppModesResponse as AppModesResponse
|
||||
from .file_read_response import FileReadResponse as FileReadResponse
|
||||
from .find_text_response import FindTextResponse as FindTextResponse
|
||||
from .tool_state_pending import ToolStatePending as ToolStatePending
|
||||
|
|
@ -39,10 +53,8 @@ from .tool_state_completed import ToolStateCompleted as ToolStateCompleted
|
|||
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 .assistant_message_part import AssistantMessagePart as AssistantMessagePart
|
||||
from .session_abort_response import SessionAbortResponse as SessionAbortResponse
|
||||
from .session_delete_response import SessionDeleteResponse as SessionDeleteResponse
|
||||
from .user_message_part_param import UserMessagePartParam as UserMessagePartParam
|
||||
from .session_summarize_params import SessionSummarizeParams as SessionSummarizeParams
|
||||
from .config_providers_response import ConfigProvidersResponse as ConfigProvidersResponse
|
||||
from .session_messages_response import SessionMessagesResponse as SessionMessagesResponse
|
||||
|
|
|
|||
|
|
@ -31,5 +31,3 @@ class App(BaseModel):
|
|||
path: Path
|
||||
|
||||
time: Time
|
||||
|
||||
user: str
|
||||
|
|
|
|||
22
src/opencode_ai/types/app_log_params.py
Normal file
22
src/opencode_ai/types/app_log_params.py
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Dict
|
||||
from typing_extensions import Literal, Required, TypedDict
|
||||
|
||||
__all__ = ["AppLogParams"]
|
||||
|
||||
|
||||
class AppLogParams(TypedDict, total=False):
|
||||
level: Required[Literal["debug", "info", "error", "warn"]]
|
||||
"""Log level"""
|
||||
|
||||
message: Required[str]
|
||||
"""Log message"""
|
||||
|
||||
service: Required[str]
|
||||
"""Service name for the log entry"""
|
||||
|
||||
extra: Dict[str, object]
|
||||
"""Additional metadata for the log entry"""
|
||||
7
src/opencode_ai/types/app_log_response.py
Normal file
7
src/opencode_ai/types/app_log_response.py
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
||||
|
||||
from typing_extensions import TypeAlias
|
||||
|
||||
__all__ = ["AppLogResponse"]
|
||||
|
||||
AppLogResponse: TypeAlias = bool
|
||||
10
src/opencode_ai/types/app_modes_response.py
Normal file
10
src/opencode_ai/types/app_modes_response.py
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
||||
|
||||
from typing import List
|
||||
from typing_extensions import TypeAlias
|
||||
|
||||
from .mode import Mode
|
||||
|
||||
__all__ = ["AppModesResponse"]
|
||||
|
||||
AppModesResponse: TypeAlias = List[Mode]
|
||||
|
|
@ -8,8 +8,8 @@ from pydantic import Field as FieldInfo
|
|||
from .._utils import PropertyInfo
|
||||
from .._models import BaseModel
|
||||
from .shared.unknown_error import UnknownError
|
||||
from .assistant_message_part import AssistantMessagePart
|
||||
from .shared.provider_auth_error import ProviderAuthError
|
||||
from .shared.message_aborted_error import MessageAbortedError
|
||||
|
||||
__all__ = ["AssistantMessage", "Path", "Time", "Tokens", "TokensCache", "Error", "ErrorMessageOutputLengthError"]
|
||||
|
||||
|
|
@ -49,7 +49,8 @@ class ErrorMessageOutputLengthError(BaseModel):
|
|||
|
||||
|
||||
Error: TypeAlias = Annotated[
|
||||
Union[ProviderAuthError, UnknownError, ErrorMessageOutputLengthError], PropertyInfo(discriminator="name")
|
||||
Union[ProviderAuthError, UnknownError, ErrorMessageOutputLengthError, MessageAbortedError],
|
||||
PropertyInfo(discriminator="name"),
|
||||
]
|
||||
|
||||
|
||||
|
|
@ -60,8 +61,6 @@ class AssistantMessage(BaseModel):
|
|||
|
||||
api_model_id: str = FieldInfo(alias="modelID")
|
||||
|
||||
parts: List[AssistantMessagePart]
|
||||
|
||||
path: Path
|
||||
|
||||
provider_id: str = FieldInfo(alias="providerID")
|
||||
|
|
|
|||
|
|
@ -1,15 +0,0 @@
|
|||
# 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 .text_part import TextPart
|
||||
from .tool_part import ToolPart
|
||||
from .step_start_part import StepStartPart
|
||||
|
||||
__all__ = ["AssistantMessagePart"]
|
||||
|
||||
AssistantMessagePart: TypeAlias = Annotated[
|
||||
Union[TextPart, ToolPart, StepStartPart], PropertyInfo(discriminator="type")
|
||||
]
|
||||
|
|
@ -1,13 +1,15 @@
|
|||
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
||||
|
||||
from typing import Dict, List, Union, Optional
|
||||
from typing_extensions import Annotated, TypeAlias
|
||||
from typing import TYPE_CHECKING, Dict, List, Union, Optional
|
||||
from typing_extensions import Literal, Annotated, TypeAlias
|
||||
|
||||
from pydantic import Field as FieldInfo
|
||||
|
||||
from .config import ModeUnnamedTypeWithobjectParent0ModeUnnamedTypeWithobjectParent0Item
|
||||
from .._utils import PropertyInfo
|
||||
from .._models import BaseModel
|
||||
from .keybinds import Keybinds
|
||||
from .log_level import LogLevel
|
||||
from .mcp_local import McpLocal
|
||||
from .mcp_remote import McpRemote
|
||||
|
||||
|
|
@ -18,6 +20,9 @@ __all__ = [
|
|||
"ExperimentalHookFileEdited",
|
||||
"ExperimentalHookSessionCompleted",
|
||||
"Mcp",
|
||||
"Mode",
|
||||
"ModeBuild",
|
||||
"ModePlan",
|
||||
"Provider",
|
||||
"ProviderModels",
|
||||
"ProviderModelsCost",
|
||||
|
|
@ -50,6 +55,34 @@ class Experimental(BaseModel):
|
|||
Mcp: TypeAlias = Annotated[Union[McpLocal, McpRemote], PropertyInfo(discriminator="type")]
|
||||
|
||||
|
||||
class ModeBuild(BaseModel):
|
||||
model: Optional[str] = None
|
||||
|
||||
prompt: Optional[str] = None
|
||||
|
||||
tools: Optional[Dict[str, bool]] = None
|
||||
|
||||
|
||||
class ModePlan(BaseModel):
|
||||
model: Optional[str] = None
|
||||
|
||||
prompt: Optional[str] = None
|
||||
|
||||
tools: Optional[Dict[str, bool]] = None
|
||||
|
||||
|
||||
class Mode(BaseModel):
|
||||
build: Optional[ModeBuild] = None
|
||||
|
||||
plan: Optional[ModePlan] = None
|
||||
|
||||
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) -> ModeUnnamedTypeWithobjectParent0ModeUnnamedTypeWithobjectParent0Item: ...
|
||||
|
||||
|
||||
class ProviderModelsCost(BaseModel):
|
||||
input: float
|
||||
|
||||
|
|
@ -109,7 +142,10 @@ class Config(BaseModel):
|
|||
"""JSON schema reference for configuration validation"""
|
||||
|
||||
autoshare: Optional[bool] = None
|
||||
"""Share newly created sessions automatically"""
|
||||
"""@deprecated Use 'share' field instead.
|
||||
|
||||
Share newly created sessions automatically
|
||||
"""
|
||||
|
||||
autoupdate: Optional[bool] = None
|
||||
"""Automatically update to the latest version"""
|
||||
|
|
@ -125,14 +161,28 @@ class Config(BaseModel):
|
|||
keybinds: Optional[Keybinds] = None
|
||||
"""Custom keybind configurations"""
|
||||
|
||||
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"""
|
||||
|
||||
mode: Optional[Mode] = None
|
||||
|
||||
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["auto", "disabled"]] = None
|
||||
"""
|
||||
Control sharing behavior: 'auto' enables automatic sharing, 'disabled' disables
|
||||
all sharing
|
||||
"""
|
||||
|
||||
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"""
|
||||
|
|
|
|||
|
|
@ -5,13 +5,14 @@ from typing_extensions import Literal, Annotated, TypeAlias
|
|||
|
||||
from pydantic import Field as FieldInfo
|
||||
|
||||
from .part import Part
|
||||
from .._utils import PropertyInfo
|
||||
from .message import Message
|
||||
from .session import Session
|
||||
from .._models import BaseModel
|
||||
from .shared.unknown_error import UnknownError
|
||||
from .assistant_message_part import AssistantMessagePart
|
||||
from .shared.provider_auth_error import ProviderAuthError
|
||||
from .shared.message_aborted_error import MessageAbortedError
|
||||
|
||||
__all__ = [
|
||||
"EventListResponse",
|
||||
|
|
@ -24,14 +25,14 @@ __all__ = [
|
|||
"EventFileEditedProperties",
|
||||
"EventInstallationUpdated",
|
||||
"EventInstallationUpdatedProperties",
|
||||
"EventStorageWrite",
|
||||
"EventStorageWriteProperties",
|
||||
"EventMessageUpdated",
|
||||
"EventMessageUpdatedProperties",
|
||||
"EventMessageRemoved",
|
||||
"EventMessageRemovedProperties",
|
||||
"EventMessagePartUpdated",
|
||||
"EventMessagePartUpdatedProperties",
|
||||
"EventStorageWrite",
|
||||
"EventStorageWriteProperties",
|
||||
"EventSessionUpdated",
|
||||
"EventSessionUpdatedProperties",
|
||||
"EventSessionDeleted",
|
||||
|
|
@ -101,18 +102,6 @@ class EventInstallationUpdated(BaseModel):
|
|||
type: Literal["installation.updated"]
|
||||
|
||||
|
||||
class EventStorageWriteProperties(BaseModel):
|
||||
key: str
|
||||
|
||||
content: Optional[object] = None
|
||||
|
||||
|
||||
class EventStorageWrite(BaseModel):
|
||||
properties: EventStorageWriteProperties
|
||||
|
||||
type: Literal["storage.write"]
|
||||
|
||||
|
||||
class EventMessageUpdatedProperties(BaseModel):
|
||||
info: Message
|
||||
|
||||
|
|
@ -136,11 +125,7 @@ class EventMessageRemoved(BaseModel):
|
|||
|
||||
|
||||
class EventMessagePartUpdatedProperties(BaseModel):
|
||||
message_id: str = FieldInfo(alias="messageID")
|
||||
|
||||
part: AssistantMessagePart
|
||||
|
||||
session_id: str = FieldInfo(alias="sessionID")
|
||||
part: Part
|
||||
|
||||
|
||||
class EventMessagePartUpdated(BaseModel):
|
||||
|
|
@ -149,6 +134,18 @@ class EventMessagePartUpdated(BaseModel):
|
|||
type: Literal["message.part.updated"]
|
||||
|
||||
|
||||
class EventStorageWriteProperties(BaseModel):
|
||||
key: str
|
||||
|
||||
content: Optional[object] = None
|
||||
|
||||
|
||||
class EventStorageWrite(BaseModel):
|
||||
properties: EventStorageWriteProperties
|
||||
|
||||
type: Literal["storage.write"]
|
||||
|
||||
|
||||
class EventSessionUpdatedProperties(BaseModel):
|
||||
info: Session
|
||||
|
||||
|
|
@ -186,7 +183,9 @@ class EventSessionErrorPropertiesErrorMessageOutputLengthError(BaseModel):
|
|||
|
||||
|
||||
EventSessionErrorPropertiesError: TypeAlias = Annotated[
|
||||
Union[ProviderAuthError, UnknownError, EventSessionErrorPropertiesErrorMessageOutputLengthError],
|
||||
Union[
|
||||
ProviderAuthError, UnknownError, EventSessionErrorPropertiesErrorMessageOutputLengthError, MessageAbortedError
|
||||
],
|
||||
PropertyInfo(discriminator="name"),
|
||||
]
|
||||
|
||||
|
|
@ -194,6 +193,8 @@ EventSessionErrorPropertiesError: TypeAlias = Annotated[
|
|||
class EventSessionErrorProperties(BaseModel):
|
||||
error: Optional[EventSessionErrorPropertiesError] = None
|
||||
|
||||
session_id: Optional[str] = FieldInfo(alias="sessionID", default=None)
|
||||
|
||||
|
||||
class EventSessionError(BaseModel):
|
||||
properties: EventSessionErrorProperties
|
||||
|
|
@ -219,10 +220,10 @@ EventListResponse: TypeAlias = Annotated[
|
|||
EventPermissionUpdated,
|
||||
EventFileEdited,
|
||||
EventInstallationUpdated,
|
||||
EventStorageWrite,
|
||||
EventMessageUpdated,
|
||||
EventMessageRemoved,
|
||||
EventMessagePartUpdated,
|
||||
EventStorageWrite,
|
||||
EventSessionUpdated,
|
||||
EventSessionDeleted,
|
||||
EventSessionIdle,
|
||||
|
|
|
|||
17
src/opencode_ai/types/file.py
Normal file
17
src/opencode_ai/types/file.py
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
||||
|
||||
from typing_extensions import Literal
|
||||
|
||||
from .._models import BaseModel
|
||||
|
||||
__all__ = ["File"]
|
||||
|
||||
|
||||
class File(BaseModel):
|
||||
added: int
|
||||
|
||||
path: str
|
||||
|
||||
removed: int
|
||||
|
||||
status: Literal["added", "deleted", "modified"]
|
||||
|
|
@ -3,14 +3,22 @@
|
|||
from typing import Optional
|
||||
from typing_extensions import Literal
|
||||
|
||||
from pydantic import Field as FieldInfo
|
||||
|
||||
from .._models import BaseModel
|
||||
|
||||
__all__ = ["FilePart"]
|
||||
|
||||
|
||||
class FilePart(BaseModel):
|
||||
id: str
|
||||
|
||||
message_id: str = FieldInfo(alias="messageID")
|
||||
|
||||
mime: str
|
||||
|
||||
session_id: str = FieldInfo(alias="sessionID")
|
||||
|
||||
type: Literal["file"]
|
||||
|
||||
url: str
|
||||
|
|
|
|||
|
|
@ -2,14 +2,22 @@
|
|||
|
||||
from __future__ import annotations
|
||||
|
||||
from typing_extensions import Literal, Required, TypedDict
|
||||
from typing_extensions import Literal, Required, Annotated, TypedDict
|
||||
|
||||
from .._utils import PropertyInfo
|
||||
|
||||
__all__ = ["FilePartParam"]
|
||||
|
||||
|
||||
class FilePartParam(TypedDict, total=False):
|
||||
id: Required[str]
|
||||
|
||||
message_id: Required[Annotated[str, PropertyInfo(alias="messageID")]]
|
||||
|
||||
mime: Required[str]
|
||||
|
||||
session_id: Required[Annotated[str, PropertyInfo(alias="sessionID")]]
|
||||
|
||||
type: Required[Literal["file"]]
|
||||
|
||||
url: Required[str]
|
||||
|
|
|
|||
|
|
@ -1,21 +1,10 @@
|
|||
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
||||
|
||||
from typing import List
|
||||
from typing_extensions import Literal, TypeAlias
|
||||
from typing_extensions import TypeAlias
|
||||
|
||||
from .._models import BaseModel
|
||||
from .file import File
|
||||
|
||||
__all__ = ["FileStatusResponse", "FileStatusResponseItem"]
|
||||
__all__ = ["FileStatusResponse"]
|
||||
|
||||
|
||||
class FileStatusResponseItem(BaseModel):
|
||||
added: int
|
||||
|
||||
file: str
|
||||
|
||||
removed: int
|
||||
|
||||
status: Literal["added", "deleted", "modified"]
|
||||
|
||||
|
||||
FileStatusResponse: TypeAlias = List[FileStatusResponseItem]
|
||||
FileStatusResponse: TypeAlias = List[File]
|
||||
|
|
|
|||
|
|
@ -3,6 +3,8 @@
|
|||
from typing import List
|
||||
from typing_extensions import TypeAlias
|
||||
|
||||
from .symbol import Symbol
|
||||
|
||||
__all__ = ["FindSymbolsResponse"]
|
||||
|
||||
FindSymbolsResponse: TypeAlias = List[object]
|
||||
FindSymbolsResponse: TypeAlias = List[Symbol]
|
||||
|
|
|
|||
|
|
@ -3,48 +3,8 @@
|
|||
from typing import List
|
||||
from typing_extensions import TypeAlias
|
||||
|
||||
from .._models import BaseModel
|
||||
from .match import Match
|
||||
|
||||
__all__ = [
|
||||
"FindTextResponse",
|
||||
"FindTextResponseItem",
|
||||
"FindTextResponseItemLines",
|
||||
"FindTextResponseItemPath",
|
||||
"FindTextResponseItemSubmatch",
|
||||
"FindTextResponseItemSubmatchMatch",
|
||||
]
|
||||
__all__ = ["FindTextResponse"]
|
||||
|
||||
|
||||
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]
|
||||
FindTextResponse: TypeAlias = List[Match]
|
||||
|
|
|
|||
|
|
@ -1,7 +1,5 @@
|
|||
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
||||
|
||||
from typing import Optional
|
||||
|
||||
from pydantic import Field as FieldInfo
|
||||
|
||||
from .._models import BaseModel
|
||||
|
|
@ -10,83 +8,104 @@ __all__ = ["Keybinds"]
|
|||
|
||||
|
||||
class Keybinds(BaseModel):
|
||||
app_exit: Optional[str] = None
|
||||
app_exit: str
|
||||
"""Exit the application"""
|
||||
|
||||
editor_open: Optional[str] = None
|
||||
"""Open external editor"""
|
||||
|
||||
help: Optional[str] = None
|
||||
app_help: str
|
||||
"""Show help dialog"""
|
||||
|
||||
history_next: Optional[str] = None
|
||||
"""Navigate to next history item"""
|
||||
editor_open: str
|
||||
"""Open external editor"""
|
||||
|
||||
history_previous: Optional[str] = None
|
||||
"""Navigate to previous history item"""
|
||||
file_close: str
|
||||
"""Close file"""
|
||||
|
||||
input_clear: Optional[str] = None
|
||||
file_diff_toggle: str
|
||||
"""Split/unified diff"""
|
||||
|
||||
file_list: str
|
||||
"""List files"""
|
||||
|
||||
file_search: str
|
||||
"""Search file"""
|
||||
|
||||
input_clear: str
|
||||
"""Clear input field"""
|
||||
|
||||
input_newline: Optional[str] = None
|
||||
input_newline: str
|
||||
"""Insert newline in input"""
|
||||
|
||||
input_paste: Optional[str] = None
|
||||
input_paste: str
|
||||
"""Paste from clipboard"""
|
||||
|
||||
input_submit: Optional[str] = None
|
||||
input_submit: str
|
||||
"""Submit input"""
|
||||
|
||||
leader: Optional[str] = None
|
||||
leader: str
|
||||
"""Leader key for keybind combinations"""
|
||||
|
||||
messages_first: Optional[str] = None
|
||||
messages_copy: str
|
||||
"""Copy message"""
|
||||
|
||||
messages_first: str
|
||||
"""Navigate to first message"""
|
||||
|
||||
messages_half_page_down: Optional[str] = None
|
||||
messages_half_page_down: str
|
||||
"""Scroll messages down by half page"""
|
||||
|
||||
messages_half_page_up: Optional[str] = None
|
||||
messages_half_page_up: str
|
||||
"""Scroll messages up by half page"""
|
||||
|
||||
messages_last: Optional[str] = None
|
||||
messages_last: str
|
||||
"""Navigate to last message"""
|
||||
|
||||
messages_next: Optional[str] = None
|
||||
messages_layout_toggle: str
|
||||
"""Toggle layout"""
|
||||
|
||||
messages_next: str
|
||||
"""Navigate to next message"""
|
||||
|
||||
messages_page_down: Optional[str] = None
|
||||
messages_page_down: str
|
||||
"""Scroll messages down by one page"""
|
||||
|
||||
messages_page_up: Optional[str] = None
|
||||
messages_page_up: str
|
||||
"""Scroll messages up by one page"""
|
||||
|
||||
messages_previous: Optional[str] = None
|
||||
messages_previous: str
|
||||
"""Navigate to previous message"""
|
||||
|
||||
api_model_list: Optional[str] = FieldInfo(alias="model_list", default=None)
|
||||
messages_revert: str
|
||||
"""Revert message"""
|
||||
|
||||
api_model_list: str = FieldInfo(alias="model_list")
|
||||
"""List available models"""
|
||||
|
||||
project_init: Optional[str] = None
|
||||
"""Initialize project configuration"""
|
||||
project_init: str
|
||||
"""Create/update AGENTS.md"""
|
||||
|
||||
session_compact: Optional[str] = None
|
||||
"""Toggle compact mode for session"""
|
||||
session_compact: str
|
||||
"""Compact the session"""
|
||||
|
||||
session_interrupt: Optional[str] = None
|
||||
session_interrupt: str
|
||||
"""Interrupt current session"""
|
||||
|
||||
session_list: Optional[str] = None
|
||||
session_list: str
|
||||
"""List all sessions"""
|
||||
|
||||
session_new: Optional[str] = None
|
||||
session_new: str
|
||||
"""Create a new session"""
|
||||
|
||||
session_share: Optional[str] = None
|
||||
session_share: str
|
||||
"""Share current session"""
|
||||
|
||||
theme_list: Optional[str] = None
|
||||
session_unshare: str
|
||||
"""Unshare current session"""
|
||||
|
||||
switch_mode: str
|
||||
"""Switch mode"""
|
||||
|
||||
theme_list: str
|
||||
"""List available themes"""
|
||||
|
||||
tool_details: Optional[str] = None
|
||||
"""Show tool details"""
|
||||
tool_details: str
|
||||
"""Toggle tool details"""
|
||||
|
|
|
|||
7
src/opencode_ai/types/log_level.py
Normal file
7
src/opencode_ai/types/log_level.py
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
# 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"]
|
||||
39
src/opencode_ai/types/match.py
Normal file
39
src/opencode_ai/types/match.py
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
# 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]
|
||||
|
|
@ -1,32 +1,12 @@
|
|||
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
||||
|
||||
from typing import List, Union
|
||||
from typing_extensions import Literal, Annotated, TypeAlias
|
||||
|
||||
from pydantic import Field as FieldInfo
|
||||
from typing import Union
|
||||
from typing_extensions import Annotated, TypeAlias
|
||||
|
||||
from .._utils import PropertyInfo
|
||||
from .._models import BaseModel
|
||||
from .user_message import UserMessage
|
||||
from .assistant_message import AssistantMessage
|
||||
from .user_message_part import UserMessagePart
|
||||
|
||||
__all__ = ["Message", "UserMessage", "UserMessageTime"]
|
||||
|
||||
|
||||
class UserMessageTime(BaseModel):
|
||||
created: float
|
||||
|
||||
|
||||
class UserMessage(BaseModel):
|
||||
id: str
|
||||
|
||||
parts: List[UserMessagePart]
|
||||
|
||||
role: Literal["user"]
|
||||
|
||||
session_id: str = FieldInfo(alias="sessionID")
|
||||
|
||||
time: UserMessageTime
|
||||
|
||||
__all__ = ["Message"]
|
||||
|
||||
Message: TypeAlias = Annotated[Union[UserMessage, AssistantMessage], PropertyInfo(discriminator="role")]
|
||||
|
|
|
|||
25
src/opencode_ai/types/mode.py
Normal file
25
src/opencode_ai/types/mode.py
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
||||
|
||||
from typing import Dict, Optional
|
||||
|
||||
from pydantic import Field as FieldInfo
|
||||
|
||||
from .._models import BaseModel
|
||||
|
||||
__all__ = ["Mode", "Model"]
|
||||
|
||||
|
||||
class Model(BaseModel):
|
||||
api_model_id: str = FieldInfo(alias="modelID")
|
||||
|
||||
provider_id: str = FieldInfo(alias="providerID")
|
||||
|
||||
|
||||
class Mode(BaseModel):
|
||||
name: str
|
||||
|
||||
tools: Dict[str, bool]
|
||||
|
||||
model: Optional[Model] = None
|
||||
|
||||
prompt: Optional[str] = None
|
||||
30
src/opencode_ai/types/part.py
Normal file
30
src/opencode_ai/types/part.py
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
||||
|
||||
from typing import Union
|
||||
from typing_extensions import Literal, TypeAlias
|
||||
|
||||
from pydantic import Field as FieldInfo
|
||||
|
||||
from .._models import BaseModel
|
||||
from .file_part import FilePart
|
||||
from .text_part import TextPart
|
||||
from .tool_part import ToolPart
|
||||
from .step_start_part import StepStartPart
|
||||
from .step_finish_part import StepFinishPart
|
||||
|
||||
__all__ = ["Part", "UnionMember5"]
|
||||
|
||||
|
||||
class UnionMember5(BaseModel):
|
||||
id: str
|
||||
|
||||
message_id: str = FieldInfo(alias="messageID")
|
||||
|
||||
session_id: str = FieldInfo(alias="sessionID")
|
||||
|
||||
snapshot: str
|
||||
|
||||
type: Literal["snapshot"]
|
||||
|
||||
|
||||
Part: TypeAlias = Union[TextPart, FilePart, ToolPart, StepStartPart, StepFinishPart, UnionMember5]
|
||||
|
|
@ -2,18 +2,26 @@
|
|||
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Iterable
|
||||
from typing_extensions import Required, Annotated, TypedDict
|
||||
from typing import Union, Iterable
|
||||
from typing_extensions import Required, Annotated, TypeAlias, TypedDict
|
||||
|
||||
from .._utils import PropertyInfo
|
||||
from .user_message_part_param import UserMessagePartParam
|
||||
from .file_part_param import FilePartParam
|
||||
from .text_part_param import TextPartParam
|
||||
|
||||
__all__ = ["SessionChatParams"]
|
||||
__all__ = ["SessionChatParams", "Part"]
|
||||
|
||||
|
||||
class SessionChatParams(TypedDict, total=False):
|
||||
message_id: Required[Annotated[str, PropertyInfo(alias="messageID")]]
|
||||
|
||||
mode: Required[str]
|
||||
|
||||
model_id: Required[Annotated[str, PropertyInfo(alias="modelID")]]
|
||||
|
||||
parts: Required[Iterable[UserMessagePartParam]]
|
||||
parts: Required[Iterable[Part]]
|
||||
|
||||
provider_id: Required[Annotated[str, PropertyInfo(alias="providerID")]]
|
||||
|
||||
|
||||
Part: TypeAlias = Union[FilePartParam, TextPartParam]
|
||||
|
|
|
|||
|
|
@ -10,6 +10,8 @@ __all__ = ["SessionInitParams"]
|
|||
|
||||
|
||||
class SessionInitParams(TypedDict, total=False):
|
||||
message_id: Required[Annotated[str, PropertyInfo(alias="messageID")]]
|
||||
|
||||
model_id: Required[Annotated[str, PropertyInfo(alias="modelID")]]
|
||||
|
||||
provider_id: Required[Annotated[str, PropertyInfo(alias="providerID")]]
|
||||
|
|
|
|||
|
|
@ -3,8 +3,17 @@
|
|||
from typing import List
|
||||
from typing_extensions import TypeAlias
|
||||
|
||||
from .part import Part
|
||||
from .message import Message
|
||||
from .._models import BaseModel
|
||||
|
||||
__all__ = ["SessionMessagesResponse"]
|
||||
__all__ = ["SessionMessagesResponse", "SessionMessagesResponseItem"]
|
||||
|
||||
SessionMessagesResponse: TypeAlias = List[Message]
|
||||
|
||||
class SessionMessagesResponseItem(BaseModel):
|
||||
info: Message
|
||||
|
||||
parts: List[Part]
|
||||
|
||||
|
||||
SessionMessagesResponse: TypeAlias = List[SessionMessagesResponseItem]
|
||||
|
|
|
|||
|
|
@ -2,3 +2,4 @@
|
|||
|
||||
from .unknown_error import UnknownError as UnknownError
|
||||
from .provider_auth_error import ProviderAuthError as ProviderAuthError
|
||||
from .message_aborted_error import MessageAbortedError as MessageAbortedError
|
||||
|
|
|
|||
13
src/opencode_ai/types/shared/message_aborted_error.py
Normal file
13
src/opencode_ai/types/shared/message_aborted_error.py
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
||||
|
||||
from typing_extensions import Literal
|
||||
|
||||
from ..._models import BaseModel
|
||||
|
||||
__all__ = ["MessageAbortedError"]
|
||||
|
||||
|
||||
class MessageAbortedError(BaseModel):
|
||||
data: object
|
||||
|
||||
name: Literal["MessageAbortedError"]
|
||||
39
src/opencode_ai/types/step_finish_part.py
Normal file
39
src/opencode_ai/types/step_finish_part.py
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
||||
|
||||
from typing_extensions import Literal
|
||||
|
||||
from pydantic import Field as FieldInfo
|
||||
|
||||
from .._models import BaseModel
|
||||
|
||||
__all__ = ["StepFinishPart", "Tokens", "TokensCache"]
|
||||
|
||||
|
||||
class TokensCache(BaseModel):
|
||||
read: float
|
||||
|
||||
write: float
|
||||
|
||||
|
||||
class Tokens(BaseModel):
|
||||
cache: TokensCache
|
||||
|
||||
input: float
|
||||
|
||||
output: float
|
||||
|
||||
reasoning: float
|
||||
|
||||
|
||||
class StepFinishPart(BaseModel):
|
||||
id: str
|
||||
|
||||
cost: float
|
||||
|
||||
message_id: str = FieldInfo(alias="messageID")
|
||||
|
||||
session_id: str = FieldInfo(alias="sessionID")
|
||||
|
||||
tokens: Tokens
|
||||
|
||||
type: Literal["step-finish"]
|
||||
|
|
@ -2,10 +2,18 @@
|
|||
|
||||
from typing_extensions import Literal
|
||||
|
||||
from pydantic import Field as FieldInfo
|
||||
|
||||
from .._models import BaseModel
|
||||
|
||||
__all__ = ["StepStartPart"]
|
||||
|
||||
|
||||
class StepStartPart(BaseModel):
|
||||
id: str
|
||||
|
||||
message_id: str = FieldInfo(alias="messageID")
|
||||
|
||||
session_id: str = FieldInfo(alias="sessionID")
|
||||
|
||||
type: Literal["step-start"]
|
||||
|
|
|
|||
37
src/opencode_ai/types/symbol.py
Normal file
37
src/opencode_ai/types/symbol.py
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
||||
|
||||
from .._models import BaseModel
|
||||
|
||||
__all__ = ["Symbol", "Location", "LocationRange", "LocationRangeEnd", "LocationRangeStart"]
|
||||
|
||||
|
||||
class LocationRangeEnd(BaseModel):
|
||||
character: float
|
||||
|
||||
line: float
|
||||
|
||||
|
||||
class LocationRangeStart(BaseModel):
|
||||
character: float
|
||||
|
||||
line: float
|
||||
|
||||
|
||||
class LocationRange(BaseModel):
|
||||
end: LocationRangeEnd
|
||||
|
||||
start: LocationRangeStart
|
||||
|
||||
|
||||
class Location(BaseModel):
|
||||
range: LocationRange
|
||||
|
||||
uri: str
|
||||
|
||||
|
||||
class Symbol(BaseModel):
|
||||
kind: float
|
||||
|
||||
location: Location
|
||||
|
||||
name: str
|
||||
|
|
@ -1,13 +1,32 @@
|
|||
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
||||
|
||||
from typing import Optional
|
||||
from typing_extensions import Literal
|
||||
|
||||
from pydantic import Field as FieldInfo
|
||||
|
||||
from .._models import BaseModel
|
||||
|
||||
__all__ = ["TextPart"]
|
||||
__all__ = ["TextPart", "Time"]
|
||||
|
||||
|
||||
class Time(BaseModel):
|
||||
start: float
|
||||
|
||||
end: Optional[float] = None
|
||||
|
||||
|
||||
class TextPart(BaseModel):
|
||||
id: str
|
||||
|
||||
message_id: str = FieldInfo(alias="messageID")
|
||||
|
||||
session_id: str = FieldInfo(alias="sessionID")
|
||||
|
||||
text: str
|
||||
|
||||
type: Literal["text"]
|
||||
|
||||
synthetic: Optional[bool] = None
|
||||
|
||||
time: Optional[Time] = None
|
||||
|
|
|
|||
|
|
@ -2,12 +2,30 @@
|
|||
|
||||
from __future__ import annotations
|
||||
|
||||
from typing_extensions import Literal, Required, TypedDict
|
||||
from typing_extensions import Literal, Required, Annotated, TypedDict
|
||||
|
||||
__all__ = ["TextPartParam"]
|
||||
from .._utils import PropertyInfo
|
||||
|
||||
__all__ = ["TextPartParam", "Time"]
|
||||
|
||||
|
||||
class Time(TypedDict, total=False):
|
||||
start: Required[float]
|
||||
|
||||
end: float
|
||||
|
||||
|
||||
class TextPartParam(TypedDict, total=False):
|
||||
id: Required[str]
|
||||
|
||||
message_id: Required[Annotated[str, PropertyInfo(alias="messageID")]]
|
||||
|
||||
session_id: Required[Annotated[str, PropertyInfo(alias="sessionID")]]
|
||||
|
||||
text: Required[str]
|
||||
|
||||
type: Required[Literal["text"]]
|
||||
|
||||
synthetic: bool
|
||||
|
||||
time: Time
|
||||
|
|
|
|||
|
|
@ -3,6 +3,8 @@
|
|||
from typing import Union
|
||||
from typing_extensions import Literal, Annotated, TypeAlias
|
||||
|
||||
from pydantic import Field as FieldInfo
|
||||
|
||||
from .._utils import PropertyInfo
|
||||
from .._models import BaseModel
|
||||
from .tool_state_error import ToolStateError
|
||||
|
|
@ -20,6 +22,12 @@ State: TypeAlias = Annotated[
|
|||
class ToolPart(BaseModel):
|
||||
id: str
|
||||
|
||||
call_id: str = FieldInfo(alias="callID")
|
||||
|
||||
message_id: str = FieldInfo(alias="messageID")
|
||||
|
||||
session_id: str = FieldInfo(alias="sessionID")
|
||||
|
||||
state: State
|
||||
|
||||
tool: str
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
||||
|
||||
from typing import Dict, Optional
|
||||
from typing import Dict
|
||||
from typing_extensions import Literal
|
||||
|
||||
from .._models import BaseModel
|
||||
|
|
@ -15,6 +15,8 @@ class Time(BaseModel):
|
|||
|
||||
|
||||
class ToolStateCompleted(BaseModel):
|
||||
input: Dict[str, object]
|
||||
|
||||
metadata: Dict[str, object]
|
||||
|
||||
output: str
|
||||
|
|
@ -24,5 +26,3 @@ class ToolStateCompleted(BaseModel):
|
|||
time: Time
|
||||
|
||||
title: str
|
||||
|
||||
input: Optional[object] = None
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
||||
|
||||
from typing import Optional
|
||||
from typing import Dict
|
||||
from typing_extensions import Literal
|
||||
|
||||
from .._models import BaseModel
|
||||
|
|
@ -17,8 +17,8 @@ class Time(BaseModel):
|
|||
class ToolStateError(BaseModel):
|
||||
error: str
|
||||
|
||||
input: Dict[str, object]
|
||||
|
||||
status: Literal["error"]
|
||||
|
||||
time: Time
|
||||
|
||||
input: Optional[object] = None
|
||||
|
|
|
|||
23
src/opencode_ai/types/user_message.py
Normal file
23
src/opencode_ai/types/user_message.py
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
||||
|
||||
from typing_extensions import Literal
|
||||
|
||||
from pydantic import Field as FieldInfo
|
||||
|
||||
from .._models import BaseModel
|
||||
|
||||
__all__ = ["UserMessage", "Time"]
|
||||
|
||||
|
||||
class Time(BaseModel):
|
||||
created: float
|
||||
|
||||
|
||||
class UserMessage(BaseModel):
|
||||
id: str
|
||||
|
||||
role: Literal["user"]
|
||||
|
||||
session_id: str = FieldInfo(alias="sessionID")
|
||||
|
||||
time: Time
|
||||
|
|
@ -1,12 +0,0 @@
|
|||
# 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_part import FilePart
|
||||
from .text_part import TextPart
|
||||
|
||||
__all__ = ["UserMessagePart"]
|
||||
|
||||
UserMessagePart: TypeAlias = Annotated[Union[TextPart, FilePart], PropertyInfo(discriminator="type")]
|
||||
|
|
@ -1,13 +0,0 @@
|
|||
# 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_part_param import FilePartParam
|
||||
from .text_part_param import TextPartParam
|
||||
|
||||
__all__ = ["UserMessagePartParam"]
|
||||
|
||||
UserMessagePartParam: TypeAlias = Union[TextPartParam, FilePartParam]
|
||||
Loading…
Add table
Add a link
Reference in a new issue