mirror of
https://github.com/RooVetGit/Roo-Code.git
synced 2026-08-28 05:27:24 +00:00
fix: add RooCodeAPI interface for e2e tests compatibility
This commit is contained in:
parent
c2cc9643e1
commit
3457ecbba3
2 changed files with 47 additions and 1 deletions
|
|
@ -2,6 +2,10 @@
|
|||
* API for programmatic MCP server operations
|
||||
*/
|
||||
|
||||
import type { EventEmitter } from "events"
|
||||
import type { RooCodeEvents } from "./events.js"
|
||||
import type { RooCodeSettings, ProviderSettings, ProviderSettingsEntry } from "./index.js"
|
||||
|
||||
/**
|
||||
* Interface for MCP operations that can be accessed programmatically
|
||||
*/
|
||||
|
|
@ -13,6 +17,47 @@ export interface McpApi {
|
|||
refreshMcpServers(): Promise<void>
|
||||
}
|
||||
|
||||
/**
|
||||
* Main API interface for Roo Code extension
|
||||
*/
|
||||
export interface RooCodeAPI extends EventEmitter<RooCodeEvents>, McpApi {
|
||||
// Task Management
|
||||
startNewTask(options: {
|
||||
configuration: RooCodeSettings
|
||||
text?: string
|
||||
images?: string[]
|
||||
newTab?: boolean
|
||||
}): Promise<string>
|
||||
resumeTask(taskId: string): Promise<void>
|
||||
isTaskInHistory(taskId: string): Promise<boolean>
|
||||
getCurrentTaskStack(): unknown
|
||||
clearCurrentTask(lastMessage?: string): Promise<void>
|
||||
cancelCurrentTask(): Promise<void>
|
||||
cancelTask(taskId: string): Promise<void>
|
||||
|
||||
// Messaging
|
||||
sendMessage(text?: string, images?: string[]): Promise<void>
|
||||
pressPrimaryButton(): Promise<void>
|
||||
pressSecondaryButton(): Promise<void>
|
||||
|
||||
// State
|
||||
isReady(): boolean
|
||||
|
||||
// Configuration
|
||||
getConfiguration(): RooCodeSettings
|
||||
setConfiguration(values: RooCodeSettings): Promise<void>
|
||||
|
||||
// Profile Management
|
||||
getProfiles(): string[]
|
||||
getProfileEntry(name: string): ProviderSettingsEntry | undefined
|
||||
createProfile(name: string, profile?: ProviderSettings, activate?: boolean): Promise<string>
|
||||
updateProfile(name: string, profile: ProviderSettings, activate?: boolean): Promise<string | undefined>
|
||||
upsertProfile(name: string, profile: ProviderSettings, activate?: boolean): Promise<string | undefined>
|
||||
deleteProfile(name: string): Promise<void>
|
||||
getActiveProfile(): string | undefined
|
||||
setActiveProfile(name: string): Promise<string | undefined>
|
||||
}
|
||||
|
||||
/**
|
||||
* Global MCP API instance that will be set by the extension
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ import * as vscode from "vscode"
|
|||
import {
|
||||
type RooCodeSettings,
|
||||
type RooCodeEvents,
|
||||
type RooCodeAPI,
|
||||
type ProviderSettings,
|
||||
type ProviderSettingsEntry,
|
||||
type TaskEvent,
|
||||
|
|
@ -26,7 +27,7 @@ import { Package } from "../shared/package"
|
|||
import { ClineProvider } from "../core/webview/ClineProvider"
|
||||
import { openClineInNewTab } from "../activate/registerCommands"
|
||||
|
||||
export class API extends EventEmitter<RooCodeEvents> implements McpApi {
|
||||
export class API extends EventEmitter<RooCodeEvents> implements RooCodeAPI {
|
||||
private readonly outputChannel: vscode.OutputChannel
|
||||
private readonly sidebarProvider: ClineProvider
|
||||
private readonly context: vscode.ExtensionContext
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue