diff --git a/.stats.yml b/.stats.yml
index 22b27ac..bab7aeb 100644
--- a/.stats.yml
+++ b/.stats.yml
@@ -1,4 +1,4 @@
configured_endpoints: 22
-openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/opencode%2Fopencode-8792f91dd070f7b4ee671fc86e8a03976dc7fb6ee49f8c99ad989e1597003774.yml
-openapi_spec_hash: fe9dc3a074be560de0b97df9b5af2c1b
+openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/opencode%2Fopencode-f9a2ce0fd0addc365614ef8c4bb1746f5ba14bc92f3d01f4cd85fb3b33a8d975.yml
+openapi_spec_hash: c58dec8e5250d41f216cded6afb763af
config_hash: b7f3d9742335715c458494988498b183
diff --git a/api.md b/api.md
index 1c3f5a5..f460daa 100644
--- a/api.md
+++ b/api.md
@@ -75,11 +75,6 @@ Methods:
# Session
-Params Types:
-
-- opencode.FilePartParam
-- opencode.TextPartParam
-
Response Types:
- opencode.AssistantMessage
diff --git a/config.go b/config.go
index c35c7c9..f54c6a7 100644
--- a/config.go
+++ b/config.go
@@ -67,8 +67,8 @@ type Config struct {
Model string `json:"model"`
// Custom provider configurations and model overrides
Provider map[string]ConfigProvider `json:"provider"`
- // Control sharing behavior: 'auto' enables automatic sharing, 'disabled' disables
- // all sharing
+ // Control sharing behavior:'manual' allows manual sharing via commands, 'auto'
+ // enables automatic sharing, 'disabled' disables all sharing
Share ConfigShare `json:"share"`
// Theme name to use for the interface
Theme string `json:"theme"`
@@ -206,6 +206,8 @@ type ConfigMcp struct {
Enabled bool `json:"enabled"`
// This field can have the runtime type of [map[string]string].
Environment interface{} `json:"environment"`
+ // This field can have the runtime type of [map[string]string].
+ Headers interface{} `json:"headers"`
// URL of the remote MCP server
URL string `json:"url"`
JSON configMcpJSON `json:"-"`
@@ -218,6 +220,7 @@ type configMcpJSON struct {
Command apijson.Field
Enabled apijson.Field
Environment apijson.Field
+ Headers apijson.Field
URL apijson.Field
raw string
ExtraFields map[string]apijson.Field
@@ -427,18 +430,19 @@ func (r configProviderModelsLimitJSON) RawJSON() string {
return r.raw
}
-// Control sharing behavior: 'auto' enables automatic sharing, 'disabled' disables
-// all sharing
+// Control sharing behavior:'manual' allows manual sharing via commands, 'auto'
+// enables automatic sharing, 'disabled' disables all sharing
type ConfigShare string
const (
+ ConfigShareManual ConfigShare = "manual"
ConfigShareAuto ConfigShare = "auto"
ConfigShareDisabled ConfigShare = "disabled"
)
func (r ConfigShare) IsKnown() bool {
switch r {
- case ConfigShareAuto, ConfigShareDisabled:
+ case ConfigShareManual, ConfigShareAuto, ConfigShareDisabled:
return true
}
return false
@@ -509,8 +513,10 @@ type KeybindsConfig struct {
SessionShare string `json:"session_share,required"`
// Unshare current session
SessionUnshare string `json:"session_unshare,required"`
- // Switch mode
+ // Next mode
SwitchMode string `json:"switch_mode,required"`
+ // Previous Mode
+ SwitchModeReverse string `json:"switch_mode_reverse,required"`
// List available themes
ThemeList string `json:"theme_list,required"`
// Toggle tool details
@@ -553,6 +559,7 @@ type keybindsConfigJSON struct {
SessionShare apijson.Field
SessionUnshare apijson.Field
SwitchMode apijson.Field
+ SwitchModeReverse apijson.Field
ThemeList apijson.Field
ToolDetails apijson.Field
raw string
@@ -635,7 +642,9 @@ type McpRemoteConfig struct {
// URL of the remote MCP server
URL string `json:"url,required"`
// Enable or disable the MCP server on startup
- Enabled bool `json:"enabled"`
+ Enabled bool `json:"enabled"`
+ // Headers to send with the request
+ Headers map[string]string `json:"headers"`
JSON mcpRemoteConfigJSON `json:"-"`
}
@@ -644,6 +653,7 @@ type mcpRemoteConfigJSON struct {
Type apijson.Field
URL apijson.Field
Enabled apijson.Field
+ Headers apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
diff --git a/session.go b/session.go
index b62ade1..5a23ffa 100644
--- a/session.go
+++ b/session.go
@@ -481,22 +481,6 @@ func (r FilePartType) IsKnown() bool {
return false
}
-type FilePartParam struct {
- ID param.Field[string] `json:"id,required"`
- MessageID param.Field[string] `json:"messageID,required"`
- Mime param.Field[string] `json:"mime,required"`
- SessionID param.Field[string] `json:"sessionID,required"`
- Type param.Field[FilePartType] `json:"type,required"`
- URL param.Field[string] `json:"url,required"`
- Filename param.Field[string] `json:"filename"`
-}
-
-func (r FilePartParam) MarshalJSON() (data []byte, err error) {
- return apijson.MarshalRoot(r)
-}
-
-func (r FilePartParam) implementsSessionChatParamsPartUnion() {}
-
type Message struct {
ID string `json:"id,required"`
Role MessageRole `json:"role,required"`
@@ -1076,31 +1060,6 @@ func (r textPartTimeJSON) RawJSON() string {
return r.raw
}
-type TextPartParam struct {
- ID param.Field[string] `json:"id,required"`
- MessageID param.Field[string] `json:"messageID,required"`
- SessionID param.Field[string] `json:"sessionID,required"`
- Text param.Field[string] `json:"text,required"`
- Type param.Field[TextPartType] `json:"type,required"`
- Synthetic param.Field[bool] `json:"synthetic"`
- Time param.Field[TextPartTimeParam] `json:"time"`
-}
-
-func (r TextPartParam) MarshalJSON() (data []byte, err error) {
- return apijson.MarshalRoot(r)
-}
-
-func (r TextPartParam) implementsSessionChatParamsPartUnion() {}
-
-type TextPartTimeParam struct {
- Start param.Field[float64] `json:"start,required"`
- End param.Field[float64] `json:"end"`
-}
-
-func (r TextPartTimeParam) MarshalJSON() (data []byte, err error) {
- return apijson.MarshalRoot(r)
-}
-
type ToolPart struct {
ID string `json:"id,required"`
CallID string `json:"callID,required"`
@@ -1574,11 +1533,12 @@ func (r sessionMessagesResponseJSON) RawJSON() string {
}
type SessionChatParams struct {
- MessageID param.Field[string] `json:"messageID,required"`
- Mode param.Field[string] `json:"mode,required"`
ModelID param.Field[string] `json:"modelID,required"`
Parts param.Field[[]SessionChatParamsPartUnion] `json:"parts,required"`
ProviderID param.Field[string] `json:"providerID,required"`
+ SessionID param.Field[string] `json:"sessionID,required"`
+ MessageID param.Field[string] `json:"messageID"`
+ Mode param.Field[string] `json:"mode"`
}
func (r SessionChatParams) MarshalJSON() (data []byte, err error) {
@@ -1586,10 +1546,8 @@ func (r SessionChatParams) MarshalJSON() (data []byte, err error) {
}
type SessionChatParamsPart struct {
- ID param.Field[string] `json:"id,required"`
- MessageID param.Field[string] `json:"messageID,required"`
- SessionID param.Field[string] `json:"sessionID,required"`
Type param.Field[SessionChatParamsPartsType] `json:"type,required"`
+ ID param.Field[string] `json:"id"`
Filename param.Field[string] `json:"filename"`
Mime param.Field[string] `json:"mime"`
Synthetic param.Field[bool] `json:"synthetic"`
@@ -1604,21 +1562,59 @@ func (r SessionChatParamsPart) MarshalJSON() (data []byte, err error) {
func (r SessionChatParamsPart) implementsSessionChatParamsPartUnion() {}
-// Satisfied by [FilePartParam], [TextPartParam], [SessionChatParamsPart].
+// Satisfied by [SessionChatParamsPartsObject], [SessionChatParamsPartsObject],
+// [SessionChatParamsPart].
type SessionChatParamsPartUnion interface {
implementsSessionChatParamsPartUnion()
}
+type SessionChatParamsPartsObject struct {
+ Text param.Field[string] `json:"text,required"`
+ Type param.Field[SessionChatParamsPartsObjectType] `json:"type,required"`
+ ID param.Field[string] `json:"id"`
+ Synthetic param.Field[bool] `json:"synthetic"`
+ Time param.Field[SessionChatParamsPartsObjectTime] `json:"time"`
+}
+
+func (r SessionChatParamsPartsObject) MarshalJSON() (data []byte, err error) {
+ return apijson.MarshalRoot(r)
+}
+
+func (r SessionChatParamsPartsObject) implementsSessionChatParamsPartUnion() {}
+
+type SessionChatParamsPartsObjectType string
+
+const (
+ SessionChatParamsPartsObjectTypeText SessionChatParamsPartsObjectType = "text"
+)
+
+func (r SessionChatParamsPartsObjectType) IsKnown() bool {
+ switch r {
+ case SessionChatParamsPartsObjectTypeText:
+ return true
+ }
+ return false
+}
+
+type SessionChatParamsPartsObjectTime struct {
+ Start param.Field[float64] `json:"start,required"`
+ End param.Field[float64] `json:"end"`
+}
+
+func (r SessionChatParamsPartsObjectTime) MarshalJSON() (data []byte, err error) {
+ return apijson.MarshalRoot(r)
+}
+
type SessionChatParamsPartsType string
const (
- SessionChatParamsPartsTypeFile SessionChatParamsPartsType = "file"
SessionChatParamsPartsTypeText SessionChatParamsPartsType = "text"
+ SessionChatParamsPartsTypeFile SessionChatParamsPartsType = "file"
)
func (r SessionChatParamsPartsType) IsKnown() bool {
switch r {
- case SessionChatParamsPartsTypeFile, SessionChatParamsPartsTypeText:
+ case SessionChatParamsPartsTypeText, SessionChatParamsPartsTypeFile:
return true
}
return false
diff --git a/session_test.go b/session_test.go
index c74a4a3..f2e4e87 100644
--- a/session_test.go
+++ b/session_test.go
@@ -101,7 +101,7 @@ func TestSessionAbort(t *testing.T) {
}
}
-func TestSessionChat(t *testing.T) {
+func TestSessionChatWithOptionalParams(t *testing.T) {
t.Skip("skipped: tests are disabled for the time being")
baseURL := "http://localhost:4010"
if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
@@ -117,19 +117,21 @@ func TestSessionChat(t *testing.T) {
context.TODO(),
"id",
opencode.SessionChatParams{
- MessageID: opencode.F("messageID"),
- Mode: opencode.F("mode"),
- ModelID: opencode.F("modelID"),
- Parts: opencode.F([]opencode.SessionChatParamsPartUnion{opencode.FilePartParam{
+ ModelID: opencode.F("modelID"),
+ Parts: opencode.F([]opencode.SessionChatParamsPartUnion{opencode.SessionChatParamsPartsObject{
+ Text: opencode.F("text"),
+ Type: opencode.F(opencode.SessionChatParamsPartsObjectTypeText),
ID: opencode.F("id"),
- MessageID: opencode.F("messageID"),
- Mime: opencode.F("mime"),
- SessionID: opencode.F("sessionID"),
- Type: opencode.F(opencode.FilePartTypeFile),
- URL: opencode.F("url"),
- Filename: opencode.F("filename"),
+ Synthetic: opencode.F(true),
+ Time: opencode.F(opencode.SessionChatParamsPartsObjectTime{
+ Start: opencode.F(0.000000),
+ End: opencode.F(0.000000),
+ }),
}}),
ProviderID: opencode.F("providerID"),
+ SessionID: opencode.F("ses"),
+ MessageID: opencode.F("msg"),
+ Mode: opencode.F("mode"),
},
)
if err != nil {