Skip to content

Commit 3457ecb

Browse files
committed
fix: add RooCodeAPI interface for e2e tests compatibility
1 parent c2cc964 commit 3457ecb

File tree

2 files changed

+47
-1
lines changed

2 files changed

+47
-1
lines changed

packages/types/src/api.ts

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
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
*/

src/extension/api.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import * as vscode from "vscode"
88
import {
99
type RooCodeSettings,
1010
type RooCodeEvents,
11+
type RooCodeAPI,
1112
type ProviderSettings,
1213
type ProviderSettingsEntry,
1314
type TaskEvent,
@@ -26,7 +27,7 @@ import { Package } from "../shared/package"
2627
import { ClineProvider } from "../core/webview/ClineProvider"
2728
import { openClineInNewTab } from "../activate/registerCommands"
2829

29-
export class API extends EventEmitter<RooCodeEvents> implements McpApi {
30+
export class API extends EventEmitter<RooCodeEvents> implements RooCodeAPI {
3031
private readonly outputChannel: vscode.OutputChannel
3132
private readonly sidebarProvider: ClineProvider
3233
private readonly context: vscode.ExtensionContext

0 commit comments

Comments
 (0)