config.ts 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456
  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?: Provider.Options;
  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. export interface Options {
  143. apiKey?: string;
  144. baseURL?: string;
  145. [k: string]: unknown;
  146. }
  147. }
  148. }
  149. export interface KeybindsConfig {
  150. /**
  151. * Exit the application
  152. */
  153. app_exit: string;
  154. /**
  155. * Show help dialog
  156. */
  157. app_help: string;
  158. /**
  159. * Open external editor
  160. */
  161. editor_open: string;
  162. /**
  163. * Close file
  164. */
  165. file_close: string;
  166. /**
  167. * Split/unified diff
  168. */
  169. file_diff_toggle: string;
  170. /**
  171. * List files
  172. */
  173. file_list: string;
  174. /**
  175. * Search file
  176. */
  177. file_search: string;
  178. /**
  179. * Clear input field
  180. */
  181. input_clear: string;
  182. /**
  183. * Insert newline in input
  184. */
  185. input_newline: string;
  186. /**
  187. * Paste from clipboard
  188. */
  189. input_paste: string;
  190. /**
  191. * Submit input
  192. */
  193. input_submit: string;
  194. /**
  195. * Leader key for keybind combinations
  196. */
  197. leader: string;
  198. /**
  199. * Copy message
  200. */
  201. messages_copy: string;
  202. /**
  203. * Navigate to first message
  204. */
  205. messages_first: string;
  206. /**
  207. * Scroll messages down by half page
  208. */
  209. messages_half_page_down: string;
  210. /**
  211. * Scroll messages up by half page
  212. */
  213. messages_half_page_up: string;
  214. /**
  215. * Navigate to last message
  216. */
  217. messages_last: string;
  218. /**
  219. * Toggle layout
  220. */
  221. messages_layout_toggle: string;
  222. /**
  223. * Navigate to next message
  224. */
  225. messages_next: string;
  226. /**
  227. * Scroll messages down by one page
  228. */
  229. messages_page_down: string;
  230. /**
  231. * Scroll messages up by one page
  232. */
  233. messages_page_up: string;
  234. /**
  235. * Navigate to previous message
  236. */
  237. messages_previous: string;
  238. /**
  239. * Redo message
  240. */
  241. messages_redo: string;
  242. /**
  243. * @deprecated use messages_undo. Revert message
  244. */
  245. messages_revert: string;
  246. /**
  247. * Undo message
  248. */
  249. messages_undo: string;
  250. /**
  251. * List available models
  252. */
  253. model_list: string;
  254. /**
  255. * Create/update AGENTS.md
  256. */
  257. project_init: string;
  258. /**
  259. * Compact the session
  260. */
  261. session_compact: string;
  262. /**
  263. * Export session to editor
  264. */
  265. session_export: string;
  266. /**
  267. * Interrupt current session
  268. */
  269. session_interrupt: string;
  270. /**
  271. * List all sessions
  272. */
  273. session_list: string;
  274. /**
  275. * Create a new session
  276. */
  277. session_new: string;
  278. /**
  279. * Share current session
  280. */
  281. session_share: string;
  282. /**
  283. * Unshare current session
  284. */
  285. session_unshare: string;
  286. /**
  287. * Next mode
  288. */
  289. switch_mode: string;
  290. /**
  291. * Previous Mode
  292. */
  293. switch_mode_reverse: string;
  294. /**
  295. * List available themes
  296. */
  297. theme_list: string;
  298. /**
  299. * Toggle tool details
  300. */
  301. tool_details: string;
  302. }
  303. export interface McpLocalConfig {
  304. /**
  305. * Command and arguments to run the MCP server
  306. */
  307. command: Array<string>;
  308. /**
  309. * Type of MCP server connection
  310. */
  311. type: 'local';
  312. /**
  313. * Enable or disable the MCP server on startup
  314. */
  315. enabled?: boolean;
  316. /**
  317. * Environment variables to set when running the MCP server
  318. */
  319. environment?: { [key: string]: string };
  320. }
  321. export interface McpRemoteConfig {
  322. /**
  323. * Type of MCP server connection
  324. */
  325. type: 'remote';
  326. /**
  327. * URL of the remote MCP server
  328. */
  329. url: string;
  330. /**
  331. * Enable or disable the MCP server on startup
  332. */
  333. enabled?: boolean;
  334. /**
  335. * Headers to send with the request
  336. */
  337. headers?: { [key: string]: string };
  338. }
  339. export interface ModeConfig {
  340. model?: string;
  341. prompt?: string;
  342. tools?: { [key: string]: boolean };
  343. }
  344. export declare namespace ConfigResource {
  345. export {
  346. type Config as Config,
  347. type KeybindsConfig as KeybindsConfig,
  348. type McpLocalConfig as McpLocalConfig,
  349. type McpRemoteConfig as McpRemoteConfig,
  350. type ModeConfig as ModeConfig,
  351. };
  352. }