mirror of
https://github.com/aljazceru/opencode.git
synced 2025-12-23 10:44:21 +01:00
better handling of aborting sessions
This commit is contained in:
@@ -52,10 +52,10 @@ type EventListResponse struct {
|
||||
// [EventListResponseEventPermissionUpdatedProperties],
|
||||
// [EventListResponseEventFileEditedProperties],
|
||||
// [EventListResponseEventInstallationUpdatedProperties],
|
||||
// [EventListResponseEventStorageWriteProperties],
|
||||
// [EventListResponseEventMessageUpdatedProperties],
|
||||
// [EventListResponseEventMessageRemovedProperties],
|
||||
// [EventListResponseEventMessagePartUpdatedProperties],
|
||||
// [EventListResponseEventStorageWriteProperties],
|
||||
// [EventListResponseEventSessionUpdatedProperties],
|
||||
// [EventListResponseEventSessionDeletedProperties],
|
||||
// [EventListResponseEventSessionIdleProperties],
|
||||
@@ -96,11 +96,11 @@ func (r *EventListResponse) UnmarshalJSON(data []byte) (err error) {
|
||||
// [EventListResponseEventLspClientDiagnostics],
|
||||
// [EventListResponseEventPermissionUpdated], [EventListResponseEventFileEdited],
|
||||
// [EventListResponseEventInstallationUpdated],
|
||||
// [EventListResponseEventStorageWrite], [EventListResponseEventMessageUpdated],
|
||||
// [EventListResponseEventMessageRemoved],
|
||||
// [EventListResponseEventMessageUpdated], [EventListResponseEventMessageRemoved],
|
||||
// [EventListResponseEventMessagePartUpdated],
|
||||
// [EventListResponseEventSessionUpdated], [EventListResponseEventSessionDeleted],
|
||||
// [EventListResponseEventSessionIdle], [EventListResponseEventSessionError],
|
||||
// [EventListResponseEventStorageWrite], [EventListResponseEventSessionUpdated],
|
||||
// [EventListResponseEventSessionDeleted], [EventListResponseEventSessionIdle],
|
||||
// [EventListResponseEventSessionError],
|
||||
// [EventListResponseEventFileWatcherUpdated].
|
||||
func (r EventListResponse) AsUnion() EventListResponseUnion {
|
||||
return r.union
|
||||
@@ -109,11 +109,11 @@ func (r EventListResponse) AsUnion() EventListResponseUnion {
|
||||
// Union satisfied by [EventListResponseEventLspClientDiagnostics],
|
||||
// [EventListResponseEventPermissionUpdated], [EventListResponseEventFileEdited],
|
||||
// [EventListResponseEventInstallationUpdated],
|
||||
// [EventListResponseEventStorageWrite], [EventListResponseEventMessageUpdated],
|
||||
// [EventListResponseEventMessageRemoved],
|
||||
// [EventListResponseEventMessageUpdated], [EventListResponseEventMessageRemoved],
|
||||
// [EventListResponseEventMessagePartUpdated],
|
||||
// [EventListResponseEventSessionUpdated], [EventListResponseEventSessionDeleted],
|
||||
// [EventListResponseEventSessionIdle], [EventListResponseEventSessionError] or
|
||||
// [EventListResponseEventStorageWrite], [EventListResponseEventSessionUpdated],
|
||||
// [EventListResponseEventSessionDeleted], [EventListResponseEventSessionIdle],
|
||||
// [EventListResponseEventSessionError] or
|
||||
// [EventListResponseEventFileWatcherUpdated].
|
||||
type EventListResponseUnion interface {
|
||||
implementsEventListResponse()
|
||||
@@ -143,11 +143,6 @@ func init() {
|
||||
Type: reflect.TypeOf(EventListResponseEventInstallationUpdated{}),
|
||||
DiscriminatorValue: "installation.updated",
|
||||
},
|
||||
apijson.UnionVariant{
|
||||
TypeFilter: gjson.JSON,
|
||||
Type: reflect.TypeOf(EventListResponseEventStorageWrite{}),
|
||||
DiscriminatorValue: "storage.write",
|
||||
},
|
||||
apijson.UnionVariant{
|
||||
TypeFilter: gjson.JSON,
|
||||
Type: reflect.TypeOf(EventListResponseEventMessageUpdated{}),
|
||||
@@ -163,6 +158,11 @@ func init() {
|
||||
Type: reflect.TypeOf(EventListResponseEventMessagePartUpdated{}),
|
||||
DiscriminatorValue: "message.part.updated",
|
||||
},
|
||||
apijson.UnionVariant{
|
||||
TypeFilter: gjson.JSON,
|
||||
Type: reflect.TypeOf(EventListResponseEventStorageWrite{}),
|
||||
DiscriminatorValue: "storage.write",
|
||||
},
|
||||
apijson.UnionVariant{
|
||||
TypeFilter: gjson.JSON,
|
||||
Type: reflect.TypeOf(EventListResponseEventSessionUpdated{}),
|
||||
@@ -462,68 +462,6 @@ func (r EventListResponseEventInstallationUpdatedType) IsKnown() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
type EventListResponseEventStorageWrite struct {
|
||||
Properties EventListResponseEventStorageWriteProperties `json:"properties,required"`
|
||||
Type EventListResponseEventStorageWriteType `json:"type,required"`
|
||||
JSON eventListResponseEventStorageWriteJSON `json:"-"`
|
||||
}
|
||||
|
||||
// eventListResponseEventStorageWriteJSON contains the JSON metadata for the struct
|
||||
// [EventListResponseEventStorageWrite]
|
||||
type eventListResponseEventStorageWriteJSON struct {
|
||||
Properties apijson.Field
|
||||
Type apijson.Field
|
||||
raw string
|
||||
ExtraFields map[string]apijson.Field
|
||||
}
|
||||
|
||||
func (r *EventListResponseEventStorageWrite) UnmarshalJSON(data []byte) (err error) {
|
||||
return apijson.UnmarshalRoot(data, r)
|
||||
}
|
||||
|
||||
func (r eventListResponseEventStorageWriteJSON) RawJSON() string {
|
||||
return r.raw
|
||||
}
|
||||
|
||||
func (r EventListResponseEventStorageWrite) implementsEventListResponse() {}
|
||||
|
||||
type EventListResponseEventStorageWriteProperties struct {
|
||||
Key string `json:"key,required"`
|
||||
Content interface{} `json:"content"`
|
||||
JSON eventListResponseEventStorageWritePropertiesJSON `json:"-"`
|
||||
}
|
||||
|
||||
// eventListResponseEventStorageWritePropertiesJSON contains the JSON metadata for
|
||||
// the struct [EventListResponseEventStorageWriteProperties]
|
||||
type eventListResponseEventStorageWritePropertiesJSON struct {
|
||||
Key apijson.Field
|
||||
Content apijson.Field
|
||||
raw string
|
||||
ExtraFields map[string]apijson.Field
|
||||
}
|
||||
|
||||
func (r *EventListResponseEventStorageWriteProperties) UnmarshalJSON(data []byte) (err error) {
|
||||
return apijson.UnmarshalRoot(data, r)
|
||||
}
|
||||
|
||||
func (r eventListResponseEventStorageWritePropertiesJSON) RawJSON() string {
|
||||
return r.raw
|
||||
}
|
||||
|
||||
type EventListResponseEventStorageWriteType string
|
||||
|
||||
const (
|
||||
EventListResponseEventStorageWriteTypeStorageWrite EventListResponseEventStorageWriteType = "storage.write"
|
||||
)
|
||||
|
||||
func (r EventListResponseEventStorageWriteType) IsKnown() bool {
|
||||
switch r {
|
||||
case EventListResponseEventStorageWriteTypeStorageWrite:
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
type EventListResponseEventMessageUpdated struct {
|
||||
Properties EventListResponseEventMessageUpdatedProperties `json:"properties,required"`
|
||||
Type EventListResponseEventMessageUpdatedType `json:"type,required"`
|
||||
@@ -710,6 +648,68 @@ func (r EventListResponseEventMessagePartUpdatedType) IsKnown() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
type EventListResponseEventStorageWrite struct {
|
||||
Properties EventListResponseEventStorageWriteProperties `json:"properties,required"`
|
||||
Type EventListResponseEventStorageWriteType `json:"type,required"`
|
||||
JSON eventListResponseEventStorageWriteJSON `json:"-"`
|
||||
}
|
||||
|
||||
// eventListResponseEventStorageWriteJSON contains the JSON metadata for the struct
|
||||
// [EventListResponseEventStorageWrite]
|
||||
type eventListResponseEventStorageWriteJSON struct {
|
||||
Properties apijson.Field
|
||||
Type apijson.Field
|
||||
raw string
|
||||
ExtraFields map[string]apijson.Field
|
||||
}
|
||||
|
||||
func (r *EventListResponseEventStorageWrite) UnmarshalJSON(data []byte) (err error) {
|
||||
return apijson.UnmarshalRoot(data, r)
|
||||
}
|
||||
|
||||
func (r eventListResponseEventStorageWriteJSON) RawJSON() string {
|
||||
return r.raw
|
||||
}
|
||||
|
||||
func (r EventListResponseEventStorageWrite) implementsEventListResponse() {}
|
||||
|
||||
type EventListResponseEventStorageWriteProperties struct {
|
||||
Key string `json:"key,required"`
|
||||
Content interface{} `json:"content"`
|
||||
JSON eventListResponseEventStorageWritePropertiesJSON `json:"-"`
|
||||
}
|
||||
|
||||
// eventListResponseEventStorageWritePropertiesJSON contains the JSON metadata for
|
||||
// the struct [EventListResponseEventStorageWriteProperties]
|
||||
type eventListResponseEventStorageWritePropertiesJSON struct {
|
||||
Key apijson.Field
|
||||
Content apijson.Field
|
||||
raw string
|
||||
ExtraFields map[string]apijson.Field
|
||||
}
|
||||
|
||||
func (r *EventListResponseEventStorageWriteProperties) UnmarshalJSON(data []byte) (err error) {
|
||||
return apijson.UnmarshalRoot(data, r)
|
||||
}
|
||||
|
||||
func (r eventListResponseEventStorageWritePropertiesJSON) RawJSON() string {
|
||||
return r.raw
|
||||
}
|
||||
|
||||
type EventListResponseEventStorageWriteType string
|
||||
|
||||
const (
|
||||
EventListResponseEventStorageWriteTypeStorageWrite EventListResponseEventStorageWriteType = "storage.write"
|
||||
)
|
||||
|
||||
func (r EventListResponseEventStorageWriteType) IsKnown() bool {
|
||||
switch r {
|
||||
case EventListResponseEventStorageWriteTypeStorageWrite:
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
type EventListResponseEventSessionUpdated struct {
|
||||
Properties EventListResponseEventSessionUpdatedProperties `json:"properties,required"`
|
||||
Type EventListResponseEventSessionUpdatedType `json:"type,required"`
|
||||
@@ -972,13 +972,15 @@ func (r *EventListResponseEventSessionErrorPropertiesError) UnmarshalJSON(data [
|
||||
//
|
||||
// Possible runtime types of the union are [shared.ProviderAuthError],
|
||||
// [shared.UnknownError],
|
||||
// [EventListResponseEventSessionErrorPropertiesErrorMessageOutputLengthError].
|
||||
// [EventListResponseEventSessionErrorPropertiesErrorMessageOutputLengthError],
|
||||
// [shared.MessageAbortedError].
|
||||
func (r EventListResponseEventSessionErrorPropertiesError) AsUnion() EventListResponseEventSessionErrorPropertiesErrorUnion {
|
||||
return r.union
|
||||
}
|
||||
|
||||
// Union satisfied by [shared.ProviderAuthError], [shared.UnknownError] or
|
||||
// [EventListResponseEventSessionErrorPropertiesErrorMessageOutputLengthError].
|
||||
// Union satisfied by [shared.ProviderAuthError], [shared.UnknownError],
|
||||
// [EventListResponseEventSessionErrorPropertiesErrorMessageOutputLengthError] or
|
||||
// [shared.MessageAbortedError].
|
||||
type EventListResponseEventSessionErrorPropertiesErrorUnion interface {
|
||||
ImplementsEventListResponseEventSessionErrorPropertiesError()
|
||||
}
|
||||
@@ -1002,6 +1004,11 @@ func init() {
|
||||
Type: reflect.TypeOf(EventListResponseEventSessionErrorPropertiesErrorMessageOutputLengthError{}),
|
||||
DiscriminatorValue: "MessageOutputLengthError",
|
||||
},
|
||||
apijson.UnionVariant{
|
||||
TypeFilter: gjson.JSON,
|
||||
Type: reflect.TypeOf(shared.MessageAbortedError{}),
|
||||
DiscriminatorValue: "MessageAbortedError",
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
@@ -1052,11 +1059,12 @@ const (
|
||||
EventListResponseEventSessionErrorPropertiesErrorNameProviderAuthError EventListResponseEventSessionErrorPropertiesErrorName = "ProviderAuthError"
|
||||
EventListResponseEventSessionErrorPropertiesErrorNameUnknownError EventListResponseEventSessionErrorPropertiesErrorName = "UnknownError"
|
||||
EventListResponseEventSessionErrorPropertiesErrorNameMessageOutputLengthError EventListResponseEventSessionErrorPropertiesErrorName = "MessageOutputLengthError"
|
||||
EventListResponseEventSessionErrorPropertiesErrorNameMessageAbortedError EventListResponseEventSessionErrorPropertiesErrorName = "MessageAbortedError"
|
||||
)
|
||||
|
||||
func (r EventListResponseEventSessionErrorPropertiesErrorName) IsKnown() bool {
|
||||
switch r {
|
||||
case EventListResponseEventSessionErrorPropertiesErrorNameProviderAuthError, EventListResponseEventSessionErrorPropertiesErrorNameUnknownError, EventListResponseEventSessionErrorPropertiesErrorNameMessageOutputLengthError:
|
||||
case EventListResponseEventSessionErrorPropertiesErrorNameProviderAuthError, EventListResponseEventSessionErrorPropertiesErrorNameUnknownError, EventListResponseEventSessionErrorPropertiesErrorNameMessageOutputLengthError, EventListResponseEventSessionErrorPropertiesErrorNameMessageAbortedError:
|
||||
return true
|
||||
}
|
||||
return false
|
||||
@@ -1160,10 +1168,10 @@ const (
|
||||
EventListResponseTypePermissionUpdated EventListResponseType = "permission.updated"
|
||||
EventListResponseTypeFileEdited EventListResponseType = "file.edited"
|
||||
EventListResponseTypeInstallationUpdated EventListResponseType = "installation.updated"
|
||||
EventListResponseTypeStorageWrite EventListResponseType = "storage.write"
|
||||
EventListResponseTypeMessageUpdated EventListResponseType = "message.updated"
|
||||
EventListResponseTypeMessageRemoved EventListResponseType = "message.removed"
|
||||
EventListResponseTypeMessagePartUpdated EventListResponseType = "message.part.updated"
|
||||
EventListResponseTypeStorageWrite EventListResponseType = "storage.write"
|
||||
EventListResponseTypeSessionUpdated EventListResponseType = "session.updated"
|
||||
EventListResponseTypeSessionDeleted EventListResponseType = "session.deleted"
|
||||
EventListResponseTypeSessionIdle EventListResponseType = "session.idle"
|
||||
@@ -1173,7 +1181,7 @@ const (
|
||||
|
||||
func (r EventListResponseType) IsKnown() bool {
|
||||
switch r {
|
||||
case EventListResponseTypeLspClientDiagnostics, EventListResponseTypePermissionUpdated, EventListResponseTypeFileEdited, EventListResponseTypeInstallationUpdated, EventListResponseTypeStorageWrite, EventListResponseTypeMessageUpdated, EventListResponseTypeMessageRemoved, EventListResponseTypeMessagePartUpdated, EventListResponseTypeSessionUpdated, EventListResponseTypeSessionDeleted, EventListResponseTypeSessionIdle, EventListResponseTypeSessionError, EventListResponseTypeFileWatcherUpdated:
|
||||
case EventListResponseTypeLspClientDiagnostics, EventListResponseTypePermissionUpdated, EventListResponseTypeFileEdited, EventListResponseTypeInstallationUpdated, EventListResponseTypeMessageUpdated, EventListResponseTypeMessageRemoved, EventListResponseTypeMessagePartUpdated, EventListResponseTypeStorageWrite, EventListResponseTypeSessionUpdated, EventListResponseTypeSessionDeleted, EventListResponseTypeSessionIdle, EventListResponseTypeSessionError, EventListResponseTypeFileWatcherUpdated:
|
||||
return true
|
||||
}
|
||||
return false
|
||||
|
||||
Reference in New Issue
Block a user