mirror of
https://github.com/anomalyco/opencode-sdk-go.git
synced 2026-04-28 04:29:49 +00:00
feat(api): api update
This commit is contained in:
parent
bc53a35b08
commit
e3a3e8fac4
7 changed files with 684 additions and 123 deletions
|
|
@ -1,4 +1,4 @@
|
|||
configured_endpoints: 43
|
||||
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/opencode%2Fopencode-5c627094d7b70a20907a0f9e5876a3a0bb9e1ffdbb94132192b8b98b5e59da97.yml
|
||||
openapi_spec_hash: 9b532c6babbd120cced490a7e07a15f5
|
||||
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/opencode%2Fopencode-92f9d0f8daee2ea7458f8b9f1d7a7f941ff932442ad944bc7576254d5978b6d5.yml
|
||||
openapi_spec_hash: 5b785c4ff6fb69039915f0e746abdaf9
|
||||
config_hash: 026ef000d34bf2f930e7b41e77d2d3ff
|
||||
|
|
|
|||
17
app.go
17
app.go
|
|
@ -64,6 +64,7 @@ type Model struct {
|
|||
Experimental bool `json:"experimental"`
|
||||
Modalities ModelModalities `json:"modalities"`
|
||||
Provider ModelProvider `json:"provider"`
|
||||
Status ModelStatus `json:"status"`
|
||||
JSON modelJSON `json:"-"`
|
||||
}
|
||||
|
||||
|
|
@ -82,6 +83,7 @@ type modelJSON struct {
|
|||
Experimental apijson.Field
|
||||
Modalities apijson.Field
|
||||
Provider apijson.Field
|
||||
Status apijson.Field
|
||||
raw string
|
||||
ExtraFields map[string]apijson.Field
|
||||
}
|
||||
|
|
@ -220,6 +222,21 @@ func (r modelProviderJSON) RawJSON() string {
|
|||
return r.raw
|
||||
}
|
||||
|
||||
type ModelStatus string
|
||||
|
||||
const (
|
||||
ModelStatusAlpha ModelStatus = "alpha"
|
||||
ModelStatusBeta ModelStatus = "beta"
|
||||
)
|
||||
|
||||
func (r ModelStatus) IsKnown() bool {
|
||||
switch r {
|
||||
case ModelStatusAlpha, ModelStatusBeta:
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
type Provider struct {
|
||||
ID string `json:"id,required"`
|
||||
Env []string `json:"env,required"`
|
||||
|
|
|
|||
26
config.go
26
config.go
|
|
@ -1578,6 +1578,7 @@ type ConfigProviderModel struct {
|
|||
Provider ConfigProviderModelsProvider `json:"provider"`
|
||||
Reasoning bool `json:"reasoning"`
|
||||
ReleaseDate string `json:"release_date"`
|
||||
Status ConfigProviderModelsStatus `json:"status"`
|
||||
Temperature bool `json:"temperature"`
|
||||
ToolCall bool `json:"tool_call"`
|
||||
JSON configProviderModelJSON `json:"-"`
|
||||
|
|
@ -1597,6 +1598,7 @@ type configProviderModelJSON struct {
|
|||
Provider apijson.Field
|
||||
Reasoning apijson.Field
|
||||
ReleaseDate apijson.Field
|
||||
Status apijson.Field
|
||||
Temperature apijson.Field
|
||||
ToolCall apijson.Field
|
||||
raw string
|
||||
|
|
@ -1741,6 +1743,21 @@ func (r configProviderModelsProviderJSON) RawJSON() string {
|
|||
return r.raw
|
||||
}
|
||||
|
||||
type ConfigProviderModelsStatus string
|
||||
|
||||
const (
|
||||
ConfigProviderModelsStatusAlpha ConfigProviderModelsStatus = "alpha"
|
||||
ConfigProviderModelsStatusBeta ConfigProviderModelsStatus = "beta"
|
||||
)
|
||||
|
||||
func (r ConfigProviderModelsStatus) IsKnown() bool {
|
||||
switch r {
|
||||
case ConfigProviderModelsStatusAlpha, ConfigProviderModelsStatusBeta:
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
type ConfigProviderOptions struct {
|
||||
APIKey string `json:"apiKey"`
|
||||
BaseURL string `json:"baseURL"`
|
||||
|
|
@ -1868,8 +1885,6 @@ type KeybindsConfig struct {
|
|||
AppExit string `json:"app_exit"`
|
||||
// Show help dialog
|
||||
AppHelp string `json:"app_help"`
|
||||
// List available commands
|
||||
CommandList string `json:"command_list"`
|
||||
// Open external editor
|
||||
EditorOpen string `json:"editor_open"`
|
||||
// @deprecated Close file
|
||||
|
|
@ -1944,10 +1959,6 @@ type KeybindsConfig struct {
|
|||
SessionTimeline string `json:"session_timeline"`
|
||||
// Unshare current session
|
||||
SessionUnshare string `json:"session_unshare"`
|
||||
// Toggle sidebar
|
||||
SidebarToggle string `json:"sidebar_toggle"`
|
||||
// View status
|
||||
StatusView string `json:"status_view"`
|
||||
// @deprecated use agent_cycle. Next agent
|
||||
SwitchAgent string `json:"switch_agent"`
|
||||
// @deprecated use agent_cycle_reverse. Previous agent
|
||||
|
|
@ -1972,7 +1983,6 @@ type keybindsConfigJSON struct {
|
|||
AgentList apijson.Field
|
||||
AppExit apijson.Field
|
||||
AppHelp apijson.Field
|
||||
CommandList apijson.Field
|
||||
EditorOpen apijson.Field
|
||||
FileClose apijson.Field
|
||||
FileDiffToggle apijson.Field
|
||||
|
|
@ -2010,8 +2020,6 @@ type keybindsConfigJSON struct {
|
|||
SessionShare apijson.Field
|
||||
SessionTimeline apijson.Field
|
||||
SessionUnshare apijson.Field
|
||||
SidebarToggle apijson.Field
|
||||
StatusView apijson.Field
|
||||
SwitchAgent apijson.Field
|
||||
SwitchAgentReverse apijson.Field
|
||||
SwitchMode apijson.Field
|
||||
|
|
|
|||
297
event.go
297
event.go
|
|
@ -54,7 +54,7 @@ func (r *EventService) ListStreaming(ctx context.Context, query EventListParams,
|
|||
type EventListResponse struct {
|
||||
// This field can have the runtime type of
|
||||
// [EventListResponseEventInstallationUpdatedProperties],
|
||||
// [EventListResponseEventLspClientDiagnosticsProperties], [interface{}],
|
||||
// [EventListResponseEventLspClientDiagnosticsProperties],
|
||||
// [EventListResponseEventMessageUpdatedProperties],
|
||||
// [EventListResponseEventMessageRemovedProperties],
|
||||
// [EventListResponseEventMessagePartUpdatedProperties],
|
||||
|
|
@ -65,9 +65,11 @@ type EventListResponse struct {
|
|||
// [EventListResponseEventFileWatcherUpdatedProperties],
|
||||
// [EventListResponseEventTodoUpdatedProperties],
|
||||
// [EventListResponseEventSessionIdleProperties],
|
||||
// [EventListResponseEventSessionCreatedProperties],
|
||||
// [EventListResponseEventSessionUpdatedProperties],
|
||||
// [EventListResponseEventSessionDeletedProperties],
|
||||
// [EventListResponseEventSessionErrorProperties].
|
||||
// [EventListResponseEventSessionErrorProperties], [interface{}],
|
||||
// [EventListResponseEventIdeInstalledProperties].
|
||||
Properties interface{} `json:"properties,required"`
|
||||
Type EventListResponseType `json:"type,required"`
|
||||
JSON eventListResponseJSON `json:"-"`
|
||||
|
|
@ -102,34 +104,34 @@ func (r *EventListResponse) UnmarshalJSON(data []byte) (err error) {
|
|||
// Possible runtime types of the union are
|
||||
// [EventListResponseEventInstallationUpdated],
|
||||
// [EventListResponseEventLspClientDiagnostics],
|
||||
// [EventListResponseEventLspUpdated], [EventListResponseEventMessageUpdated],
|
||||
// [EventListResponseEventMessageRemoved],
|
||||
// [EventListResponseEventMessageUpdated], [EventListResponseEventMessageRemoved],
|
||||
// [EventListResponseEventMessagePartUpdated],
|
||||
// [EventListResponseEventMessagePartRemoved],
|
||||
// [EventListResponseEventSessionCompacted],
|
||||
// [EventListResponseEventPermissionUpdated],
|
||||
// [EventListResponseEventPermissionReplied], [EventListResponseEventFileEdited],
|
||||
// [EventListResponseEventFileWatcherUpdated], [EventListResponseEventTodoUpdated],
|
||||
// [EventListResponseEventSessionIdle], [EventListResponseEventSessionUpdated],
|
||||
// [EventListResponseEventSessionDeleted], [EventListResponseEventSessionError],
|
||||
// [EventListResponseEventServerConnected].
|
||||
// [EventListResponseEventSessionIdle], [EventListResponseEventSessionCreated],
|
||||
// [EventListResponseEventSessionUpdated], [EventListResponseEventSessionDeleted],
|
||||
// [EventListResponseEventSessionError], [EventListResponseEventServerConnected],
|
||||
// [EventListResponseEventIdeInstalled].
|
||||
func (r EventListResponse) AsUnion() EventListResponseUnion {
|
||||
return r.union
|
||||
}
|
||||
|
||||
// Union satisfied by [EventListResponseEventInstallationUpdated],
|
||||
// [EventListResponseEventLspClientDiagnostics],
|
||||
// [EventListResponseEventLspUpdated], [EventListResponseEventMessageUpdated],
|
||||
// [EventListResponseEventMessageRemoved],
|
||||
// [EventListResponseEventMessageUpdated], [EventListResponseEventMessageRemoved],
|
||||
// [EventListResponseEventMessagePartUpdated],
|
||||
// [EventListResponseEventMessagePartRemoved],
|
||||
// [EventListResponseEventSessionCompacted],
|
||||
// [EventListResponseEventPermissionUpdated],
|
||||
// [EventListResponseEventPermissionReplied], [EventListResponseEventFileEdited],
|
||||
// [EventListResponseEventFileWatcherUpdated], [EventListResponseEventTodoUpdated],
|
||||
// [EventListResponseEventSessionIdle], [EventListResponseEventSessionUpdated],
|
||||
// [EventListResponseEventSessionDeleted], [EventListResponseEventSessionError] or
|
||||
// [EventListResponseEventServerConnected].
|
||||
// [EventListResponseEventSessionIdle], [EventListResponseEventSessionCreated],
|
||||
// [EventListResponseEventSessionUpdated], [EventListResponseEventSessionDeleted],
|
||||
// [EventListResponseEventSessionError], [EventListResponseEventServerConnected] or
|
||||
// [EventListResponseEventIdeInstalled].
|
||||
type EventListResponseUnion interface {
|
||||
implementsEventListResponse()
|
||||
}
|
||||
|
|
@ -146,10 +148,6 @@ func init() {
|
|||
TypeFilter: gjson.JSON,
|
||||
Type: reflect.TypeOf(EventListResponseEventLspClientDiagnostics{}),
|
||||
},
|
||||
apijson.UnionVariant{
|
||||
TypeFilter: gjson.JSON,
|
||||
Type: reflect.TypeOf(EventListResponseEventLspUpdated{}),
|
||||
},
|
||||
apijson.UnionVariant{
|
||||
TypeFilter: gjson.JSON,
|
||||
Type: reflect.TypeOf(EventListResponseEventMessageUpdated{}),
|
||||
|
|
@ -194,6 +192,10 @@ func init() {
|
|||
TypeFilter: gjson.JSON,
|
||||
Type: reflect.TypeOf(EventListResponseEventSessionIdle{}),
|
||||
},
|
||||
apijson.UnionVariant{
|
||||
TypeFilter: gjson.JSON,
|
||||
Type: reflect.TypeOf(EventListResponseEventSessionCreated{}),
|
||||
},
|
||||
apijson.UnionVariant{
|
||||
TypeFilter: gjson.JSON,
|
||||
Type: reflect.TypeOf(EventListResponseEventSessionUpdated{}),
|
||||
|
|
@ -210,6 +212,10 @@ func init() {
|
|||
TypeFilter: gjson.JSON,
|
||||
Type: reflect.TypeOf(EventListResponseEventServerConnected{}),
|
||||
},
|
||||
apijson.UnionVariant{
|
||||
TypeFilter: gjson.JSON,
|
||||
Type: reflect.TypeOf(EventListResponseEventIdeInstalled{}),
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
|
|
@ -335,45 +341,6 @@ func (r EventListResponseEventLspClientDiagnosticsType) IsKnown() bool {
|
|||
return false
|
||||
}
|
||||
|
||||
type EventListResponseEventLspUpdated struct {
|
||||
Properties interface{} `json:"properties,required"`
|
||||
Type EventListResponseEventLspUpdatedType `json:"type,required"`
|
||||
JSON eventListResponseEventLspUpdatedJSON `json:"-"`
|
||||
}
|
||||
|
||||
// eventListResponseEventLspUpdatedJSON contains the JSON metadata for the struct
|
||||
// [EventListResponseEventLspUpdated]
|
||||
type eventListResponseEventLspUpdatedJSON struct {
|
||||
Properties apijson.Field
|
||||
Type apijson.Field
|
||||
raw string
|
||||
ExtraFields map[string]apijson.Field
|
||||
}
|
||||
|
||||
func (r *EventListResponseEventLspUpdated) UnmarshalJSON(data []byte) (err error) {
|
||||
return apijson.UnmarshalRoot(data, r)
|
||||
}
|
||||
|
||||
func (r eventListResponseEventLspUpdatedJSON) RawJSON() string {
|
||||
return r.raw
|
||||
}
|
||||
|
||||
func (r EventListResponseEventLspUpdated) implementsEventListResponse() {}
|
||||
|
||||
type EventListResponseEventLspUpdatedType string
|
||||
|
||||
const (
|
||||
EventListResponseEventLspUpdatedTypeLspUpdated EventListResponseEventLspUpdatedType = "lsp.updated"
|
||||
)
|
||||
|
||||
func (r EventListResponseEventLspUpdatedType) IsKnown() bool {
|
||||
switch r {
|
||||
case EventListResponseEventLspUpdatedTypeLspUpdated:
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
type EventListResponseEventMessageUpdated struct {
|
||||
Properties EventListResponseEventMessageUpdatedProperties `json:"properties,required"`
|
||||
Type EventListResponseEventMessageUpdatedType `json:"type,required"`
|
||||
|
|
@ -522,14 +489,16 @@ func (r eventListResponseEventMessagePartUpdatedJSON) RawJSON() string {
|
|||
func (r EventListResponseEventMessagePartUpdated) implementsEventListResponse() {}
|
||||
|
||||
type EventListResponseEventMessagePartUpdatedProperties struct {
|
||||
Part Part `json:"part,required"`
|
||||
JSON eventListResponseEventMessagePartUpdatedPropertiesJSON `json:"-"`
|
||||
Part Part `json:"part,required"`
|
||||
Delta string `json:"delta"`
|
||||
JSON eventListResponseEventMessagePartUpdatedPropertiesJSON `json:"-"`
|
||||
}
|
||||
|
||||
// eventListResponseEventMessagePartUpdatedPropertiesJSON contains the JSON
|
||||
// metadata for the struct [EventListResponseEventMessagePartUpdatedProperties]
|
||||
type eventListResponseEventMessagePartUpdatedPropertiesJSON struct {
|
||||
Part apijson.Field
|
||||
Delta apijson.Field
|
||||
raw string
|
||||
ExtraFields map[string]apijson.Field
|
||||
}
|
||||
|
|
@ -1074,6 +1043,66 @@ func (r EventListResponseEventSessionIdleType) IsKnown() bool {
|
|||
return false
|
||||
}
|
||||
|
||||
type EventListResponseEventSessionCreated struct {
|
||||
Properties EventListResponseEventSessionCreatedProperties `json:"properties,required"`
|
||||
Type EventListResponseEventSessionCreatedType `json:"type,required"`
|
||||
JSON eventListResponseEventSessionCreatedJSON `json:"-"`
|
||||
}
|
||||
|
||||
// eventListResponseEventSessionCreatedJSON contains the JSON metadata for the
|
||||
// struct [EventListResponseEventSessionCreated]
|
||||
type eventListResponseEventSessionCreatedJSON struct {
|
||||
Properties apijson.Field
|
||||
Type apijson.Field
|
||||
raw string
|
||||
ExtraFields map[string]apijson.Field
|
||||
}
|
||||
|
||||
func (r *EventListResponseEventSessionCreated) UnmarshalJSON(data []byte) (err error) {
|
||||
return apijson.UnmarshalRoot(data, r)
|
||||
}
|
||||
|
||||
func (r eventListResponseEventSessionCreatedJSON) RawJSON() string {
|
||||
return r.raw
|
||||
}
|
||||
|
||||
func (r EventListResponseEventSessionCreated) implementsEventListResponse() {}
|
||||
|
||||
type EventListResponseEventSessionCreatedProperties struct {
|
||||
Info Session `json:"info,required"`
|
||||
JSON eventListResponseEventSessionCreatedPropertiesJSON `json:"-"`
|
||||
}
|
||||
|
||||
// eventListResponseEventSessionCreatedPropertiesJSON contains the JSON metadata
|
||||
// for the struct [EventListResponseEventSessionCreatedProperties]
|
||||
type eventListResponseEventSessionCreatedPropertiesJSON struct {
|
||||
Info apijson.Field
|
||||
raw string
|
||||
ExtraFields map[string]apijson.Field
|
||||
}
|
||||
|
||||
func (r *EventListResponseEventSessionCreatedProperties) UnmarshalJSON(data []byte) (err error) {
|
||||
return apijson.UnmarshalRoot(data, r)
|
||||
}
|
||||
|
||||
func (r eventListResponseEventSessionCreatedPropertiesJSON) RawJSON() string {
|
||||
return r.raw
|
||||
}
|
||||
|
||||
type EventListResponseEventSessionCreatedType string
|
||||
|
||||
const (
|
||||
EventListResponseEventSessionCreatedTypeSessionCreated EventListResponseEventSessionCreatedType = "session.created"
|
||||
)
|
||||
|
||||
func (r EventListResponseEventSessionCreatedType) IsKnown() bool {
|
||||
switch r {
|
||||
case EventListResponseEventSessionCreatedTypeSessionCreated:
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
type EventListResponseEventSessionUpdated struct {
|
||||
Properties EventListResponseEventSessionUpdatedProperties `json:"properties,required"`
|
||||
Type EventListResponseEventSessionUpdatedType `json:"type,required"`
|
||||
|
|
@ -1244,7 +1273,8 @@ func (r eventListResponseEventSessionErrorPropertiesJSON) RawJSON() string {
|
|||
|
||||
type EventListResponseEventSessionErrorPropertiesError struct {
|
||||
// This field can have the runtime type of [shared.ProviderAuthErrorData],
|
||||
// [shared.UnknownErrorData], [interface{}], [shared.MessageAbortedErrorData].
|
||||
// [shared.UnknownErrorData], [interface{}], [shared.MessageAbortedErrorData],
|
||||
// [EventListResponseEventSessionErrorPropertiesErrorAPIErrorData].
|
||||
Data interface{} `json:"data,required"`
|
||||
Name EventListResponseEventSessionErrorPropertiesErrorName `json:"name,required"`
|
||||
JSON eventListResponseEventSessionErrorPropertiesErrorJSON `json:"-"`
|
||||
|
|
@ -1279,14 +1309,16 @@ func (r *EventListResponseEventSessionErrorPropertiesError) UnmarshalJSON(data [
|
|||
// Possible runtime types of the union are [shared.ProviderAuthError],
|
||||
// [shared.UnknownError],
|
||||
// [EventListResponseEventSessionErrorPropertiesErrorMessageOutputLengthError],
|
||||
// [shared.MessageAbortedError].
|
||||
// [shared.MessageAbortedError],
|
||||
// [EventListResponseEventSessionErrorPropertiesErrorAPIError].
|
||||
func (r EventListResponseEventSessionErrorPropertiesError) AsUnion() EventListResponseEventSessionErrorPropertiesErrorUnion {
|
||||
return r.union
|
||||
}
|
||||
|
||||
// Union satisfied by [shared.ProviderAuthError], [shared.UnknownError],
|
||||
// [EventListResponseEventSessionErrorPropertiesErrorMessageOutputLengthError] or
|
||||
// [shared.MessageAbortedError].
|
||||
// [EventListResponseEventSessionErrorPropertiesErrorMessageOutputLengthError],
|
||||
// [shared.MessageAbortedError] or
|
||||
// [EventListResponseEventSessionErrorPropertiesErrorAPIError].
|
||||
type EventListResponseEventSessionErrorPropertiesErrorUnion interface {
|
||||
ImplementsEventListResponseEventSessionErrorPropertiesError()
|
||||
}
|
||||
|
|
@ -1311,6 +1343,10 @@ func init() {
|
|||
TypeFilter: gjson.JSON,
|
||||
Type: reflect.TypeOf(shared.MessageAbortedError{}),
|
||||
},
|
||||
apijson.UnionVariant{
|
||||
TypeFilter: gjson.JSON,
|
||||
Type: reflect.TypeOf(EventListResponseEventSessionErrorPropertiesErrorAPIError{}),
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
|
|
@ -1355,6 +1391,77 @@ func (r EventListResponseEventSessionErrorPropertiesErrorMessageOutputLengthErro
|
|||
return false
|
||||
}
|
||||
|
||||
type EventListResponseEventSessionErrorPropertiesErrorAPIError struct {
|
||||
Data EventListResponseEventSessionErrorPropertiesErrorAPIErrorData `json:"data,required"`
|
||||
Name EventListResponseEventSessionErrorPropertiesErrorAPIErrorName `json:"name,required"`
|
||||
JSON eventListResponseEventSessionErrorPropertiesErrorAPIErrorJSON `json:"-"`
|
||||
}
|
||||
|
||||
// eventListResponseEventSessionErrorPropertiesErrorAPIErrorJSON contains the JSON
|
||||
// metadata for the struct
|
||||
// [EventListResponseEventSessionErrorPropertiesErrorAPIError]
|
||||
type eventListResponseEventSessionErrorPropertiesErrorAPIErrorJSON struct {
|
||||
Data apijson.Field
|
||||
Name apijson.Field
|
||||
raw string
|
||||
ExtraFields map[string]apijson.Field
|
||||
}
|
||||
|
||||
func (r *EventListResponseEventSessionErrorPropertiesErrorAPIError) UnmarshalJSON(data []byte) (err error) {
|
||||
return apijson.UnmarshalRoot(data, r)
|
||||
}
|
||||
|
||||
func (r eventListResponseEventSessionErrorPropertiesErrorAPIErrorJSON) RawJSON() string {
|
||||
return r.raw
|
||||
}
|
||||
|
||||
func (r EventListResponseEventSessionErrorPropertiesErrorAPIError) ImplementsEventListResponseEventSessionErrorPropertiesError() {
|
||||
}
|
||||
|
||||
type EventListResponseEventSessionErrorPropertiesErrorAPIErrorData struct {
|
||||
IsRetryable bool `json:"isRetryable,required"`
|
||||
Message string `json:"message,required"`
|
||||
ResponseBody string `json:"responseBody"`
|
||||
ResponseHeaders map[string]string `json:"responseHeaders"`
|
||||
StatusCode float64 `json:"statusCode"`
|
||||
JSON eventListResponseEventSessionErrorPropertiesErrorAPIErrorDataJSON `json:"-"`
|
||||
}
|
||||
|
||||
// eventListResponseEventSessionErrorPropertiesErrorAPIErrorDataJSON contains the
|
||||
// JSON metadata for the struct
|
||||
// [EventListResponseEventSessionErrorPropertiesErrorAPIErrorData]
|
||||
type eventListResponseEventSessionErrorPropertiesErrorAPIErrorDataJSON struct {
|
||||
IsRetryable apijson.Field
|
||||
Message apijson.Field
|
||||
ResponseBody apijson.Field
|
||||
ResponseHeaders apijson.Field
|
||||
StatusCode apijson.Field
|
||||
raw string
|
||||
ExtraFields map[string]apijson.Field
|
||||
}
|
||||
|
||||
func (r *EventListResponseEventSessionErrorPropertiesErrorAPIErrorData) UnmarshalJSON(data []byte) (err error) {
|
||||
return apijson.UnmarshalRoot(data, r)
|
||||
}
|
||||
|
||||
func (r eventListResponseEventSessionErrorPropertiesErrorAPIErrorDataJSON) RawJSON() string {
|
||||
return r.raw
|
||||
}
|
||||
|
||||
type EventListResponseEventSessionErrorPropertiesErrorAPIErrorName string
|
||||
|
||||
const (
|
||||
EventListResponseEventSessionErrorPropertiesErrorAPIErrorNameAPIError EventListResponseEventSessionErrorPropertiesErrorAPIErrorName = "APIError"
|
||||
)
|
||||
|
||||
func (r EventListResponseEventSessionErrorPropertiesErrorAPIErrorName) IsKnown() bool {
|
||||
switch r {
|
||||
case EventListResponseEventSessionErrorPropertiesErrorAPIErrorNameAPIError:
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
type EventListResponseEventSessionErrorPropertiesErrorName string
|
||||
|
||||
const (
|
||||
|
|
@ -1362,11 +1469,12 @@ const (
|
|||
EventListResponseEventSessionErrorPropertiesErrorNameUnknownError EventListResponseEventSessionErrorPropertiesErrorName = "UnknownError"
|
||||
EventListResponseEventSessionErrorPropertiesErrorNameMessageOutputLengthError EventListResponseEventSessionErrorPropertiesErrorName = "MessageOutputLengthError"
|
||||
EventListResponseEventSessionErrorPropertiesErrorNameMessageAbortedError EventListResponseEventSessionErrorPropertiesErrorName = "MessageAbortedError"
|
||||
EventListResponseEventSessionErrorPropertiesErrorNameAPIError EventListResponseEventSessionErrorPropertiesErrorName = "APIError"
|
||||
)
|
||||
|
||||
func (r EventListResponseEventSessionErrorPropertiesErrorName) IsKnown() bool {
|
||||
switch r {
|
||||
case EventListResponseEventSessionErrorPropertiesErrorNameProviderAuthError, EventListResponseEventSessionErrorPropertiesErrorNameUnknownError, EventListResponseEventSessionErrorPropertiesErrorNameMessageOutputLengthError, EventListResponseEventSessionErrorPropertiesErrorNameMessageAbortedError:
|
||||
case EventListResponseEventSessionErrorPropertiesErrorNameProviderAuthError, EventListResponseEventSessionErrorPropertiesErrorNameUnknownError, EventListResponseEventSessionErrorPropertiesErrorNameMessageOutputLengthError, EventListResponseEventSessionErrorPropertiesErrorNameMessageAbortedError, EventListResponseEventSessionErrorPropertiesErrorNameAPIError:
|
||||
return true
|
||||
}
|
||||
return false
|
||||
|
|
@ -1425,12 +1533,71 @@ func (r EventListResponseEventServerConnectedType) IsKnown() bool {
|
|||
return false
|
||||
}
|
||||
|
||||
type EventListResponseEventIdeInstalled struct {
|
||||
Properties EventListResponseEventIdeInstalledProperties `json:"properties,required"`
|
||||
Type EventListResponseEventIdeInstalledType `json:"type,required"`
|
||||
JSON eventListResponseEventIdeInstalledJSON `json:"-"`
|
||||
}
|
||||
|
||||
// eventListResponseEventIdeInstalledJSON contains the JSON metadata for the struct
|
||||
// [EventListResponseEventIdeInstalled]
|
||||
type eventListResponseEventIdeInstalledJSON struct {
|
||||
Properties apijson.Field
|
||||
Type apijson.Field
|
||||
raw string
|
||||
ExtraFields map[string]apijson.Field
|
||||
}
|
||||
|
||||
func (r *EventListResponseEventIdeInstalled) UnmarshalJSON(data []byte) (err error) {
|
||||
return apijson.UnmarshalRoot(data, r)
|
||||
}
|
||||
|
||||
func (r eventListResponseEventIdeInstalledJSON) RawJSON() string {
|
||||
return r.raw
|
||||
}
|
||||
|
||||
func (r EventListResponseEventIdeInstalled) implementsEventListResponse() {}
|
||||
|
||||
type EventListResponseEventIdeInstalledProperties struct {
|
||||
Ide string `json:"ide,required"`
|
||||
JSON eventListResponseEventIdeInstalledPropertiesJSON `json:"-"`
|
||||
}
|
||||
|
||||
// eventListResponseEventIdeInstalledPropertiesJSON contains the JSON metadata for
|
||||
// the struct [EventListResponseEventIdeInstalledProperties]
|
||||
type eventListResponseEventIdeInstalledPropertiesJSON struct {
|
||||
Ide apijson.Field
|
||||
raw string
|
||||
ExtraFields map[string]apijson.Field
|
||||
}
|
||||
|
||||
func (r *EventListResponseEventIdeInstalledProperties) UnmarshalJSON(data []byte) (err error) {
|
||||
return apijson.UnmarshalRoot(data, r)
|
||||
}
|
||||
|
||||
func (r eventListResponseEventIdeInstalledPropertiesJSON) RawJSON() string {
|
||||
return r.raw
|
||||
}
|
||||
|
||||
type EventListResponseEventIdeInstalledType string
|
||||
|
||||
const (
|
||||
EventListResponseEventIdeInstalledTypeIdeInstalled EventListResponseEventIdeInstalledType = "ide.installed"
|
||||
)
|
||||
|
||||
func (r EventListResponseEventIdeInstalledType) IsKnown() bool {
|
||||
switch r {
|
||||
case EventListResponseEventIdeInstalledTypeIdeInstalled:
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
type EventListResponseType string
|
||||
|
||||
const (
|
||||
EventListResponseTypeInstallationUpdated EventListResponseType = "installation.updated"
|
||||
EventListResponseTypeLspClientDiagnostics EventListResponseType = "lsp.client.diagnostics"
|
||||
EventListResponseTypeLspUpdated EventListResponseType = "lsp.updated"
|
||||
EventListResponseTypeMessageUpdated EventListResponseType = "message.updated"
|
||||
EventListResponseTypeMessageRemoved EventListResponseType = "message.removed"
|
||||
EventListResponseTypeMessagePartUpdated EventListResponseType = "message.part.updated"
|
||||
|
|
@ -1442,15 +1609,17 @@ const (
|
|||
EventListResponseTypeFileWatcherUpdated EventListResponseType = "file.watcher.updated"
|
||||
EventListResponseTypeTodoUpdated EventListResponseType = "todo.updated"
|
||||
EventListResponseTypeSessionIdle EventListResponseType = "session.idle"
|
||||
EventListResponseTypeSessionCreated EventListResponseType = "session.created"
|
||||
EventListResponseTypeSessionUpdated EventListResponseType = "session.updated"
|
||||
EventListResponseTypeSessionDeleted EventListResponseType = "session.deleted"
|
||||
EventListResponseTypeSessionError EventListResponseType = "session.error"
|
||||
EventListResponseTypeServerConnected EventListResponseType = "server.connected"
|
||||
EventListResponseTypeIdeInstalled EventListResponseType = "ide.installed"
|
||||
)
|
||||
|
||||
func (r EventListResponseType) IsKnown() bool {
|
||||
switch r {
|
||||
case EventListResponseTypeInstallationUpdated, EventListResponseTypeLspClientDiagnostics, EventListResponseTypeLspUpdated, EventListResponseTypeMessageUpdated, EventListResponseTypeMessageRemoved, EventListResponseTypeMessagePartUpdated, EventListResponseTypeMessagePartRemoved, EventListResponseTypeSessionCompacted, EventListResponseTypePermissionUpdated, EventListResponseTypePermissionReplied, EventListResponseTypeFileEdited, EventListResponseTypeFileWatcherUpdated, EventListResponseTypeTodoUpdated, EventListResponseTypeSessionIdle, EventListResponseTypeSessionUpdated, EventListResponseTypeSessionDeleted, EventListResponseTypeSessionError, EventListResponseTypeServerConnected:
|
||||
case EventListResponseTypeInstallationUpdated, EventListResponseTypeLspClientDiagnostics, EventListResponseTypeMessageUpdated, EventListResponseTypeMessageRemoved, EventListResponseTypeMessagePartUpdated, EventListResponseTypeMessagePartRemoved, EventListResponseTypeSessionCompacted, EventListResponseTypePermissionUpdated, EventListResponseTypePermissionReplied, EventListResponseTypeFileEdited, EventListResponseTypeFileWatcherUpdated, EventListResponseTypeTodoUpdated, EventListResponseTypeSessionIdle, EventListResponseTypeSessionCreated, EventListResponseTypeSessionUpdated, EventListResponseTypeSessionDeleted, EventListResponseTypeSessionError, EventListResponseTypeServerConnected, EventListResponseTypeIdeInstalled:
|
||||
return true
|
||||
}
|
||||
return false
|
||||
|
|
|
|||
42
file.go
42
file.go
|
|
@ -144,17 +144,23 @@ func (r FileNodeType) IsKnown() bool {
|
|||
}
|
||||
|
||||
type FileReadResponse struct {
|
||||
Content string `json:"content,required"`
|
||||
Diff string `json:"diff"`
|
||||
Patch FileReadResponsePatch `json:"patch"`
|
||||
JSON fileReadResponseJSON `json:"-"`
|
||||
Content string `json:"content,required"`
|
||||
Type FileReadResponseType `json:"type,required"`
|
||||
Diff string `json:"diff"`
|
||||
Encoding FileReadResponseEncoding `json:"encoding"`
|
||||
MimeType string `json:"mimeType"`
|
||||
Patch FileReadResponsePatch `json:"patch"`
|
||||
JSON fileReadResponseJSON `json:"-"`
|
||||
}
|
||||
|
||||
// fileReadResponseJSON contains the JSON metadata for the struct
|
||||
// [FileReadResponse]
|
||||
type fileReadResponseJSON struct {
|
||||
Content apijson.Field
|
||||
Type apijson.Field
|
||||
Diff apijson.Field
|
||||
Encoding apijson.Field
|
||||
MimeType apijson.Field
|
||||
Patch apijson.Field
|
||||
raw string
|
||||
ExtraFields map[string]apijson.Field
|
||||
|
|
@ -168,6 +174,34 @@ func (r fileReadResponseJSON) RawJSON() string {
|
|||
return r.raw
|
||||
}
|
||||
|
||||
type FileReadResponseType string
|
||||
|
||||
const (
|
||||
FileReadResponseTypeText FileReadResponseType = "text"
|
||||
)
|
||||
|
||||
func (r FileReadResponseType) IsKnown() bool {
|
||||
switch r {
|
||||
case FileReadResponseTypeText:
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
type FileReadResponseEncoding string
|
||||
|
||||
const (
|
||||
FileReadResponseEncodingBase64 FileReadResponseEncoding = "base64"
|
||||
)
|
||||
|
||||
func (r FileReadResponseEncoding) IsKnown() bool {
|
||||
switch r {
|
||||
case FileReadResponseEncodingBase64:
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
type FileReadResponsePatch struct {
|
||||
Hunks []FileReadResponsePatchHunk `json:"hunks,required"`
|
||||
NewFileName string `json:"newFileName,required"`
|
||||
|
|
|
|||
418
session.go
418
session.go
|
|
@ -365,6 +365,7 @@ type AssistantMessage struct {
|
|||
Cost float64 `json:"cost,required"`
|
||||
Mode string `json:"mode,required"`
|
||||
ModelID string `json:"modelID,required"`
|
||||
ParentID string `json:"parentID,required"`
|
||||
Path AssistantMessagePath `json:"path,required"`
|
||||
ProviderID string `json:"providerID,required"`
|
||||
Role AssistantMessageRole `json:"role,required"`
|
||||
|
|
@ -373,7 +374,6 @@ type AssistantMessage struct {
|
|||
Time AssistantMessageTime `json:"time,required"`
|
||||
Tokens AssistantMessageTokens `json:"tokens,required"`
|
||||
Error AssistantMessageError `json:"error"`
|
||||
Finish string `json:"finish"`
|
||||
Summary bool `json:"summary"`
|
||||
JSON assistantMessageJSON `json:"-"`
|
||||
}
|
||||
|
|
@ -385,6 +385,7 @@ type assistantMessageJSON struct {
|
|||
Cost apijson.Field
|
||||
Mode apijson.Field
|
||||
ModelID apijson.Field
|
||||
ParentID apijson.Field
|
||||
Path apijson.Field
|
||||
ProviderID apijson.Field
|
||||
Role apijson.Field
|
||||
|
|
@ -393,7 +394,6 @@ type assistantMessageJSON struct {
|
|||
Time apijson.Field
|
||||
Tokens apijson.Field
|
||||
Error apijson.Field
|
||||
Finish apijson.Field
|
||||
Summary apijson.Field
|
||||
raw string
|
||||
ExtraFields map[string]apijson.Field
|
||||
|
|
@ -521,7 +521,8 @@ func (r assistantMessageTokensCacheJSON) RawJSON() string {
|
|||
|
||||
type AssistantMessageError struct {
|
||||
// This field can have the runtime type of [shared.ProviderAuthErrorData],
|
||||
// [shared.UnknownErrorData], [interface{}], [shared.MessageAbortedErrorData].
|
||||
// [shared.UnknownErrorData], [interface{}], [shared.MessageAbortedErrorData],
|
||||
// [AssistantMessageErrorAPIErrorData].
|
||||
Data interface{} `json:"data,required"`
|
||||
Name AssistantMessageErrorName `json:"name,required"`
|
||||
JSON assistantMessageErrorJSON `json:"-"`
|
||||
|
|
@ -555,13 +556,14 @@ func (r *AssistantMessageError) UnmarshalJSON(data []byte) (err error) {
|
|||
//
|
||||
// Possible runtime types of the union are [shared.ProviderAuthError],
|
||||
// [shared.UnknownError], [AssistantMessageErrorMessageOutputLengthError],
|
||||
// [shared.MessageAbortedError].
|
||||
// [shared.MessageAbortedError], [AssistantMessageErrorAPIError].
|
||||
func (r AssistantMessageError) AsUnion() AssistantMessageErrorUnion {
|
||||
return r.union
|
||||
}
|
||||
|
||||
// Union satisfied by [shared.ProviderAuthError], [shared.UnknownError],
|
||||
// [AssistantMessageErrorMessageOutputLengthError] or [shared.MessageAbortedError].
|
||||
// [AssistantMessageErrorMessageOutputLengthError], [shared.MessageAbortedError] or
|
||||
// [AssistantMessageErrorAPIError].
|
||||
type AssistantMessageErrorUnion interface {
|
||||
ImplementsAssistantMessageError()
|
||||
}
|
||||
|
|
@ -586,6 +588,10 @@ func init() {
|
|||
TypeFilter: gjson.JSON,
|
||||
Type: reflect.TypeOf(shared.MessageAbortedError{}),
|
||||
},
|
||||
apijson.UnionVariant{
|
||||
TypeFilter: gjson.JSON,
|
||||
Type: reflect.TypeOf(AssistantMessageErrorAPIError{}),
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
|
|
@ -628,6 +634,74 @@ func (r AssistantMessageErrorMessageOutputLengthErrorName) IsKnown() bool {
|
|||
return false
|
||||
}
|
||||
|
||||
type AssistantMessageErrorAPIError struct {
|
||||
Data AssistantMessageErrorAPIErrorData `json:"data,required"`
|
||||
Name AssistantMessageErrorAPIErrorName `json:"name,required"`
|
||||
JSON assistantMessageErrorAPIErrorJSON `json:"-"`
|
||||
}
|
||||
|
||||
// assistantMessageErrorAPIErrorJSON contains the JSON metadata for the struct
|
||||
// [AssistantMessageErrorAPIError]
|
||||
type assistantMessageErrorAPIErrorJSON struct {
|
||||
Data apijson.Field
|
||||
Name apijson.Field
|
||||
raw string
|
||||
ExtraFields map[string]apijson.Field
|
||||
}
|
||||
|
||||
func (r *AssistantMessageErrorAPIError) UnmarshalJSON(data []byte) (err error) {
|
||||
return apijson.UnmarshalRoot(data, r)
|
||||
}
|
||||
|
||||
func (r assistantMessageErrorAPIErrorJSON) RawJSON() string {
|
||||
return r.raw
|
||||
}
|
||||
|
||||
func (r AssistantMessageErrorAPIError) ImplementsAssistantMessageError() {}
|
||||
|
||||
type AssistantMessageErrorAPIErrorData struct {
|
||||
IsRetryable bool `json:"isRetryable,required"`
|
||||
Message string `json:"message,required"`
|
||||
ResponseBody string `json:"responseBody"`
|
||||
ResponseHeaders map[string]string `json:"responseHeaders"`
|
||||
StatusCode float64 `json:"statusCode"`
|
||||
JSON assistantMessageErrorAPIErrorDataJSON `json:"-"`
|
||||
}
|
||||
|
||||
// assistantMessageErrorAPIErrorDataJSON contains the JSON metadata for the struct
|
||||
// [AssistantMessageErrorAPIErrorData]
|
||||
type assistantMessageErrorAPIErrorDataJSON struct {
|
||||
IsRetryable apijson.Field
|
||||
Message apijson.Field
|
||||
ResponseBody apijson.Field
|
||||
ResponseHeaders apijson.Field
|
||||
StatusCode apijson.Field
|
||||
raw string
|
||||
ExtraFields map[string]apijson.Field
|
||||
}
|
||||
|
||||
func (r *AssistantMessageErrorAPIErrorData) UnmarshalJSON(data []byte) (err error) {
|
||||
return apijson.UnmarshalRoot(data, r)
|
||||
}
|
||||
|
||||
func (r assistantMessageErrorAPIErrorDataJSON) RawJSON() string {
|
||||
return r.raw
|
||||
}
|
||||
|
||||
type AssistantMessageErrorAPIErrorName string
|
||||
|
||||
const (
|
||||
AssistantMessageErrorAPIErrorNameAPIError AssistantMessageErrorAPIErrorName = "APIError"
|
||||
)
|
||||
|
||||
func (r AssistantMessageErrorAPIErrorName) IsKnown() bool {
|
||||
switch r {
|
||||
case AssistantMessageErrorAPIErrorNameAPIError:
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
type AssistantMessageErrorName string
|
||||
|
||||
const (
|
||||
|
|
@ -635,11 +709,12 @@ const (
|
|||
AssistantMessageErrorNameUnknownError AssistantMessageErrorName = "UnknownError"
|
||||
AssistantMessageErrorNameMessageOutputLengthError AssistantMessageErrorName = "MessageOutputLengthError"
|
||||
AssistantMessageErrorNameMessageAbortedError AssistantMessageErrorName = "MessageAbortedError"
|
||||
AssistantMessageErrorNameAPIError AssistantMessageErrorName = "APIError"
|
||||
)
|
||||
|
||||
func (r AssistantMessageErrorName) IsKnown() bool {
|
||||
switch r {
|
||||
case AssistantMessageErrorNameProviderAuthError, AssistantMessageErrorNameUnknownError, AssistantMessageErrorNameMessageOutputLengthError, AssistantMessageErrorNameMessageAbortedError:
|
||||
case AssistantMessageErrorNameProviderAuthError, AssistantMessageErrorNameUnknownError, AssistantMessageErrorNameMessageOutputLengthError, AssistantMessageErrorNameMessageAbortedError, AssistantMessageErrorNameAPIError:
|
||||
return true
|
||||
}
|
||||
return false
|
||||
|
|
@ -920,14 +995,15 @@ type Message struct {
|
|||
Time interface{} `json:"time,required"`
|
||||
Cost float64 `json:"cost"`
|
||||
// This field can have the runtime type of [AssistantMessageError].
|
||||
Error interface{} `json:"error"`
|
||||
Finish string `json:"finish"`
|
||||
Mode string `json:"mode"`
|
||||
ModelID string `json:"modelID"`
|
||||
Error interface{} `json:"error"`
|
||||
Mode string `json:"mode"`
|
||||
ModelID string `json:"modelID"`
|
||||
ParentID string `json:"parentID"`
|
||||
// This field can have the runtime type of [AssistantMessagePath].
|
||||
Path interface{} `json:"path"`
|
||||
ProviderID string `json:"providerID"`
|
||||
Summary bool `json:"summary"`
|
||||
// This field can have the runtime type of [UserMessageSummary], [bool].
|
||||
Summary interface{} `json:"summary"`
|
||||
// This field can have the runtime type of [[]string].
|
||||
System interface{} `json:"system"`
|
||||
// This field can have the runtime type of [AssistantMessageTokens].
|
||||
|
|
@ -944,9 +1020,9 @@ type messageJSON struct {
|
|||
Time apijson.Field
|
||||
Cost apijson.Field
|
||||
Error apijson.Field
|
||||
Finish apijson.Field
|
||||
Mode apijson.Field
|
||||
ModelID apijson.Field
|
||||
ParentID apijson.Field
|
||||
Path apijson.Field
|
||||
ProviderID apijson.Field
|
||||
Summary apijson.Field
|
||||
|
|
@ -1017,9 +1093,12 @@ type Part struct {
|
|||
MessageID string `json:"messageID,required"`
|
||||
SessionID string `json:"sessionID,required"`
|
||||
Type PartType `json:"type,required"`
|
||||
Attempt float64 `json:"attempt"`
|
||||
CallID string `json:"callID"`
|
||||
Cost float64 `json:"cost"`
|
||||
Filename string `json:"filename"`
|
||||
// This field can have the runtime type of [PartRetryPartError].
|
||||
Error interface{} `json:"error"`
|
||||
Filename string `json:"filename"`
|
||||
// This field can have the runtime type of [[]string].
|
||||
Files interface{} `json:"files"`
|
||||
Hash string `json:"hash"`
|
||||
|
|
@ -1027,6 +1106,7 @@ type Part struct {
|
|||
Metadata interface{} `json:"metadata"`
|
||||
Mime string `json:"mime"`
|
||||
Name string `json:"name"`
|
||||
Reason string `json:"reason"`
|
||||
Snapshot string `json:"snapshot"`
|
||||
// This field can have the runtime type of [FilePartSource], [AgentPartSource].
|
||||
Source interface{} `json:"source"`
|
||||
|
|
@ -1034,7 +1114,8 @@ type Part struct {
|
|||
State interface{} `json:"state"`
|
||||
Synthetic bool `json:"synthetic"`
|
||||
Text string `json:"text"`
|
||||
// This field can have the runtime type of [TextPartTime], [ReasoningPartTime].
|
||||
// This field can have the runtime type of [TextPartTime], [ReasoningPartTime],
|
||||
// [PartRetryPartTime].
|
||||
Time interface{} `json:"time"`
|
||||
// This field can have the runtime type of [StepFinishPartTokens].
|
||||
Tokens interface{} `json:"tokens"`
|
||||
|
|
@ -1050,14 +1131,17 @@ type partJSON struct {
|
|||
MessageID apijson.Field
|
||||
SessionID apijson.Field
|
||||
Type apijson.Field
|
||||
Attempt apijson.Field
|
||||
CallID apijson.Field
|
||||
Cost apijson.Field
|
||||
Error apijson.Field
|
||||
Filename apijson.Field
|
||||
Files apijson.Field
|
||||
Hash apijson.Field
|
||||
Metadata apijson.Field
|
||||
Mime apijson.Field
|
||||
Name apijson.Field
|
||||
Reason apijson.Field
|
||||
Snapshot apijson.Field
|
||||
Source apijson.Field
|
||||
State apijson.Field
|
||||
|
|
@ -1089,14 +1173,14 @@ func (r *Part) UnmarshalJSON(data []byte) (err error) {
|
|||
//
|
||||
// Possible runtime types of the union are [TextPart], [ReasoningPart], [FilePart],
|
||||
// [ToolPart], [StepStartPart], [StepFinishPart], [SnapshotPart], [PartPatchPart],
|
||||
// [AgentPart].
|
||||
// [AgentPart], [PartRetryPart].
|
||||
func (r Part) AsUnion() PartUnion {
|
||||
return r.union
|
||||
}
|
||||
|
||||
// Union satisfied by [TextPart], [ReasoningPart], [FilePart], [ToolPart],
|
||||
// [StepStartPart], [StepFinishPart], [SnapshotPart], [PartPatchPart] or
|
||||
// [AgentPart].
|
||||
// [StepStartPart], [StepFinishPart], [SnapshotPart], [PartPatchPart], [AgentPart]
|
||||
// or [PartRetryPart].
|
||||
type PartUnion interface {
|
||||
implementsPart()
|
||||
}
|
||||
|
|
@ -1141,6 +1225,10 @@ func init() {
|
|||
TypeFilter: gjson.JSON,
|
||||
Type: reflect.TypeOf(AgentPart{}),
|
||||
},
|
||||
apijson.UnionVariant{
|
||||
TypeFilter: gjson.JSON,
|
||||
Type: reflect.TypeOf(PartRetryPart{}),
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
|
|
@ -1190,6 +1278,141 @@ func (r PartPatchPartType) IsKnown() bool {
|
|||
return false
|
||||
}
|
||||
|
||||
type PartRetryPart struct {
|
||||
ID string `json:"id,required"`
|
||||
Attempt float64 `json:"attempt,required"`
|
||||
Error PartRetryPartError `json:"error,required"`
|
||||
MessageID string `json:"messageID,required"`
|
||||
SessionID string `json:"sessionID,required"`
|
||||
Time PartRetryPartTime `json:"time,required"`
|
||||
Type PartRetryPartType `json:"type,required"`
|
||||
JSON partRetryPartJSON `json:"-"`
|
||||
}
|
||||
|
||||
// partRetryPartJSON contains the JSON metadata for the struct [PartRetryPart]
|
||||
type partRetryPartJSON struct {
|
||||
ID apijson.Field
|
||||
Attempt apijson.Field
|
||||
Error apijson.Field
|
||||
MessageID apijson.Field
|
||||
SessionID apijson.Field
|
||||
Time apijson.Field
|
||||
Type apijson.Field
|
||||
raw string
|
||||
ExtraFields map[string]apijson.Field
|
||||
}
|
||||
|
||||
func (r *PartRetryPart) UnmarshalJSON(data []byte) (err error) {
|
||||
return apijson.UnmarshalRoot(data, r)
|
||||
}
|
||||
|
||||
func (r partRetryPartJSON) RawJSON() string {
|
||||
return r.raw
|
||||
}
|
||||
|
||||
func (r PartRetryPart) implementsPart() {}
|
||||
|
||||
type PartRetryPartError struct {
|
||||
Data PartRetryPartErrorData `json:"data,required"`
|
||||
Name PartRetryPartErrorName `json:"name,required"`
|
||||
JSON partRetryPartErrorJSON `json:"-"`
|
||||
}
|
||||
|
||||
// partRetryPartErrorJSON contains the JSON metadata for the struct
|
||||
// [PartRetryPartError]
|
||||
type partRetryPartErrorJSON struct {
|
||||
Data apijson.Field
|
||||
Name apijson.Field
|
||||
raw string
|
||||
ExtraFields map[string]apijson.Field
|
||||
}
|
||||
|
||||
func (r *PartRetryPartError) UnmarshalJSON(data []byte) (err error) {
|
||||
return apijson.UnmarshalRoot(data, r)
|
||||
}
|
||||
|
||||
func (r partRetryPartErrorJSON) RawJSON() string {
|
||||
return r.raw
|
||||
}
|
||||
|
||||
type PartRetryPartErrorData struct {
|
||||
IsRetryable bool `json:"isRetryable,required"`
|
||||
Message string `json:"message,required"`
|
||||
ResponseBody string `json:"responseBody"`
|
||||
ResponseHeaders map[string]string `json:"responseHeaders"`
|
||||
StatusCode float64 `json:"statusCode"`
|
||||
JSON partRetryPartErrorDataJSON `json:"-"`
|
||||
}
|
||||
|
||||
// partRetryPartErrorDataJSON contains the JSON metadata for the struct
|
||||
// [PartRetryPartErrorData]
|
||||
type partRetryPartErrorDataJSON struct {
|
||||
IsRetryable apijson.Field
|
||||
Message apijson.Field
|
||||
ResponseBody apijson.Field
|
||||
ResponseHeaders apijson.Field
|
||||
StatusCode apijson.Field
|
||||
raw string
|
||||
ExtraFields map[string]apijson.Field
|
||||
}
|
||||
|
||||
func (r *PartRetryPartErrorData) UnmarshalJSON(data []byte) (err error) {
|
||||
return apijson.UnmarshalRoot(data, r)
|
||||
}
|
||||
|
||||
func (r partRetryPartErrorDataJSON) RawJSON() string {
|
||||
return r.raw
|
||||
}
|
||||
|
||||
type PartRetryPartErrorName string
|
||||
|
||||
const (
|
||||
PartRetryPartErrorNameAPIError PartRetryPartErrorName = "APIError"
|
||||
)
|
||||
|
||||
func (r PartRetryPartErrorName) IsKnown() bool {
|
||||
switch r {
|
||||
case PartRetryPartErrorNameAPIError:
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
type PartRetryPartTime struct {
|
||||
Created float64 `json:"created,required"`
|
||||
JSON partRetryPartTimeJSON `json:"-"`
|
||||
}
|
||||
|
||||
// partRetryPartTimeJSON contains the JSON metadata for the struct
|
||||
// [PartRetryPartTime]
|
||||
type partRetryPartTimeJSON struct {
|
||||
Created apijson.Field
|
||||
raw string
|
||||
ExtraFields map[string]apijson.Field
|
||||
}
|
||||
|
||||
func (r *PartRetryPartTime) UnmarshalJSON(data []byte) (err error) {
|
||||
return apijson.UnmarshalRoot(data, r)
|
||||
}
|
||||
|
||||
func (r partRetryPartTimeJSON) RawJSON() string {
|
||||
return r.raw
|
||||
}
|
||||
|
||||
type PartRetryPartType string
|
||||
|
||||
const (
|
||||
PartRetryPartTypeRetry PartRetryPartType = "retry"
|
||||
)
|
||||
|
||||
func (r PartRetryPartType) IsKnown() bool {
|
||||
switch r {
|
||||
case PartRetryPartTypeRetry:
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
type PartType string
|
||||
|
||||
const (
|
||||
|
|
@ -1202,11 +1425,12 @@ const (
|
|||
PartTypeSnapshot PartType = "snapshot"
|
||||
PartTypePatch PartType = "patch"
|
||||
PartTypeAgent PartType = "agent"
|
||||
PartTypeRetry PartType = "retry"
|
||||
)
|
||||
|
||||
func (r PartType) IsKnown() bool {
|
||||
switch r {
|
||||
case PartTypeText, PartTypeReasoning, PartTypeFile, PartTypeTool, PartTypeStepStart, PartTypeStepFinish, PartTypeSnapshot, PartTypePatch, PartTypeAgent:
|
||||
case PartTypeText, PartTypeReasoning, PartTypeFile, PartTypeTool, PartTypeStepStart, PartTypeStepFinish, PartTypeSnapshot, PartTypePatch, PartTypeAgent, PartTypeRetry:
|
||||
return true
|
||||
}
|
||||
return false
|
||||
|
|
@ -1284,16 +1508,17 @@ func (r ReasoningPartType) IsKnown() bool {
|
|||
}
|
||||
|
||||
type Session struct {
|
||||
ID string `json:"id,required"`
|
||||
Directory string `json:"directory,required"`
|
||||
ProjectID string `json:"projectID,required"`
|
||||
Time SessionTime `json:"time,required"`
|
||||
Title string `json:"title,required"`
|
||||
Version string `json:"version,required"`
|
||||
ParentID string `json:"parentID"`
|
||||
Revert SessionRevert `json:"revert"`
|
||||
Share SessionShare `json:"share"`
|
||||
JSON sessionJSON `json:"-"`
|
||||
ID string `json:"id,required"`
|
||||
Directory string `json:"directory,required"`
|
||||
ProjectID string `json:"projectID,required"`
|
||||
Time SessionTime `json:"time,required"`
|
||||
Title string `json:"title,required"`
|
||||
Version string `json:"version,required"`
|
||||
ParentID string `json:"parentID"`
|
||||
Revert SessionRevert `json:"revert"`
|
||||
Share SessionShare `json:"share"`
|
||||
Summary SessionSummary `json:"summary"`
|
||||
JSON sessionJSON `json:"-"`
|
||||
}
|
||||
|
||||
// sessionJSON contains the JSON metadata for the struct [Session]
|
||||
|
|
@ -1307,6 +1532,7 @@ type sessionJSON struct {
|
|||
ParentID apijson.Field
|
||||
Revert apijson.Field
|
||||
Share apijson.Field
|
||||
Summary apijson.Field
|
||||
raw string
|
||||
ExtraFields map[string]apijson.Field
|
||||
}
|
||||
|
|
@ -1389,6 +1615,55 @@ func (r sessionShareJSON) RawJSON() string {
|
|||
return r.raw
|
||||
}
|
||||
|
||||
type SessionSummary struct {
|
||||
Diffs []SessionSummaryDiff `json:"diffs,required"`
|
||||
JSON sessionSummaryJSON `json:"-"`
|
||||
}
|
||||
|
||||
// sessionSummaryJSON contains the JSON metadata for the struct [SessionSummary]
|
||||
type sessionSummaryJSON struct {
|
||||
Diffs apijson.Field
|
||||
raw string
|
||||
ExtraFields map[string]apijson.Field
|
||||
}
|
||||
|
||||
func (r *SessionSummary) UnmarshalJSON(data []byte) (err error) {
|
||||
return apijson.UnmarshalRoot(data, r)
|
||||
}
|
||||
|
||||
func (r sessionSummaryJSON) RawJSON() string {
|
||||
return r.raw
|
||||
}
|
||||
|
||||
type SessionSummaryDiff struct {
|
||||
Additions float64 `json:"additions,required"`
|
||||
After string `json:"after,required"`
|
||||
Before string `json:"before,required"`
|
||||
Deletions float64 `json:"deletions,required"`
|
||||
File string `json:"file,required"`
|
||||
JSON sessionSummaryDiffJSON `json:"-"`
|
||||
}
|
||||
|
||||
// sessionSummaryDiffJSON contains the JSON metadata for the struct
|
||||
// [SessionSummaryDiff]
|
||||
type sessionSummaryDiffJSON struct {
|
||||
Additions apijson.Field
|
||||
After apijson.Field
|
||||
Before apijson.Field
|
||||
Deletions apijson.Field
|
||||
File apijson.Field
|
||||
raw string
|
||||
ExtraFields map[string]apijson.Field
|
||||
}
|
||||
|
||||
func (r *SessionSummaryDiff) UnmarshalJSON(data []byte) (err error) {
|
||||
return apijson.UnmarshalRoot(data, r)
|
||||
}
|
||||
|
||||
func (r sessionSummaryDiffJSON) RawJSON() string {
|
||||
return r.raw
|
||||
}
|
||||
|
||||
type SnapshotPart struct {
|
||||
ID string `json:"id,required"`
|
||||
MessageID string `json:"messageID,required"`
|
||||
|
|
@ -1437,9 +1712,11 @@ type StepFinishPart struct {
|
|||
ID string `json:"id,required"`
|
||||
Cost float64 `json:"cost,required"`
|
||||
MessageID string `json:"messageID,required"`
|
||||
Reason string `json:"reason,required"`
|
||||
SessionID string `json:"sessionID,required"`
|
||||
Tokens StepFinishPartTokens `json:"tokens,required"`
|
||||
Type StepFinishPartType `json:"type,required"`
|
||||
Snapshot string `json:"snapshot"`
|
||||
JSON stepFinishPartJSON `json:"-"`
|
||||
}
|
||||
|
||||
|
|
@ -1448,9 +1725,11 @@ type stepFinishPartJSON struct {
|
|||
ID apijson.Field
|
||||
Cost apijson.Field
|
||||
MessageID apijson.Field
|
||||
Reason apijson.Field
|
||||
SessionID apijson.Field
|
||||
Tokens apijson.Field
|
||||
Type apijson.Field
|
||||
Snapshot apijson.Field
|
||||
raw string
|
||||
ExtraFields map[string]apijson.Field
|
||||
}
|
||||
|
|
@ -1534,6 +1813,7 @@ type StepStartPart struct {
|
|||
MessageID string `json:"messageID,required"`
|
||||
SessionID string `json:"sessionID,required"`
|
||||
Type StepStartPartType `json:"type,required"`
|
||||
Snapshot string `json:"snapshot"`
|
||||
JSON stepStartPartJSON `json:"-"`
|
||||
}
|
||||
|
||||
|
|
@ -1543,6 +1823,7 @@ type stepStartPartJSON struct {
|
|||
MessageID apijson.Field
|
||||
SessionID apijson.Field
|
||||
Type apijson.Field
|
||||
Snapshot apijson.Field
|
||||
raw string
|
||||
ExtraFields map[string]apijson.Field
|
||||
}
|
||||
|
|
@ -1875,16 +2156,15 @@ func (r toolPartJSON) RawJSON() string {
|
|||
func (r ToolPart) implementsPart() {}
|
||||
|
||||
type ToolPartState struct {
|
||||
// This field can have the runtime type of [map[string]interface{}].
|
||||
Input interface{} `json:"input,required"`
|
||||
Status ToolPartStateStatus `json:"status,required"`
|
||||
// This field can have the runtime type of [[]FilePart].
|
||||
Attachments interface{} `json:"attachments"`
|
||||
Error string `json:"error"`
|
||||
// This field can have the runtime type of [interface{}], [map[string]interface{}].
|
||||
Input interface{} `json:"input"`
|
||||
// This field can have the runtime type of [map[string]interface{}].
|
||||
Metadata interface{} `json:"metadata"`
|
||||
Output string `json:"output"`
|
||||
Raw string `json:"raw"`
|
||||
// This field can have the runtime type of [ToolStateRunningTime],
|
||||
// [ToolStateCompletedTime], [ToolStateErrorTime].
|
||||
Time interface{} `json:"time"`
|
||||
|
|
@ -1895,13 +2175,12 @@ type ToolPartState struct {
|
|||
|
||||
// toolPartStateJSON contains the JSON metadata for the struct [ToolPartState]
|
||||
type toolPartStateJSON struct {
|
||||
Input apijson.Field
|
||||
Status apijson.Field
|
||||
Attachments apijson.Field
|
||||
Error apijson.Field
|
||||
Input apijson.Field
|
||||
Metadata apijson.Field
|
||||
Output apijson.Field
|
||||
Raw apijson.Field
|
||||
Time apijson.Field
|
||||
Title apijson.Field
|
||||
raw string
|
||||
|
|
@ -2132,8 +2411,6 @@ func (r toolStateErrorTimeJSON) RawJSON() string {
|
|||
}
|
||||
|
||||
type ToolStatePending struct {
|
||||
Input map[string]interface{} `json:"input,required"`
|
||||
Raw string `json:"raw,required"`
|
||||
Status ToolStatePendingStatus `json:"status,required"`
|
||||
JSON toolStatePendingJSON `json:"-"`
|
||||
}
|
||||
|
|
@ -2141,8 +2418,6 @@ type ToolStatePending struct {
|
|||
// toolStatePendingJSON contains the JSON metadata for the struct
|
||||
// [ToolStatePending]
|
||||
type toolStatePendingJSON struct {
|
||||
Input apijson.Field
|
||||
Raw apijson.Field
|
||||
Status apijson.Field
|
||||
raw string
|
||||
ExtraFields map[string]apijson.Field
|
||||
|
|
@ -2173,7 +2448,7 @@ func (r ToolStatePendingStatus) IsKnown() bool {
|
|||
}
|
||||
|
||||
type ToolStateRunning struct {
|
||||
Input map[string]interface{} `json:"input,required"`
|
||||
Input interface{} `json:"input,required"`
|
||||
Status ToolStateRunningStatus `json:"status,required"`
|
||||
Time ToolStateRunningTime `json:"time,required"`
|
||||
Metadata map[string]interface{} `json:"metadata"`
|
||||
|
|
@ -2239,11 +2514,12 @@ func (r toolStateRunningTimeJSON) RawJSON() string {
|
|||
}
|
||||
|
||||
type UserMessage struct {
|
||||
ID string `json:"id,required"`
|
||||
Role UserMessageRole `json:"role,required"`
|
||||
SessionID string `json:"sessionID,required"`
|
||||
Time UserMessageTime `json:"time,required"`
|
||||
JSON userMessageJSON `json:"-"`
|
||||
ID string `json:"id,required"`
|
||||
Role UserMessageRole `json:"role,required"`
|
||||
SessionID string `json:"sessionID,required"`
|
||||
Time UserMessageTime `json:"time,required"`
|
||||
Summary UserMessageSummary `json:"summary"`
|
||||
JSON userMessageJSON `json:"-"`
|
||||
}
|
||||
|
||||
// userMessageJSON contains the JSON metadata for the struct [UserMessage]
|
||||
|
|
@ -2252,6 +2528,7 @@ type userMessageJSON struct {
|
|||
Role apijson.Field
|
||||
SessionID apijson.Field
|
||||
Time apijson.Field
|
||||
Summary apijson.Field
|
||||
raw string
|
||||
ExtraFields map[string]apijson.Field
|
||||
}
|
||||
|
|
@ -2300,6 +2577,60 @@ func (r userMessageTimeJSON) RawJSON() string {
|
|||
return r.raw
|
||||
}
|
||||
|
||||
type UserMessageSummary struct {
|
||||
Diffs []UserMessageSummaryDiff `json:"diffs,required"`
|
||||
Body string `json:"body"`
|
||||
Title string `json:"title"`
|
||||
JSON userMessageSummaryJSON `json:"-"`
|
||||
}
|
||||
|
||||
// userMessageSummaryJSON contains the JSON metadata for the struct
|
||||
// [UserMessageSummary]
|
||||
type userMessageSummaryJSON struct {
|
||||
Diffs apijson.Field
|
||||
Body apijson.Field
|
||||
Title apijson.Field
|
||||
raw string
|
||||
ExtraFields map[string]apijson.Field
|
||||
}
|
||||
|
||||
func (r *UserMessageSummary) UnmarshalJSON(data []byte) (err error) {
|
||||
return apijson.UnmarshalRoot(data, r)
|
||||
}
|
||||
|
||||
func (r userMessageSummaryJSON) RawJSON() string {
|
||||
return r.raw
|
||||
}
|
||||
|
||||
type UserMessageSummaryDiff struct {
|
||||
Additions float64 `json:"additions,required"`
|
||||
After string `json:"after,required"`
|
||||
Before string `json:"before,required"`
|
||||
Deletions float64 `json:"deletions,required"`
|
||||
File string `json:"file,required"`
|
||||
JSON userMessageSummaryDiffJSON `json:"-"`
|
||||
}
|
||||
|
||||
// userMessageSummaryDiffJSON contains the JSON metadata for the struct
|
||||
// [UserMessageSummaryDiff]
|
||||
type userMessageSummaryDiffJSON struct {
|
||||
Additions apijson.Field
|
||||
After apijson.Field
|
||||
Before apijson.Field
|
||||
Deletions apijson.Field
|
||||
File apijson.Field
|
||||
raw string
|
||||
ExtraFields map[string]apijson.Field
|
||||
}
|
||||
|
||||
func (r *UserMessageSummaryDiff) UnmarshalJSON(data []byte) (err error) {
|
||||
return apijson.UnmarshalRoot(data, r)
|
||||
}
|
||||
|
||||
func (r userMessageSummaryDiffJSON) RawJSON() string {
|
||||
return r.raw
|
||||
}
|
||||
|
||||
type SessionCommandResponse struct {
|
||||
Info AssistantMessage `json:"info,required"`
|
||||
Parts []Part `json:"parts,required"`
|
||||
|
|
@ -2557,6 +2888,7 @@ type SessionPromptParams struct {
|
|||
Agent param.Field[string] `json:"agent"`
|
||||
MessageID param.Field[string] `json:"messageID"`
|
||||
Model param.Field[SessionPromptParamsModel] `json:"model"`
|
||||
NoReply param.Field[bool] `json:"noReply"`
|
||||
System param.Field[string] `json:"system"`
|
||||
Tools param.Field[map[string]bool] `json:"tools"`
|
||||
}
|
||||
|
|
|
|||
|
|
@ -361,7 +361,8 @@ func TestSessionPromptWithOptionalParams(t *testing.T) {
|
|||
ModelID: opencode.F("modelID"),
|
||||
ProviderID: opencode.F("providerID"),
|
||||
}),
|
||||
System: opencode.F("system"),
|
||||
NoReply: opencode.F(true),
|
||||
System: opencode.F("system"),
|
||||
Tools: opencode.F(map[string]bool{
|
||||
"foo": true,
|
||||
}),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue