Skip to content

Commit 5d235c4

Browse files
feat(api): api update
1 parent b3d8074 commit 5d235c4

File tree

3 files changed

+54
-55
lines changed

3 files changed

+54
-55
lines changed

.stats.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 22
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/opencode%2Fopencode-7270b9e4859010d6680bcc92afcd6f7c679d80a2645f65d7097d19ce2e8cdc5a.yml
3-
openapi_spec_hash: 5fcbfaedebfea62c17c74437a9728b04
4-
config_hash: 38041c37df28a1c4383718e6d148dd0a
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/opencode%2Fopencode-dc00ba583508f76d4bda268d13d363a20df52f9dfd92dfd49d51c26d1fa07b17.yml
3+
openapi_spec_hash: ce12e8bf326729776ad289e5af554dc3
4+
config_hash: 2a888f284ea87b2dfdb7e548938a55ea

api.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ Response Types:
6262
- <a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go">opencode</a>.<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go#Keybinds">Keybinds</a>
6363
- <a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go">opencode</a>.<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go#McpLocal">McpLocal</a>
6464
- <a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go">opencode</a>.<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go#McpRemote">McpRemote</a>
65+
- <a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go">opencode</a>.<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go#Mode">Mode</a>
6566
- <a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go">opencode</a>.<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go#Model">Model</a>
6667
- <a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go">opencode</a>.<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go#Provider">Provider</a>
6768
- <a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go">opencode</a>.<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go#ConfigProvidersResponse">ConfigProvidersResponse</a>

config.go

Lines changed: 50 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,8 @@ type Config struct {
6363
Instructions []string `json:"instructions"`
6464
// Custom keybind configurations
6565
Keybinds Keybinds `json:"keybinds"`
66+
// Layout to use for the TUI
67+
Layout ConfigLayout `json:"layout"`
6668
// Minimum log level to write to log files
6769
LogLevel LogLevel `json:"log_level"`
6870
// MCP (Model Context Protocol) server configurations
@@ -91,6 +93,7 @@ type configJSON struct {
9193
Experimental apijson.Field
9294
Instructions apijson.Field
9395
Keybinds apijson.Field
96+
Layout apijson.Field
9497
LogLevel apijson.Field
9598
Mcp apijson.Field
9699
Mode apijson.Field
@@ -201,6 +204,22 @@ func (r configExperimentalHookSessionCompletedJSON) RawJSON() string {
201204
return r.raw
202205
}
203206

207+
// Layout to use for the TUI
208+
type ConfigLayout string
209+
210+
const (
211+
ConfigLayoutAuto ConfigLayout = "auto"
212+
ConfigLayoutStretch ConfigLayout = "stretch"
213+
)
214+
215+
func (r ConfigLayout) IsKnown() bool {
216+
switch r {
217+
case ConfigLayoutAuto, ConfigLayoutStretch:
218+
return true
219+
}
220+
return false
221+
}
222+
204223
type ConfigMcp struct {
205224
// Type of MCP server connection
206225
Type ConfigMcpType `json:"type,required"`
@@ -287,10 +306,10 @@ func (r ConfigMcpType) IsKnown() bool {
287306
}
288307

289308
type ConfigMode struct {
290-
Build ConfigModeBuild `json:"build"`
291-
Plan ConfigModePlan `json:"plan"`
292-
ExtraFields map[string]ConfigMode `json:"-,extras"`
293-
JSON configModeJSON `json:"-"`
309+
Build Mode `json:"build"`
310+
Plan Mode `json:"plan"`
311+
ExtraFields map[string]Mode `json:"-,extras"`
312+
JSON configModeJSON `json:"-"`
294313
}
295314

296315
// configModeJSON contains the JSON metadata for the struct [ConfigMode]
@@ -309,54 +328,6 @@ func (r configModeJSON) RawJSON() string {
309328
return r.raw
310329
}
311330

312-
type ConfigModeBuild struct {
313-
Model string `json:"model"`
314-
Prompt string `json:"prompt"`
315-
Tools map[string]bool `json:"tools"`
316-
JSON configModeBuildJSON `json:"-"`
317-
}
318-
319-
// configModeBuildJSON contains the JSON metadata for the struct [ConfigModeBuild]
320-
type configModeBuildJSON struct {
321-
Model apijson.Field
322-
Prompt apijson.Field
323-
Tools apijson.Field
324-
raw string
325-
ExtraFields map[string]apijson.Field
326-
}
327-
328-
func (r *ConfigModeBuild) UnmarshalJSON(data []byte) (err error) {
329-
return apijson.UnmarshalRoot(data, r)
330-
}
331-
332-
func (r configModeBuildJSON) RawJSON() string {
333-
return r.raw
334-
}
335-
336-
type ConfigModePlan struct {
337-
Model string `json:"model"`
338-
Prompt string `json:"prompt"`
339-
Tools map[string]bool `json:"tools"`
340-
JSON configModePlanJSON `json:"-"`
341-
}
342-
343-
// configModePlanJSON contains the JSON metadata for the struct [ConfigModePlan]
344-
type configModePlanJSON struct {
345-
Model apijson.Field
346-
Prompt apijson.Field
347-
Tools apijson.Field
348-
raw string
349-
ExtraFields map[string]apijson.Field
350-
}
351-
352-
func (r *ConfigModePlan) UnmarshalJSON(data []byte) (err error) {
353-
return apijson.UnmarshalRoot(data, r)
354-
}
355-
356-
func (r configModePlanJSON) RawJSON() string {
357-
return r.raw
358-
}
359-
360331
type ConfigProvider struct {
361332
Models map[string]ConfigProviderModel `json:"models,required"`
362333
ID string `json:"id"`
@@ -548,6 +519,8 @@ type Keybinds struct {
548519
ProjectInit string `json:"project_init,required"`
549520
// Compact the session
550521
SessionCompact string `json:"session_compact,required"`
522+
// Export session to editor
523+
SessionExport string `json:"session_export,required"`
551524
// Interrupt current session
552525
SessionInterrupt string `json:"session_interrupt,required"`
553526
// List all sessions
@@ -595,6 +568,7 @@ type keybindsJSON struct {
595568
ModelList apijson.Field
596569
ProjectInit apijson.Field
597570
SessionCompact apijson.Field
571+
SessionExport apijson.Field
598572
SessionInterrupt apijson.Field
599573
SessionList apijson.Field
600574
SessionNew apijson.Field
@@ -706,6 +680,30 @@ func (r McpRemoteType) IsKnown() bool {
706680
return false
707681
}
708682

683+
type Mode struct {
684+
Model string `json:"model"`
685+
Prompt string `json:"prompt"`
686+
Tools map[string]bool `json:"tools"`
687+
JSON modeJSON `json:"-"`
688+
}
689+
690+
// modeJSON contains the JSON metadata for the struct [Mode]
691+
type modeJSON struct {
692+
Model apijson.Field
693+
Prompt apijson.Field
694+
Tools apijson.Field
695+
raw string
696+
ExtraFields map[string]apijson.Field
697+
}
698+
699+
func (r *Mode) UnmarshalJSON(data []byte) (err error) {
700+
return apijson.UnmarshalRoot(data, r)
701+
}
702+
703+
func (r modeJSON) RawJSON() string {
704+
return r.raw
705+
}
706+
709707
type Model struct {
710708
ID string `json:"id,required"`
711709
Attachment bool `json:"attachment,required"`

0 commit comments

Comments
 (0)