diff options
| author | Dax Raad <[email protected]> | 2025-08-03 17:08:42 -0400 |
|---|---|---|
| committer | Dax Raad <[email protected]> | 2025-08-03 17:09:30 -0400 |
| commit | a50bef69139976e9ce95c71a2757afcf835c34ec (patch) | |
| tree | 0d37af8ba6e7219d0067e83548e55c9f86841c4c /packages/sdk/go | |
| parent | ed397c5057c5145325a6335858160e0af3b8fad3 (diff) | |
| download | opencode-a50bef69139976e9ce95c71a2757afcf835c34ec.tar.gz opencode-a50bef69139976e9ce95c71a2757afcf835c34ec.zip | |
ignore: cleanup
Diffstat (limited to 'packages/sdk/go')
| -rw-r--r-- | packages/sdk/go/.stats.yml | 4 | ||||
| -rw-r--r-- | packages/sdk/go/app.go | 2 | ||||
| -rw-r--r-- | packages/sdk/go/config.go | 173 | ||||
| -rw-r--r-- | packages/sdk/go/event.go | 244 |
4 files changed, 297 insertions, 126 deletions
diff --git a/packages/sdk/go/.stats.yml b/packages/sdk/go/.stats.yml index 7b29797cd..013bb9ac2 100644 --- a/packages/sdk/go/.stats.yml +++ b/packages/sdk/go/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 34 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/opencode%2Fopencode-2ebd9d5478864042a2e01b4995f42acbc39069fa7fcccd1c2e567366ee6c243d.yml -openapi_spec_hash: 2a34451b288ea30af1cb61332c417c2a +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/opencode%2Fopencode-52fd0b61e84fdc1cdd31ec12e1600510e9dd2f9d4fb20c2315b4975cb763ee98.yml +openapi_spec_hash: e851b8d5a2412f5fc9be82ab88ebdfde config_hash: 11a6f0803eb407367c3f677d3e524c37 diff --git a/packages/sdk/go/app.go b/packages/sdk/go/app.go index 479011a23..0a7d14e72 100644 --- a/packages/sdk/go/app.go +++ b/packages/sdk/go/app.go @@ -151,6 +151,7 @@ type Mode struct { Model ModeModel `json:"model"` Prompt string `json:"prompt"` Temperature float64 `json:"temperature"` + TopP float64 `json:"topP"` JSON modeJSON `json:"-"` } @@ -161,6 +162,7 @@ type modeJSON struct { Model apijson.Field Prompt apijson.Field Temperature apijson.Field + TopP apijson.Field raw string ExtraFields map[string]apijson.Field } diff --git a/packages/sdk/go/config.go b/packages/sdk/go/config.go index 5fcfd1edc..77b1b7602 100644 --- a/packages/sdk/go/config.go +++ b/packages/sdk/go/config.go @@ -51,14 +51,16 @@ type Config struct { // Automatically update to the latest version Autoupdate bool `json:"autoupdate"` // Disable providers that are loaded automatically - DisabledProviders []string `json:"disabled_providers"` - Experimental ConfigExperimental `json:"experimental"` + DisabledProviders []string `json:"disabled_providers"` + Experimental ConfigExperimental `json:"experimental"` + Formatter map[string]ConfigFormatter `json:"formatter"` // Additional instruction files or patterns to include Instructions []string `json:"instructions"` // Custom keybind configurations Keybinds KeybindsConfig `json:"keybinds"` // @deprecated Always uses stretch layout. - Layout ConfigLayout `json:"layout"` + Layout ConfigLayout `json:"layout"` + Lsp map[string]ConfigLsp `json:"lsp"` // MCP (Model Context Protocol) server configurations Mcp map[string]ConfigMcp `json:"mcp"` // Modes configuration, see https://opencode.ai/docs/modes @@ -66,6 +68,7 @@ type Config struct { // Model to use in the format of provider/model, eg anthropic/claude-2 Model string `json:"model"` Permission ConfigPermission `json:"permission"` + Plugin []string `json:"plugin"` // Custom provider configurations and model overrides Provider map[string]ConfigProvider `json:"provider"` // Control sharing behavior:'manual' allows manual sharing via commands, 'auto' @@ -89,13 +92,16 @@ type configJSON struct { Autoupdate apijson.Field DisabledProviders apijson.Field Experimental apijson.Field + Formatter apijson.Field Instructions apijson.Field Keybinds apijson.Field Layout apijson.Field + Lsp apijson.Field Mcp apijson.Field Mode apijson.Field Model apijson.Field Permission apijson.Field + Plugin apijson.Field Provider apijson.Field Share apijson.Field SmallModel apijson.Field @@ -247,6 +253,32 @@ func (r configExperimentalHookSessionCompletedJSON) RawJSON() string { return r.raw } +type ConfigFormatter struct { + Command []string `json:"command"` + Disabled bool `json:"disabled"` + Environment map[string]string `json:"environment"` + Extensions []string `json:"extensions"` + JSON configFormatterJSON `json:"-"` +} + +// configFormatterJSON contains the JSON metadata for the struct [ConfigFormatter] +type configFormatterJSON struct { + Command apijson.Field + Disabled apijson.Field + Environment apijson.Field + Extensions apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ConfigFormatter) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r configFormatterJSON) RawJSON() string { + return r.raw +} + // @deprecated Always uses stretch layout. type ConfigLayout string @@ -263,6 +295,139 @@ func (r ConfigLayout) IsKnown() bool { return false } +type ConfigLsp struct { + // This field can have the runtime type of [[]string]. + Command interface{} `json:"command"` + Disabled bool `json:"disabled"` + // This field can have the runtime type of [map[string]string]. + Env interface{} `json:"env"` + // This field can have the runtime type of [[]string]. + Extensions interface{} `json:"extensions"` + // This field can have the runtime type of [map[string]interface{}]. + Initialization interface{} `json:"initialization"` + JSON configLspJSON `json:"-"` + union ConfigLspUnion +} + +// configLspJSON contains the JSON metadata for the struct [ConfigLsp] +type configLspJSON struct { + Command apijson.Field + Disabled apijson.Field + Env apijson.Field + Extensions apijson.Field + Initialization apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r configLspJSON) RawJSON() string { + return r.raw +} + +func (r *ConfigLsp) UnmarshalJSON(data []byte) (err error) { + *r = ConfigLsp{} + err = apijson.UnmarshalRoot(data, &r.union) + if err != nil { + return err + } + return apijson.Port(r.union, &r) +} + +// AsUnion returns a [ConfigLspUnion] interface which you can cast to the specific +// types for more type safety. +// +// Possible runtime types of the union are [ConfigLspDisabled], [ConfigLspObject]. +func (r ConfigLsp) AsUnion() ConfigLspUnion { + return r.union +} + +// Union satisfied by [ConfigLspDisabled] or [ConfigLspObject]. +type ConfigLspUnion interface { + implementsConfigLsp() +} + +func init() { + apijson.RegisterUnion( + reflect.TypeOf((*ConfigLspUnion)(nil)).Elem(), + "", + apijson.UnionVariant{ + TypeFilter: gjson.JSON, + Type: reflect.TypeOf(ConfigLspDisabled{}), + }, + apijson.UnionVariant{ + TypeFilter: gjson.JSON, + Type: reflect.TypeOf(ConfigLspObject{}), + }, + ) +} + +type ConfigLspDisabled struct { + Disabled ConfigLspDisabledDisabled `json:"disabled,required"` + JSON configLspDisabledJSON `json:"-"` +} + +// configLspDisabledJSON contains the JSON metadata for the struct +// [ConfigLspDisabled] +type configLspDisabledJSON struct { + Disabled apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ConfigLspDisabled) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r configLspDisabledJSON) RawJSON() string { + return r.raw +} + +func (r ConfigLspDisabled) implementsConfigLsp() {} + +type ConfigLspDisabledDisabled bool + +const ( + ConfigLspDisabledDisabledTrue ConfigLspDisabledDisabled = true +) + +func (r ConfigLspDisabledDisabled) IsKnown() bool { + switch r { + case ConfigLspDisabledDisabledTrue: + return true + } + return false +} + +type ConfigLspObject struct { + Command []string `json:"command,required"` + Disabled bool `json:"disabled"` + Env map[string]string `json:"env"` + Extensions []string `json:"extensions"` + Initialization map[string]interface{} `json:"initialization"` + JSON configLspObjectJSON `json:"-"` +} + +// configLspObjectJSON contains the JSON metadata for the struct [ConfigLspObject] +type configLspObjectJSON struct { + Command apijson.Field + Disabled apijson.Field + Env apijson.Field + Extensions apijson.Field + Initialization apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *ConfigLspObject) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r configLspObjectJSON) RawJSON() string { + return r.raw +} + +func (r ConfigLspObject) implementsConfigLsp() {} + type ConfigMcp struct { // Type of MCP server connection Type ConfigMcpType `json:"type,required"` @@ -864,6 +1029,7 @@ type ModeConfig struct { Prompt string `json:"prompt"` Temperature float64 `json:"temperature"` Tools map[string]bool `json:"tools"` + TopP float64 `json:"top_p"` JSON modeConfigJSON `json:"-"` } @@ -874,6 +1040,7 @@ type modeConfigJSON struct { Prompt apijson.Field Temperature apijson.Field Tools apijson.Field + TopP apijson.Field raw string ExtraFields map[string]apijson.Field } diff --git a/packages/sdk/go/event.go b/packages/sdk/go/event.go index f16270806..9823cdc58 100644 --- a/packages/sdk/go/event.go +++ b/packages/sdk/go/event.go @@ -54,13 +54,13 @@ type EventListResponse struct { // [EventListResponseEventMessageRemovedProperties], // [EventListResponseEventMessagePartUpdatedProperties], // [EventListResponseEventMessagePartRemovedProperties], - // [EventListResponseEventStorageWriteProperties], [Permission], + // [EventListResponseEventStorageWriteProperties], + // [EventListResponseEventFileEditedProperties], [interface{}], [Permission], // [EventListResponseEventPermissionRepliedProperties], - // [EventListResponseEventFileEditedProperties], // [EventListResponseEventSessionUpdatedProperties], // [EventListResponseEventSessionDeletedProperties], // [EventListResponseEventSessionIdleProperties], - // [EventListResponseEventSessionErrorProperties], [interface{}], + // [EventListResponseEventSessionErrorProperties], // [EventListResponseEventFileWatcherUpdatedProperties], // [EventListResponseEventIdeInstalledProperties]. Properties interface{} `json:"properties,required"` @@ -100,11 +100,12 @@ func (r *EventListResponse) UnmarshalJSON(data []byte) (err error) { // [EventListResponseEventMessageUpdated], [EventListResponseEventMessageRemoved], // [EventListResponseEventMessagePartUpdated], // [EventListResponseEventMessagePartRemoved], -// [EventListResponseEventStorageWrite], [EventListResponseEventPermissionUpdated], -// [EventListResponseEventPermissionReplied], [EventListResponseEventFileEdited], +// [EventListResponseEventStorageWrite], [EventListResponseEventFileEdited], +// [EventListResponseEventServerConnected], +// [EventListResponseEventPermissionUpdated], +// [EventListResponseEventPermissionReplied], // [EventListResponseEventSessionUpdated], [EventListResponseEventSessionDeleted], // [EventListResponseEventSessionIdle], [EventListResponseEventSessionError], -// [EventListResponseEventServerConnected], // [EventListResponseEventFileWatcherUpdated], // [EventListResponseEventIdeInstalled]. func (r EventListResponse) AsUnion() EventListResponseUnion { @@ -116,11 +117,12 @@ func (r EventListResponse) AsUnion() EventListResponseUnion { // [EventListResponseEventMessageUpdated], [EventListResponseEventMessageRemoved], // [EventListResponseEventMessagePartUpdated], // [EventListResponseEventMessagePartRemoved], -// [EventListResponseEventStorageWrite], [EventListResponseEventPermissionUpdated], -// [EventListResponseEventPermissionReplied], [EventListResponseEventFileEdited], +// [EventListResponseEventStorageWrite], [EventListResponseEventFileEdited], +// [EventListResponseEventServerConnected], +// [EventListResponseEventPermissionUpdated], +// [EventListResponseEventPermissionReplied], // [EventListResponseEventSessionUpdated], [EventListResponseEventSessionDeleted], // [EventListResponseEventSessionIdle], [EventListResponseEventSessionError], -// [EventListResponseEventServerConnected], // [EventListResponseEventFileWatcherUpdated] or // [EventListResponseEventIdeInstalled]. type EventListResponseUnion interface { @@ -168,6 +170,16 @@ func init() { }, apijson.UnionVariant{ TypeFilter: gjson.JSON, + Type: reflect.TypeOf(EventListResponseEventFileEdited{}), + DiscriminatorValue: "file.edited", + }, + apijson.UnionVariant{ + TypeFilter: gjson.JSON, + Type: reflect.TypeOf(EventListResponseEventServerConnected{}), + DiscriminatorValue: "server.connected", + }, + apijson.UnionVariant{ + TypeFilter: gjson.JSON, Type: reflect.TypeOf(EventListResponseEventPermissionUpdated{}), DiscriminatorValue: "permission.updated", }, @@ -178,11 +190,6 @@ func init() { }, apijson.UnionVariant{ TypeFilter: gjson.JSON, - Type: reflect.TypeOf(EventListResponseEventFileEdited{}), - DiscriminatorValue: "file.edited", - }, - apijson.UnionVariant{ - TypeFilter: gjson.JSON, Type: reflect.TypeOf(EventListResponseEventSessionUpdated{}), DiscriminatorValue: "session.updated", }, @@ -203,11 +210,6 @@ func init() { }, apijson.UnionVariant{ TypeFilter: gjson.JSON, - Type: reflect.TypeOf(EventListResponseEventServerConnected{}), - DiscriminatorValue: "server.connected", - }, - apijson.UnionVariant{ - TypeFilter: gjson.JSON, Type: reflect.TypeOf(EventListResponseEventFileWatcherUpdated{}), DiscriminatorValue: "file.watcher.updated", }, @@ -649,6 +651,105 @@ func (r EventListResponseEventStorageWriteType) IsKnown() bool { return false } +type EventListResponseEventFileEdited struct { + Properties EventListResponseEventFileEditedProperties `json:"properties,required"` + Type EventListResponseEventFileEditedType `json:"type,required"` + JSON eventListResponseEventFileEditedJSON `json:"-"` +} + +// eventListResponseEventFileEditedJSON contains the JSON metadata for the struct +// [EventListResponseEventFileEdited] +type eventListResponseEventFileEditedJSON struct { + Properties apijson.Field + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *EventListResponseEventFileEdited) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r eventListResponseEventFileEditedJSON) RawJSON() string { + return r.raw +} + +func (r EventListResponseEventFileEdited) implementsEventListResponse() {} + +type EventListResponseEventFileEditedProperties struct { + File string `json:"file,required"` + JSON eventListResponseEventFileEditedPropertiesJSON `json:"-"` +} + +// eventListResponseEventFileEditedPropertiesJSON contains the JSON metadata for +// the struct [EventListResponseEventFileEditedProperties] +type eventListResponseEventFileEditedPropertiesJSON struct { + File apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *EventListResponseEventFileEditedProperties) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r eventListResponseEventFileEditedPropertiesJSON) RawJSON() string { + return r.raw +} + +type EventListResponseEventFileEditedType string + +const ( + EventListResponseEventFileEditedTypeFileEdited EventListResponseEventFileEditedType = "file.edited" +) + +func (r EventListResponseEventFileEditedType) IsKnown() bool { + switch r { + case EventListResponseEventFileEditedTypeFileEdited: + return true + } + return false +} + +type EventListResponseEventServerConnected struct { + Properties interface{} `json:"properties,required"` + Type EventListResponseEventServerConnectedType `json:"type,required"` + JSON eventListResponseEventServerConnectedJSON `json:"-"` +} + +// eventListResponseEventServerConnectedJSON contains the JSON metadata for the +// struct [EventListResponseEventServerConnected] +type eventListResponseEventServerConnectedJSON struct { + Properties apijson.Field + Type apijson.Field + raw string + ExtraFields map[string]apijson.Field +} + +func (r *EventListResponseEventServerConnected) UnmarshalJSON(data []byte) (err error) { + return apijson.UnmarshalRoot(data, r) +} + +func (r eventListResponseEventServerConnectedJSON) RawJSON() string { + return r.raw +} + +func (r EventListResponseEventServerConnected) implementsEventListResponse() {} + +type EventListResponseEventServerConnectedType string + +const ( + EventListResponseEventServerConnectedTypeServerConnected EventListResponseEventServerConnectedType = "server.connected" +) + +func (r EventListResponseEventServerConnectedType) IsKnown() bool { + switch r { + case EventListResponseEventServerConnectedTypeServerConnected: + return true + } + return false +} + type EventListResponseEventPermissionUpdated struct { Properties Permission `json:"properties,required"` Type EventListResponseEventPermissionUpdatedType `json:"type,required"` @@ -752,66 +853,6 @@ func (r EventListResponseEventPermissionRepliedType) IsKnown() bool { return false } -type EventListResponseEventFileEdited struct { - Properties EventListResponseEventFileEditedProperties `json:"properties,required"` - Type EventListResponseEventFileEditedType `json:"type,required"` - JSON eventListResponseEventFileEditedJSON `json:"-"` -} - -// eventListResponseEventFileEditedJSON contains the JSON metadata for the struct -// [EventListResponseEventFileEdited] -type eventListResponseEventFileEditedJSON struct { - Properties apijson.Field - Type apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *EventListResponseEventFileEdited) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r eventListResponseEventFileEditedJSON) RawJSON() string { - return r.raw -} - -func (r EventListResponseEventFileEdited) implementsEventListResponse() {} - -type EventListResponseEventFileEditedProperties struct { - File string `json:"file,required"` - JSON eventListResponseEventFileEditedPropertiesJSON `json:"-"` -} - -// eventListResponseEventFileEditedPropertiesJSON contains the JSON metadata for -// the struct [EventListResponseEventFileEditedProperties] -type eventListResponseEventFileEditedPropertiesJSON struct { - File apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *EventListResponseEventFileEditedProperties) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r eventListResponseEventFileEditedPropertiesJSON) RawJSON() string { - return r.raw -} - -type EventListResponseEventFileEditedType string - -const ( - EventListResponseEventFileEditedTypeFileEdited EventListResponseEventFileEditedType = "file.edited" -) - -func (r EventListResponseEventFileEditedType) IsKnown() bool { - switch r { - case EventListResponseEventFileEditedTypeFileEdited: - return true - } - return false -} - type EventListResponseEventSessionUpdated struct { Properties EventListResponseEventSessionUpdatedProperties `json:"properties,required"` Type EventListResponseEventSessionUpdatedType `json:"type,required"` @@ -1188,45 +1229,6 @@ func (r EventListResponseEventSessionErrorType) IsKnown() bool { return false } -type EventListResponseEventServerConnected struct { - Properties interface{} `json:"properties,required"` - Type EventListResponseEventServerConnectedType `json:"type,required"` - JSON eventListResponseEventServerConnectedJSON `json:"-"` -} - -// eventListResponseEventServerConnectedJSON contains the JSON metadata for the -// struct [EventListResponseEventServerConnected] -type eventListResponseEventServerConnectedJSON struct { - Properties apijson.Field - Type apijson.Field - raw string - ExtraFields map[string]apijson.Field -} - -func (r *EventListResponseEventServerConnected) UnmarshalJSON(data []byte) (err error) { - return apijson.UnmarshalRoot(data, r) -} - -func (r eventListResponseEventServerConnectedJSON) RawJSON() string { - return r.raw -} - -func (r EventListResponseEventServerConnected) implementsEventListResponse() {} - -type EventListResponseEventServerConnectedType string - -const ( - EventListResponseEventServerConnectedTypeServerConnected EventListResponseEventServerConnectedType = "server.connected" -) - -func (r EventListResponseEventServerConnectedType) IsKnown() bool { - switch r { - case EventListResponseEventServerConnectedTypeServerConnected: - return true - } - return false -} - type EventListResponseEventFileWatcherUpdated struct { Properties EventListResponseEventFileWatcherUpdatedProperties `json:"properties,required"` Type EventListResponseEventFileWatcherUpdatedType `json:"type,required"` @@ -1374,21 +1376,21 @@ const ( EventListResponseTypeMessagePartUpdated EventListResponseType = "message.part.updated" EventListResponseTypeMessagePartRemoved EventListResponseType = "message.part.removed" EventListResponseTypeStorageWrite EventListResponseType = "storage.write" + EventListResponseTypeFileEdited EventListResponseType = "file.edited" + EventListResponseTypeServerConnected EventListResponseType = "server.connected" EventListResponseTypePermissionUpdated EventListResponseType = "permission.updated" EventListResponseTypePermissionReplied EventListResponseType = "permission.replied" - EventListResponseTypeFileEdited EventListResponseType = "file.edited" EventListResponseTypeSessionUpdated EventListResponseType = "session.updated" EventListResponseTypeSessionDeleted EventListResponseType = "session.deleted" EventListResponseTypeSessionIdle EventListResponseType = "session.idle" EventListResponseTypeSessionError EventListResponseType = "session.error" - EventListResponseTypeServerConnected EventListResponseType = "server.connected" EventListResponseTypeFileWatcherUpdated EventListResponseType = "file.watcher.updated" EventListResponseTypeIdeInstalled EventListResponseType = "ide.installed" ) func (r EventListResponseType) IsKnown() bool { switch r { - case EventListResponseTypeInstallationUpdated, EventListResponseTypeLspClientDiagnostics, EventListResponseTypeMessageUpdated, EventListResponseTypeMessageRemoved, EventListResponseTypeMessagePartUpdated, EventListResponseTypeMessagePartRemoved, EventListResponseTypeStorageWrite, EventListResponseTypePermissionUpdated, EventListResponseTypePermissionReplied, EventListResponseTypeFileEdited, EventListResponseTypeSessionUpdated, EventListResponseTypeSessionDeleted, EventListResponseTypeSessionIdle, EventListResponseTypeSessionError, EventListResponseTypeServerConnected, EventListResponseTypeFileWatcherUpdated, EventListResponseTypeIdeInstalled: + case EventListResponseTypeInstallationUpdated, EventListResponseTypeLspClientDiagnostics, EventListResponseTypeMessageUpdated, EventListResponseTypeMessageRemoved, EventListResponseTypeMessagePartUpdated, EventListResponseTypeMessagePartRemoved, EventListResponseTypeStorageWrite, EventListResponseTypeFileEdited, EventListResponseTypeServerConnected, EventListResponseTypePermissionUpdated, EventListResponseTypePermissionReplied, EventListResponseTypeSessionUpdated, EventListResponseTypeSessionDeleted, EventListResponseTypeSessionIdle, EventListResponseTypeSessionError, EventListResponseTypeFileWatcherUpdated, EventListResponseTypeIdeInstalled: return true } return false |
