22 * API for programmatic MCP server operations
33 */
44
5+ import type { EventEmitter } from "events"
6+ import type { RooCodeEvents } from "./events.js"
7+ import type { RooCodeSettings , ProviderSettings , ProviderSettingsEntry } from "./index.js"
8+
59/**
610 * Interface for MCP operations that can be accessed programmatically
711 */
@@ -13,6 +17,47 @@ export interface McpApi {
1317 refreshMcpServers ( ) : Promise < void >
1418}
1519
20+ /**
21+ * Main API interface for Roo Code extension
22+ */
23+ export interface RooCodeAPI extends EventEmitter < RooCodeEvents > , McpApi {
24+ // Task Management
25+ startNewTask ( options : {
26+ configuration : RooCodeSettings
27+ text ?: string
28+ images ?: string [ ]
29+ newTab ?: boolean
30+ } ) : Promise < string >
31+ resumeTask ( taskId : string ) : Promise < void >
32+ isTaskInHistory ( taskId : string ) : Promise < boolean >
33+ getCurrentTaskStack ( ) : unknown
34+ clearCurrentTask ( lastMessage ?: string ) : Promise < void >
35+ cancelCurrentTask ( ) : Promise < void >
36+ cancelTask ( taskId : string ) : Promise < void >
37+
38+ // Messaging
39+ sendMessage ( text ?: string , images ?: string [ ] ) : Promise < void >
40+ pressPrimaryButton ( ) : Promise < void >
41+ pressSecondaryButton ( ) : Promise < void >
42+
43+ // State
44+ isReady ( ) : boolean
45+
46+ // Configuration
47+ getConfiguration ( ) : RooCodeSettings
48+ setConfiguration ( values : RooCodeSettings ) : Promise < void >
49+
50+ // Profile Management
51+ getProfiles ( ) : string [ ]
52+ getProfileEntry ( name : string ) : ProviderSettingsEntry | undefined
53+ createProfile ( name : string , profile ?: ProviderSettings , activate ?: boolean ) : Promise < string >
54+ updateProfile ( name : string , profile : ProviderSettings , activate ?: boolean ) : Promise < string | undefined >
55+ upsertProfile ( name : string , profile : ProviderSettings , activate ?: boolean ) : Promise < string | undefined >
56+ deleteProfile ( name : string ) : Promise < void >
57+ getActiveProfile ( ) : string | undefined
58+ setActiveProfile ( name : string ) : Promise < string | undefined >
59+ }
60+
1661/**
1762 * Global MCP API instance that will be set by the extension
1863 */
0 commit comments