Roo-Code/src/exports
2025-05-06 09:56:57 -07:00
..
api.ts Remove ModelInfo objects from settings (#2939) 2025-04-25 15:23:25 -07:00
interface.ts Fixes to resumeTask and isTaskInHistory (#2380) 2025-04-07 11:41:08 -04:00
ipc.ts Allow processes to access the Roo Code API via a unix socket (#2232) 2025-04-02 12:42:00 -07:00
log.ts Allow processes to access the Roo Code API via a unix socket (#2232) 2025-04-02 12:42:00 -07:00
README.md ContextProxy fix - constructor should not be async 2025-03-11 14:24:21 -07:00
roo-code.d.ts Enable Gemini prompt caching by default (#3225) 2025-05-06 09:56:57 -07:00
types.ts Enable Gemini prompt caching by default (#3225) 2025-05-06 09:56:57 -07:00

Roo Code API

The Roo Code extension exposes an API that can be used by other extensions. To use this API in your extension:

  1. Copy src/extension-api/roo-code.d.ts to your extension's source directory.
  2. Include roo-code.d.ts in your extension's compilation.
  3. Get access to the API with the following code:
const extension = vscode.extensions.getExtension<RooCodeAPI>("rooveterinaryinc.roo-cline")

if (!extension?.isActive) {
	throw new Error("Extension is not activated")
}

const api = extension.exports

if (!api) {
	throw new Error("API is not available")
}

// Start a new task with an initial message.
await api.startNewTask("Hello, Roo Code API! Let's make a new project...")

// Start a new task with an initial message and images.
await api.startNewTask("Use this design language", ["data:image/webp;base64,..."])

// Send a message to the current task.
await api.sendMessage("Can you fix the @problems?")

// Simulate pressing the primary button in the chat interface (e.g. 'Save' or 'Proceed While Running').
await api.pressPrimaryButton()

// Simulate pressing the secondary button in the chat interface (e.g. 'Reject').
await api.pressSecondaryButton()

NOTE: To ensure that the rooveterinaryinc.roo-cline extension is activated before your extension, add it to the extensionDependencies in your package.json:

"extensionDependencies": ["rooveterinaryinc.roo-cline"]

For detailed information on the available methods and their usage, refer to the roo-code.d.ts file.