config.ts 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448
  1. // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
  2. import { APIResource } from '../core/resource';
  3. import * as ConfigAPI from './config';
  4. import { APIPromise } from '../core/api-promise';
  5. import { RequestOptions } from '../internal/request-options';
  6. export class ConfigResource extends APIResource {
  7. /**
  8. * Get config info
  9. */
  10. get(options?: RequestOptions): APIPromise<Config> {
  11. return this._client.get('/config', options);
  12. }
  13. }
  14. export interface Config {
  15. /**
  16. * JSON schema reference for configuration validation
  17. */
  18. $schema?: string;
  19. /**
  20. * @deprecated Use 'share' field instead. Share newly created sessions
  21. * automatically
  22. */
  23. autoshare?: boolean;
  24. /**
  25. * Automatically update to the latest version
  26. */
  27. autoupdate?: boolean;
  28. /**
  29. * Disable providers that are loaded automatically
  30. */
  31. disabled_providers?: Array<string>;
  32. experimental?: Config.Experimental;
  33. /**
  34. * Additional instruction files or patterns to include
  35. */
  36. instructions?: Array<string>;
  37. /**
  38. * Custom keybind configurations
  39. */
  40. keybinds?: KeybindsConfig;
  41. /**
  42. * @deprecated Always uses stretch layout.
  43. */
  44. layout?: 'auto' | 'stretch';
  45. /**
  46. * MCP (Model Context Protocol) server configurations
  47. */
  48. mcp?: { [key: string]: McpLocalConfig | McpRemoteConfig };
  49. /**
  50. * Modes configuration, see https://opencode.ai/docs/modes
  51. */
  52. mode?: Config.Mode;
  53. /**
  54. * Model to use in the format of provider/model, eg anthropic/claude-2
  55. */
  56. model?: string;
  57. /**
  58. * Custom provider configurations and model overrides
  59. */
  60. provider?: { [key: string]: Config.Provider };
  61. /**
  62. * Control sharing behavior:'manual' allows manual sharing via commands, 'auto'
  63. * enables automatic sharing, 'disabled' disables all sharing
  64. */
  65. share?: 'manual' | 'auto' | 'disabled';
  66. /**
  67. * Small model to use for tasks like summarization and title generation in the
  68. * format of provider/model
  69. */
  70. small_model?: string;
  71. /**
  72. * Theme name to use for the interface
  73. */
  74. theme?: string;
  75. /**
  76. * Custom username to display in conversations instead of system username
  77. */
  78. username?: string;
  79. }
  80. export namespace Config {
  81. export interface Experimental {
  82. hook?: Experimental.Hook;
  83. }
  84. export namespace Experimental {
  85. export interface Hook {
  86. file_edited?: { [key: string]: Array<Hook.FileEdited> };
  87. session_completed?: Array<Hook.SessionCompleted>;
  88. }
  89. export namespace Hook {
  90. export interface FileEdited {
  91. command: Array<string>;
  92. environment?: { [key: string]: string };
  93. }
  94. export interface SessionCompleted {
  95. command: Array<string>;
  96. environment?: { [key: string]: string };
  97. }
  98. }
  99. }
  100. /**
  101. * Modes configuration, see https://opencode.ai/docs/modes
  102. */
  103. export interface Mode {
  104. build?: ConfigAPI.ModeConfig;
  105. plan?: ConfigAPI.ModeConfig;
  106. [k: string]: ConfigAPI.ModeConfig | undefined;
  107. }
  108. export interface Provider {
  109. models: { [key: string]: Provider.Models };
  110. id?: string;
  111. api?: string;
  112. env?: Array<string>;
  113. name?: string;
  114. npm?: string;
  115. options?: { [key: string]: unknown };
  116. }
  117. export namespace Provider {
  118. export interface Models {
  119. id?: string;
  120. attachment?: boolean;
  121. cost?: Models.Cost;
  122. limit?: Models.Limit;
  123. name?: string;
  124. options?: { [key: string]: unknown };
  125. reasoning?: boolean;
  126. release_date?: string;
  127. temperature?: boolean;
  128. tool_call?: boolean;
  129. }
  130. export namespace Models {
  131. export interface Cost {
  132. input: number;
  133. output: number;
  134. cache_read?: number;
  135. cache_write?: number;
  136. }
  137. export interface Limit {
  138. context: number;
  139. output: number;
  140. }
  141. }
  142. }
  143. }
  144. export interface KeybindsConfig {
  145. /**
  146. * Exit the application
  147. */
  148. app_exit: string;
  149. /**
  150. * Show help dialog
  151. */
  152. app_help: string;
  153. /**
  154. * Open external editor
  155. */
  156. editor_open: string;
  157. /**
  158. * Close file
  159. */
  160. file_close: string;
  161. /**
  162. * Split/unified diff
  163. */
  164. file_diff_toggle: string;
  165. /**
  166. * List files
  167. */
  168. file_list: string;
  169. /**
  170. * Search file
  171. */
  172. file_search: string;
  173. /**
  174. * Clear input field
  175. */
  176. input_clear: string;
  177. /**
  178. * Insert newline in input
  179. */
  180. input_newline: string;
  181. /**
  182. * Paste from clipboard
  183. */
  184. input_paste: string;
  185. /**
  186. * Submit input
  187. */
  188. input_submit: string;
  189. /**
  190. * Leader key for keybind combinations
  191. */
  192. leader: string;
  193. /**
  194. * Copy message
  195. */
  196. messages_copy: string;
  197. /**
  198. * Navigate to first message
  199. */
  200. messages_first: string;
  201. /**
  202. * Scroll messages down by half page
  203. */
  204. messages_half_page_down: string;
  205. /**
  206. * Scroll messages up by half page
  207. */
  208. messages_half_page_up: string;
  209. /**
  210. * Navigate to last message
  211. */
  212. messages_last: string;
  213. /**
  214. * Toggle layout
  215. */
  216. messages_layout_toggle: string;
  217. /**
  218. * Navigate to next message
  219. */
  220. messages_next: string;
  221. /**
  222. * Scroll messages down by one page
  223. */
  224. messages_page_down: string;
  225. /**
  226. * Scroll messages up by one page
  227. */
  228. messages_page_up: string;
  229. /**
  230. * Navigate to previous message
  231. */
  232. messages_previous: string;
  233. /**
  234. * Redo message
  235. */
  236. messages_redo: string;
  237. /**
  238. * @deprecated use messages_undo. Revert message
  239. */
  240. messages_revert: string;
  241. /**
  242. * Undo message
  243. */
  244. messages_undo: string;
  245. /**
  246. * List available models
  247. */
  248. model_list: string;
  249. /**
  250. * Create/update AGENTS.md
  251. */
  252. project_init: string;
  253. /**
  254. * Compact the session
  255. */
  256. session_compact: string;
  257. /**
  258. * Export session to editor
  259. */
  260. session_export: string;
  261. /**
  262. * Interrupt current session
  263. */
  264. session_interrupt: string;
  265. /**
  266. * List all sessions
  267. */
  268. session_list: string;
  269. /**
  270. * Create a new session
  271. */
  272. session_new: string;
  273. /**
  274. * Share current session
  275. */
  276. session_share: string;
  277. /**
  278. * Unshare current session
  279. */
  280. session_unshare: string;
  281. /**
  282. * Next mode
  283. */
  284. switch_mode: string;
  285. /**
  286. * Previous Mode
  287. */
  288. switch_mode_reverse: string;
  289. /**
  290. * List available themes
  291. */
  292. theme_list: string;
  293. /**
  294. * Toggle tool details
  295. */
  296. tool_details: string;
  297. }
  298. export interface McpLocalConfig {
  299. /**
  300. * Command and arguments to run the MCP server
  301. */
  302. command: Array<string>;
  303. /**
  304. * Type of MCP server connection
  305. */
  306. type: 'local';
  307. /**
  308. * Enable or disable the MCP server on startup
  309. */
  310. enabled?: boolean;
  311. /**
  312. * Environment variables to set when running the MCP server
  313. */
  314. environment?: { [key: string]: string };
  315. }
  316. export interface McpRemoteConfig {
  317. /**
  318. * Type of MCP server connection
  319. */
  320. type: 'remote';
  321. /**
  322. * URL of the remote MCP server
  323. */
  324. url: string;
  325. /**
  326. * Enable or disable the MCP server on startup
  327. */
  328. enabled?: boolean;
  329. /**
  330. * Headers to send with the request
  331. */
  332. headers?: { [key: string]: string };
  333. }
  334. export interface ModeConfig {
  335. model?: string;
  336. prompt?: string;
  337. tools?: { [key: string]: boolean };
  338. }
  339. export declare namespace ConfigResource {
  340. export {
  341. type Config as Config,
  342. type KeybindsConfig as KeybindsConfig,
  343. type McpLocalConfig as McpLocalConfig,
  344. type McpRemoteConfig as McpRemoteConfig,
  345. type ModeConfig as ModeConfig,
  346. };
  347. }