config.go 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887
  1. // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
  2. package opencode
  3. import (
  4. "context"
  5. "net/http"
  6. "reflect"
  7. "github.com/sst/opencode-sdk-go/internal/apijson"
  8. "github.com/sst/opencode-sdk-go/internal/requestconfig"
  9. "github.com/sst/opencode-sdk-go/option"
  10. "github.com/tidwall/gjson"
  11. )
  12. // ConfigService contains methods and other services that help with interacting
  13. // with the opencode API.
  14. //
  15. // Note, unlike clients, this service does not read variables from the environment
  16. // automatically. You should not instantiate this service directly, and instead use
  17. // the [NewConfigService] method instead.
  18. type ConfigService struct {
  19. Options []option.RequestOption
  20. }
  21. // NewConfigService generates a new service that applies the given options to each
  22. // request. These options are applied after the parent client's options (if there
  23. // is one), and before any request-specific options.
  24. func NewConfigService(opts ...option.RequestOption) (r *ConfigService) {
  25. r = &ConfigService{}
  26. r.Options = opts
  27. return
  28. }
  29. // Get config info
  30. func (r *ConfigService) Get(ctx context.Context, opts ...option.RequestOption) (res *Config, err error) {
  31. opts = append(r.Options[:], opts...)
  32. path := "config"
  33. err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...)
  34. return
  35. }
  36. type Config struct {
  37. // JSON schema reference for configuration validation
  38. Schema string `json:"$schema"`
  39. // Modes configuration, see https://opencode.ai/docs/modes
  40. Agent ConfigAgent `json:"agent"`
  41. // @deprecated Use 'share' field instead. Share newly created sessions
  42. // automatically
  43. Autoshare bool `json:"autoshare"`
  44. // Automatically update to the latest version
  45. Autoupdate bool `json:"autoupdate"`
  46. // Disable providers that are loaded automatically
  47. DisabledProviders []string `json:"disabled_providers"`
  48. Experimental ConfigExperimental `json:"experimental"`
  49. // Additional instruction files or patterns to include
  50. Instructions []string `json:"instructions"`
  51. // Custom keybind configurations
  52. Keybinds KeybindsConfig `json:"keybinds"`
  53. // @deprecated Always uses stretch layout.
  54. Layout ConfigLayout `json:"layout"`
  55. // MCP (Model Context Protocol) server configurations
  56. Mcp map[string]ConfigMcp `json:"mcp"`
  57. // Modes configuration, see https://opencode.ai/docs/modes
  58. Mode ConfigMode `json:"mode"`
  59. // Model to use in the format of provider/model, eg anthropic/claude-2
  60. Model string `json:"model"`
  61. Permission ConfigPermission `json:"permission"`
  62. // Custom provider configurations and model overrides
  63. Provider map[string]ConfigProvider `json:"provider"`
  64. // Control sharing behavior:'manual' allows manual sharing via commands, 'auto'
  65. // enables automatic sharing, 'disabled' disables all sharing
  66. Share ConfigShare `json:"share"`
  67. // Small model to use for tasks like summarization and title generation in the
  68. // format of provider/model
  69. SmallModel string `json:"small_model"`
  70. // Theme name to use for the interface
  71. Theme string `json:"theme"`
  72. // Custom username to display in conversations instead of system username
  73. Username string `json:"username"`
  74. JSON configJSON `json:"-"`
  75. }
  76. // configJSON contains the JSON metadata for the struct [Config]
  77. type configJSON struct {
  78. Schema apijson.Field
  79. Agent apijson.Field
  80. Autoshare apijson.Field
  81. Autoupdate apijson.Field
  82. DisabledProviders apijson.Field
  83. Experimental apijson.Field
  84. Instructions apijson.Field
  85. Keybinds apijson.Field
  86. Layout apijson.Field
  87. Mcp apijson.Field
  88. Mode apijson.Field
  89. Model apijson.Field
  90. Permission apijson.Field
  91. Provider apijson.Field
  92. Share apijson.Field
  93. SmallModel apijson.Field
  94. Theme apijson.Field
  95. Username apijson.Field
  96. raw string
  97. ExtraFields map[string]apijson.Field
  98. }
  99. func (r *Config) UnmarshalJSON(data []byte) (err error) {
  100. return apijson.UnmarshalRoot(data, r)
  101. }
  102. func (r configJSON) RawJSON() string {
  103. return r.raw
  104. }
  105. // Modes configuration, see https://opencode.ai/docs/modes
  106. type ConfigAgent struct {
  107. General ConfigAgentGeneral `json:"general"`
  108. ExtraFields map[string]ConfigAgent `json:"-,extras"`
  109. JSON configAgentJSON `json:"-"`
  110. }
  111. // configAgentJSON contains the JSON metadata for the struct [ConfigAgent]
  112. type configAgentJSON struct {
  113. General apijson.Field
  114. raw string
  115. ExtraFields map[string]apijson.Field
  116. }
  117. func (r *ConfigAgent) UnmarshalJSON(data []byte) (err error) {
  118. return apijson.UnmarshalRoot(data, r)
  119. }
  120. func (r configAgentJSON) RawJSON() string {
  121. return r.raw
  122. }
  123. type ConfigAgentGeneral struct {
  124. Description string `json:"description,required"`
  125. JSON configAgentGeneralJSON `json:"-"`
  126. ModeConfig
  127. }
  128. // configAgentGeneralJSON contains the JSON metadata for the struct
  129. // [ConfigAgentGeneral]
  130. type configAgentGeneralJSON struct {
  131. Description apijson.Field
  132. raw string
  133. ExtraFields map[string]apijson.Field
  134. }
  135. func (r *ConfigAgentGeneral) UnmarshalJSON(data []byte) (err error) {
  136. return apijson.UnmarshalRoot(data, r)
  137. }
  138. func (r configAgentGeneralJSON) RawJSON() string {
  139. return r.raw
  140. }
  141. type ConfigExperimental struct {
  142. Hook ConfigExperimentalHook `json:"hook"`
  143. JSON configExperimentalJSON `json:"-"`
  144. }
  145. // configExperimentalJSON contains the JSON metadata for the struct
  146. // [ConfigExperimental]
  147. type configExperimentalJSON struct {
  148. Hook apijson.Field
  149. raw string
  150. ExtraFields map[string]apijson.Field
  151. }
  152. func (r *ConfigExperimental) UnmarshalJSON(data []byte) (err error) {
  153. return apijson.UnmarshalRoot(data, r)
  154. }
  155. func (r configExperimentalJSON) RawJSON() string {
  156. return r.raw
  157. }
  158. type ConfigExperimentalHook struct {
  159. FileEdited map[string][]ConfigExperimentalHookFileEdited `json:"file_edited"`
  160. SessionCompleted []ConfigExperimentalHookSessionCompleted `json:"session_completed"`
  161. JSON configExperimentalHookJSON `json:"-"`
  162. }
  163. // configExperimentalHookJSON contains the JSON metadata for the struct
  164. // [ConfigExperimentalHook]
  165. type configExperimentalHookJSON struct {
  166. FileEdited apijson.Field
  167. SessionCompleted apijson.Field
  168. raw string
  169. ExtraFields map[string]apijson.Field
  170. }
  171. func (r *ConfigExperimentalHook) UnmarshalJSON(data []byte) (err error) {
  172. return apijson.UnmarshalRoot(data, r)
  173. }
  174. func (r configExperimentalHookJSON) RawJSON() string {
  175. return r.raw
  176. }
  177. type ConfigExperimentalHookFileEdited struct {
  178. Command []string `json:"command,required"`
  179. Environment map[string]string `json:"environment"`
  180. JSON configExperimentalHookFileEditedJSON `json:"-"`
  181. }
  182. // configExperimentalHookFileEditedJSON contains the JSON metadata for the struct
  183. // [ConfigExperimentalHookFileEdited]
  184. type configExperimentalHookFileEditedJSON struct {
  185. Command apijson.Field
  186. Environment apijson.Field
  187. raw string
  188. ExtraFields map[string]apijson.Field
  189. }
  190. func (r *ConfigExperimentalHookFileEdited) UnmarshalJSON(data []byte) (err error) {
  191. return apijson.UnmarshalRoot(data, r)
  192. }
  193. func (r configExperimentalHookFileEditedJSON) RawJSON() string {
  194. return r.raw
  195. }
  196. type ConfigExperimentalHookSessionCompleted struct {
  197. Command []string `json:"command,required"`
  198. Environment map[string]string `json:"environment"`
  199. JSON configExperimentalHookSessionCompletedJSON `json:"-"`
  200. }
  201. // configExperimentalHookSessionCompletedJSON contains the JSON metadata for the
  202. // struct [ConfigExperimentalHookSessionCompleted]
  203. type configExperimentalHookSessionCompletedJSON struct {
  204. Command apijson.Field
  205. Environment apijson.Field
  206. raw string
  207. ExtraFields map[string]apijson.Field
  208. }
  209. func (r *ConfigExperimentalHookSessionCompleted) UnmarshalJSON(data []byte) (err error) {
  210. return apijson.UnmarshalRoot(data, r)
  211. }
  212. func (r configExperimentalHookSessionCompletedJSON) RawJSON() string {
  213. return r.raw
  214. }
  215. // @deprecated Always uses stretch layout.
  216. type ConfigLayout string
  217. const (
  218. ConfigLayoutAuto ConfigLayout = "auto"
  219. ConfigLayoutStretch ConfigLayout = "stretch"
  220. )
  221. func (r ConfigLayout) IsKnown() bool {
  222. switch r {
  223. case ConfigLayoutAuto, ConfigLayoutStretch:
  224. return true
  225. }
  226. return false
  227. }
  228. type ConfigMcp struct {
  229. // Type of MCP server connection
  230. Type ConfigMcpType `json:"type,required"`
  231. // This field can have the runtime type of [[]string].
  232. Command interface{} `json:"command"`
  233. // Enable or disable the MCP server on startup
  234. Enabled bool `json:"enabled"`
  235. // This field can have the runtime type of [map[string]string].
  236. Environment interface{} `json:"environment"`
  237. // This field can have the runtime type of [map[string]string].
  238. Headers interface{} `json:"headers"`
  239. // URL of the remote MCP server
  240. URL string `json:"url"`
  241. JSON configMcpJSON `json:"-"`
  242. union ConfigMcpUnion
  243. }
  244. // configMcpJSON contains the JSON metadata for the struct [ConfigMcp]
  245. type configMcpJSON struct {
  246. Type apijson.Field
  247. Command apijson.Field
  248. Enabled apijson.Field
  249. Environment apijson.Field
  250. Headers apijson.Field
  251. URL apijson.Field
  252. raw string
  253. ExtraFields map[string]apijson.Field
  254. }
  255. func (r configMcpJSON) RawJSON() string {
  256. return r.raw
  257. }
  258. func (r *ConfigMcp) UnmarshalJSON(data []byte) (err error) {
  259. *r = ConfigMcp{}
  260. err = apijson.UnmarshalRoot(data, &r.union)
  261. if err != nil {
  262. return err
  263. }
  264. return apijson.Port(r.union, &r)
  265. }
  266. // AsUnion returns a [ConfigMcpUnion] interface which you can cast to the specific
  267. // types for more type safety.
  268. //
  269. // Possible runtime types of the union are [McpLocalConfig], [McpRemoteConfig].
  270. func (r ConfigMcp) AsUnion() ConfigMcpUnion {
  271. return r.union
  272. }
  273. // Union satisfied by [McpLocalConfig] or [McpRemoteConfig].
  274. type ConfigMcpUnion interface {
  275. implementsConfigMcp()
  276. }
  277. func init() {
  278. apijson.RegisterUnion(
  279. reflect.TypeOf((*ConfigMcpUnion)(nil)).Elem(),
  280. "type",
  281. apijson.UnionVariant{
  282. TypeFilter: gjson.JSON,
  283. Type: reflect.TypeOf(McpLocalConfig{}),
  284. DiscriminatorValue: "local",
  285. },
  286. apijson.UnionVariant{
  287. TypeFilter: gjson.JSON,
  288. Type: reflect.TypeOf(McpRemoteConfig{}),
  289. DiscriminatorValue: "remote",
  290. },
  291. )
  292. }
  293. // Type of MCP server connection
  294. type ConfigMcpType string
  295. const (
  296. ConfigMcpTypeLocal ConfigMcpType = "local"
  297. ConfigMcpTypeRemote ConfigMcpType = "remote"
  298. )
  299. func (r ConfigMcpType) IsKnown() bool {
  300. switch r {
  301. case ConfigMcpTypeLocal, ConfigMcpTypeRemote:
  302. return true
  303. }
  304. return false
  305. }
  306. // Modes configuration, see https://opencode.ai/docs/modes
  307. type ConfigMode struct {
  308. Build ModeConfig `json:"build"`
  309. Plan ModeConfig `json:"plan"`
  310. ExtraFields map[string]ModeConfig `json:"-,extras"`
  311. JSON configModeJSON `json:"-"`
  312. }
  313. // configModeJSON contains the JSON metadata for the struct [ConfigMode]
  314. type configModeJSON struct {
  315. Build apijson.Field
  316. Plan apijson.Field
  317. raw string
  318. ExtraFields map[string]apijson.Field
  319. }
  320. func (r *ConfigMode) UnmarshalJSON(data []byte) (err error) {
  321. return apijson.UnmarshalRoot(data, r)
  322. }
  323. func (r configModeJSON) RawJSON() string {
  324. return r.raw
  325. }
  326. type ConfigPermission struct {
  327. Bash ConfigPermissionBashUnion `json:"bash"`
  328. Edit ConfigPermissionEdit `json:"edit"`
  329. JSON configPermissionJSON `json:"-"`
  330. }
  331. // configPermissionJSON contains the JSON metadata for the struct
  332. // [ConfigPermission]
  333. type configPermissionJSON struct {
  334. Bash apijson.Field
  335. Edit apijson.Field
  336. raw string
  337. ExtraFields map[string]apijson.Field
  338. }
  339. func (r *ConfigPermission) UnmarshalJSON(data []byte) (err error) {
  340. return apijson.UnmarshalRoot(data, r)
  341. }
  342. func (r configPermissionJSON) RawJSON() string {
  343. return r.raw
  344. }
  345. // Union satisfied by [ConfigPermissionBashString] or [ConfigPermissionBashMap].
  346. type ConfigPermissionBashUnion interface {
  347. implementsConfigPermissionBashUnion()
  348. }
  349. func init() {
  350. apijson.RegisterUnion(
  351. reflect.TypeOf((*ConfigPermissionBashUnion)(nil)).Elem(),
  352. "",
  353. apijson.UnionVariant{
  354. TypeFilter: gjson.String,
  355. Type: reflect.TypeOf(ConfigPermissionBashString("")),
  356. },
  357. apijson.UnionVariant{
  358. TypeFilter: gjson.JSON,
  359. Type: reflect.TypeOf(ConfigPermissionBashMap{}),
  360. },
  361. )
  362. }
  363. type ConfigPermissionBashString string
  364. const (
  365. ConfigPermissionBashStringAsk ConfigPermissionBashString = "ask"
  366. ConfigPermissionBashStringAllow ConfigPermissionBashString = "allow"
  367. )
  368. func (r ConfigPermissionBashString) IsKnown() bool {
  369. switch r {
  370. case ConfigPermissionBashStringAsk, ConfigPermissionBashStringAllow:
  371. return true
  372. }
  373. return false
  374. }
  375. func (r ConfigPermissionBashString) implementsConfigPermissionBashUnion() {}
  376. type ConfigPermissionBashMap map[string]ConfigPermissionBashMapItem
  377. func (r ConfigPermissionBashMap) implementsConfigPermissionBashUnion() {}
  378. type ConfigPermissionBashMapItem string
  379. const (
  380. ConfigPermissionBashMapAsk ConfigPermissionBashMapItem = "ask"
  381. ConfigPermissionBashMapAllow ConfigPermissionBashMapItem = "allow"
  382. )
  383. func (r ConfigPermissionBashMapItem) IsKnown() bool {
  384. switch r {
  385. case ConfigPermissionBashMapAsk, ConfigPermissionBashMapAllow:
  386. return true
  387. }
  388. return false
  389. }
  390. type ConfigPermissionEdit string
  391. const (
  392. ConfigPermissionEditAsk ConfigPermissionEdit = "ask"
  393. ConfigPermissionEditAllow ConfigPermissionEdit = "allow"
  394. )
  395. func (r ConfigPermissionEdit) IsKnown() bool {
  396. switch r {
  397. case ConfigPermissionEditAsk, ConfigPermissionEditAllow:
  398. return true
  399. }
  400. return false
  401. }
  402. type ConfigProvider struct {
  403. Models map[string]ConfigProviderModel `json:"models,required"`
  404. ID string `json:"id"`
  405. API string `json:"api"`
  406. Env []string `json:"env"`
  407. Name string `json:"name"`
  408. Npm string `json:"npm"`
  409. Options ConfigProviderOptions `json:"options"`
  410. JSON configProviderJSON `json:"-"`
  411. }
  412. // configProviderJSON contains the JSON metadata for the struct [ConfigProvider]
  413. type configProviderJSON struct {
  414. Models apijson.Field
  415. ID apijson.Field
  416. API apijson.Field
  417. Env apijson.Field
  418. Name apijson.Field
  419. Npm apijson.Field
  420. Options apijson.Field
  421. raw string
  422. ExtraFields map[string]apijson.Field
  423. }
  424. func (r *ConfigProvider) UnmarshalJSON(data []byte) (err error) {
  425. return apijson.UnmarshalRoot(data, r)
  426. }
  427. func (r configProviderJSON) RawJSON() string {
  428. return r.raw
  429. }
  430. type ConfigProviderModel struct {
  431. ID string `json:"id"`
  432. Attachment bool `json:"attachment"`
  433. Cost ConfigProviderModelsCost `json:"cost"`
  434. Limit ConfigProviderModelsLimit `json:"limit"`
  435. Name string `json:"name"`
  436. Options map[string]interface{} `json:"options"`
  437. Reasoning bool `json:"reasoning"`
  438. ReleaseDate string `json:"release_date"`
  439. Temperature bool `json:"temperature"`
  440. ToolCall bool `json:"tool_call"`
  441. JSON configProviderModelJSON `json:"-"`
  442. }
  443. // configProviderModelJSON contains the JSON metadata for the struct
  444. // [ConfigProviderModel]
  445. type configProviderModelJSON struct {
  446. ID apijson.Field
  447. Attachment apijson.Field
  448. Cost apijson.Field
  449. Limit apijson.Field
  450. Name apijson.Field
  451. Options apijson.Field
  452. Reasoning apijson.Field
  453. ReleaseDate apijson.Field
  454. Temperature apijson.Field
  455. ToolCall apijson.Field
  456. raw string
  457. ExtraFields map[string]apijson.Field
  458. }
  459. func (r *ConfigProviderModel) UnmarshalJSON(data []byte) (err error) {
  460. return apijson.UnmarshalRoot(data, r)
  461. }
  462. func (r configProviderModelJSON) RawJSON() string {
  463. return r.raw
  464. }
  465. type ConfigProviderModelsCost struct {
  466. Input float64 `json:"input,required"`
  467. Output float64 `json:"output,required"`
  468. CacheRead float64 `json:"cache_read"`
  469. CacheWrite float64 `json:"cache_write"`
  470. JSON configProviderModelsCostJSON `json:"-"`
  471. }
  472. // configProviderModelsCostJSON contains the JSON metadata for the struct
  473. // [ConfigProviderModelsCost]
  474. type configProviderModelsCostJSON struct {
  475. Input apijson.Field
  476. Output apijson.Field
  477. CacheRead apijson.Field
  478. CacheWrite apijson.Field
  479. raw string
  480. ExtraFields map[string]apijson.Field
  481. }
  482. func (r *ConfigProviderModelsCost) UnmarshalJSON(data []byte) (err error) {
  483. return apijson.UnmarshalRoot(data, r)
  484. }
  485. func (r configProviderModelsCostJSON) RawJSON() string {
  486. return r.raw
  487. }
  488. type ConfigProviderModelsLimit struct {
  489. Context float64 `json:"context,required"`
  490. Output float64 `json:"output,required"`
  491. JSON configProviderModelsLimitJSON `json:"-"`
  492. }
  493. // configProviderModelsLimitJSON contains the JSON metadata for the struct
  494. // [ConfigProviderModelsLimit]
  495. type configProviderModelsLimitJSON struct {
  496. Context apijson.Field
  497. Output apijson.Field
  498. raw string
  499. ExtraFields map[string]apijson.Field
  500. }
  501. func (r *ConfigProviderModelsLimit) UnmarshalJSON(data []byte) (err error) {
  502. return apijson.UnmarshalRoot(data, r)
  503. }
  504. func (r configProviderModelsLimitJSON) RawJSON() string {
  505. return r.raw
  506. }
  507. type ConfigProviderOptions struct {
  508. APIKey string `json:"apiKey"`
  509. BaseURL string `json:"baseURL"`
  510. ExtraFields map[string]interface{} `json:"-,extras"`
  511. JSON configProviderOptionsJSON `json:"-"`
  512. }
  513. // configProviderOptionsJSON contains the JSON metadata for the struct
  514. // [ConfigProviderOptions]
  515. type configProviderOptionsJSON struct {
  516. APIKey apijson.Field
  517. BaseURL apijson.Field
  518. raw string
  519. ExtraFields map[string]apijson.Field
  520. }
  521. func (r *ConfigProviderOptions) UnmarshalJSON(data []byte) (err error) {
  522. return apijson.UnmarshalRoot(data, r)
  523. }
  524. func (r configProviderOptionsJSON) RawJSON() string {
  525. return r.raw
  526. }
  527. // Control sharing behavior:'manual' allows manual sharing via commands, 'auto'
  528. // enables automatic sharing, 'disabled' disables all sharing
  529. type ConfigShare string
  530. const (
  531. ConfigShareManual ConfigShare = "manual"
  532. ConfigShareAuto ConfigShare = "auto"
  533. ConfigShareDisabled ConfigShare = "disabled"
  534. )
  535. func (r ConfigShare) IsKnown() bool {
  536. switch r {
  537. case ConfigShareManual, ConfigShareAuto, ConfigShareDisabled:
  538. return true
  539. }
  540. return false
  541. }
  542. type KeybindsConfig struct {
  543. // Exit the application
  544. AppExit string `json:"app_exit,required"`
  545. // Show help dialog
  546. AppHelp string `json:"app_help,required"`
  547. // Open external editor
  548. EditorOpen string `json:"editor_open,required"`
  549. // Close file
  550. FileClose string `json:"file_close,required"`
  551. // Split/unified diff
  552. FileDiffToggle string `json:"file_diff_toggle,required"`
  553. // List files
  554. FileList string `json:"file_list,required"`
  555. // Search file
  556. FileSearch string `json:"file_search,required"`
  557. // Clear input field
  558. InputClear string `json:"input_clear,required"`
  559. // Insert newline in input
  560. InputNewline string `json:"input_newline,required"`
  561. // Paste from clipboard
  562. InputPaste string `json:"input_paste,required"`
  563. // Submit input
  564. InputSubmit string `json:"input_submit,required"`
  565. // Leader key for keybind combinations
  566. Leader string `json:"leader,required"`
  567. // Copy message
  568. MessagesCopy string `json:"messages_copy,required"`
  569. // Navigate to first message
  570. MessagesFirst string `json:"messages_first,required"`
  571. // Scroll messages down by half page
  572. MessagesHalfPageDown string `json:"messages_half_page_down,required"`
  573. // Scroll messages up by half page
  574. MessagesHalfPageUp string `json:"messages_half_page_up,required"`
  575. // Navigate to last message
  576. MessagesLast string `json:"messages_last,required"`
  577. // Toggle layout
  578. MessagesLayoutToggle string `json:"messages_layout_toggle,required"`
  579. // Navigate to next message
  580. MessagesNext string `json:"messages_next,required"`
  581. // Scroll messages down by one page
  582. MessagesPageDown string `json:"messages_page_down,required"`
  583. // Scroll messages up by one page
  584. MessagesPageUp string `json:"messages_page_up,required"`
  585. // Navigate to previous message
  586. MessagesPrevious string `json:"messages_previous,required"`
  587. // Redo message
  588. MessagesRedo string `json:"messages_redo,required"`
  589. // @deprecated use messages_undo. Revert message
  590. MessagesRevert string `json:"messages_revert,required"`
  591. // Undo message
  592. MessagesUndo string `json:"messages_undo,required"`
  593. // List available models
  594. ModelList string `json:"model_list,required"`
  595. // Create/update AGENTS.md
  596. ProjectInit string `json:"project_init,required"`
  597. // Compact the session
  598. SessionCompact string `json:"session_compact,required"`
  599. // Export session to editor
  600. SessionExport string `json:"session_export,required"`
  601. // Interrupt current session
  602. SessionInterrupt string `json:"session_interrupt,required"`
  603. // List all sessions
  604. SessionList string `json:"session_list,required"`
  605. // Create a new session
  606. SessionNew string `json:"session_new,required"`
  607. // Share current session
  608. SessionShare string `json:"session_share,required"`
  609. // Unshare current session
  610. SessionUnshare string `json:"session_unshare,required"`
  611. // Next mode
  612. SwitchMode string `json:"switch_mode,required"`
  613. // Previous Mode
  614. SwitchModeReverse string `json:"switch_mode_reverse,required"`
  615. // List available themes
  616. ThemeList string `json:"theme_list,required"`
  617. // Toggle tool details
  618. ToolDetails string `json:"tool_details,required"`
  619. JSON keybindsConfigJSON `json:"-"`
  620. }
  621. // keybindsConfigJSON contains the JSON metadata for the struct [KeybindsConfig]
  622. type keybindsConfigJSON struct {
  623. AppExit apijson.Field
  624. AppHelp apijson.Field
  625. EditorOpen apijson.Field
  626. FileClose apijson.Field
  627. FileDiffToggle apijson.Field
  628. FileList apijson.Field
  629. FileSearch apijson.Field
  630. InputClear apijson.Field
  631. InputNewline apijson.Field
  632. InputPaste apijson.Field
  633. InputSubmit apijson.Field
  634. Leader apijson.Field
  635. MessagesCopy apijson.Field
  636. MessagesFirst apijson.Field
  637. MessagesHalfPageDown apijson.Field
  638. MessagesHalfPageUp apijson.Field
  639. MessagesLast apijson.Field
  640. MessagesLayoutToggle apijson.Field
  641. MessagesNext apijson.Field
  642. MessagesPageDown apijson.Field
  643. MessagesPageUp apijson.Field
  644. MessagesPrevious apijson.Field
  645. MessagesRedo apijson.Field
  646. MessagesRevert apijson.Field
  647. MessagesUndo apijson.Field
  648. ModelList apijson.Field
  649. ProjectInit apijson.Field
  650. SessionCompact apijson.Field
  651. SessionExport apijson.Field
  652. SessionInterrupt apijson.Field
  653. SessionList apijson.Field
  654. SessionNew apijson.Field
  655. SessionShare apijson.Field
  656. SessionUnshare apijson.Field
  657. SwitchMode apijson.Field
  658. SwitchModeReverse apijson.Field
  659. ThemeList apijson.Field
  660. ToolDetails apijson.Field
  661. raw string
  662. ExtraFields map[string]apijson.Field
  663. }
  664. func (r *KeybindsConfig) UnmarshalJSON(data []byte) (err error) {
  665. return apijson.UnmarshalRoot(data, r)
  666. }
  667. func (r keybindsConfigJSON) RawJSON() string {
  668. return r.raw
  669. }
  670. type McpLocalConfig struct {
  671. // Command and arguments to run the MCP server
  672. Command []string `json:"command,required"`
  673. // Type of MCP server connection
  674. Type McpLocalConfigType `json:"type,required"`
  675. // Enable or disable the MCP server on startup
  676. Enabled bool `json:"enabled"`
  677. // Environment variables to set when running the MCP server
  678. Environment map[string]string `json:"environment"`
  679. JSON mcpLocalConfigJSON `json:"-"`
  680. }
  681. // mcpLocalConfigJSON contains the JSON metadata for the struct [McpLocalConfig]
  682. type mcpLocalConfigJSON struct {
  683. Command apijson.Field
  684. Type apijson.Field
  685. Enabled apijson.Field
  686. Environment apijson.Field
  687. raw string
  688. ExtraFields map[string]apijson.Field
  689. }
  690. func (r *McpLocalConfig) UnmarshalJSON(data []byte) (err error) {
  691. return apijson.UnmarshalRoot(data, r)
  692. }
  693. func (r mcpLocalConfigJSON) RawJSON() string {
  694. return r.raw
  695. }
  696. func (r McpLocalConfig) implementsConfigMcp() {}
  697. // Type of MCP server connection
  698. type McpLocalConfigType string
  699. const (
  700. McpLocalConfigTypeLocal McpLocalConfigType = "local"
  701. )
  702. func (r McpLocalConfigType) IsKnown() bool {
  703. switch r {
  704. case McpLocalConfigTypeLocal:
  705. return true
  706. }
  707. return false
  708. }
  709. type McpRemoteConfig struct {
  710. // Type of MCP server connection
  711. Type McpRemoteConfigType `json:"type,required"`
  712. // URL of the remote MCP server
  713. URL string `json:"url,required"`
  714. // Enable or disable the MCP server on startup
  715. Enabled bool `json:"enabled"`
  716. // Headers to send with the request
  717. Headers map[string]string `json:"headers"`
  718. JSON mcpRemoteConfigJSON `json:"-"`
  719. }
  720. // mcpRemoteConfigJSON contains the JSON metadata for the struct [McpRemoteConfig]
  721. type mcpRemoteConfigJSON struct {
  722. Type apijson.Field
  723. URL apijson.Field
  724. Enabled apijson.Field
  725. Headers apijson.Field
  726. raw string
  727. ExtraFields map[string]apijson.Field
  728. }
  729. func (r *McpRemoteConfig) UnmarshalJSON(data []byte) (err error) {
  730. return apijson.UnmarshalRoot(data, r)
  731. }
  732. func (r mcpRemoteConfigJSON) RawJSON() string {
  733. return r.raw
  734. }
  735. func (r McpRemoteConfig) implementsConfigMcp() {}
  736. // Type of MCP server connection
  737. type McpRemoteConfigType string
  738. const (
  739. McpRemoteConfigTypeRemote McpRemoteConfigType = "remote"
  740. )
  741. func (r McpRemoteConfigType) IsKnown() bool {
  742. switch r {
  743. case McpRemoteConfigTypeRemote:
  744. return true
  745. }
  746. return false
  747. }
  748. type ModeConfig struct {
  749. Disable bool `json:"disable"`
  750. Model string `json:"model"`
  751. Prompt string `json:"prompt"`
  752. Temperature float64 `json:"temperature"`
  753. Tools map[string]bool `json:"tools"`
  754. JSON modeConfigJSON `json:"-"`
  755. }
  756. // modeConfigJSON contains the JSON metadata for the struct [ModeConfig]
  757. type modeConfigJSON struct {
  758. Disable apijson.Field
  759. Model apijson.Field
  760. Prompt apijson.Field
  761. Temperature apijson.Field
  762. Tools apijson.Field
  763. raw string
  764. ExtraFields map[string]apijson.Field
  765. }
  766. func (r *ModeConfig) UnmarshalJSON(data []byte) (err error) {
  767. return apijson.UnmarshalRoot(data, r)
  768. }
  769. func (r modeConfigJSON) RawJSON() string {
  770. return r.raw
  771. }