Developer API
Complete reference for all IPC handlers, data models, and integration points. Use these APIs to extend Comet AI Browser with custom functionality.
50+
IPC Handlers
8
Categories
4
Data Models
5
Code Examples
Inter-Process Communication
IPC Handlers
All handlers are called via window.electron.invoke(channel, ...args).
Browser Control
7 handlers
get-open-tabsReturns all open tabs with their URLs and titles
navigate-to(url: string)Navigate the active tab to the specified URL
capture-browser-view-screenshotCapture screenshot of the current browser view
capture-page-htmlGet the raw HTML of the current page
extract-page-contentExtract readable text content from the page
find-and-click-text(text: string)Find text on page and click it
get-selected-textGet currently selected text in the browser
Type Definitions
Data Models
Task
Represents a scheduled automation task
| Field | Type | Description |
|---|---|---|
| id | string | Unique identifier |
| name | string | Human-readable task name |
| type | TaskType | pdf | scrape | prompt | workflow |
| trigger | Trigger | Scheduling configuration |
| config | TaskConfig | Task-specific configuration |
| enabled | boolean | Whether the task is active |
| priority | Priority | high | normal | low |
| model | string | AI model to use |
| outputDir | string | Output directory path |
| notifyOnComplete | boolean | Send notification on completion |
| lastRun | Date? | Last execution time |
| nextRun | Date? | Next scheduled execution |
| runCount | number | Total execution count |
| lastStatus | string? | success | failed | running |
| lastError | string? | Last error message |
Trigger
Defines when a task should execute
| Field | Type | Description |
|---|---|---|
| type | TriggerType | cron | once | interval |
| schedule | string? | Cron expression (for type=cron) |
| datetime | string? | ISO datetime (for type=once) |
| intervalMs | number? | Interval in milliseconds (for type=interval) |
| timezone | string? | Timezone (default: UTC) |
TaskConfig
Configuration for different task types
| Field | Type | Description |
|---|---|---|
| prompt | string? | AI prompt to execute |
| pdfOptions | PDFOptions? | PDF generation options |
| scrapeUrls | string[]? | URLs to scrape |
| workflowSteps | WorkflowStep[]? | Multi-step workflow definition |
| emailRecipients | string[]? | Email addresses to notify |
ShellResult
Result of a shell command execution
| Field | Type | Description |
|---|---|---|
| success | boolean | Whether the command succeeded |
| stdout | string | Standard output |
| stderr | string | Standard error |
| exitCode | number | Process exit code |
| duration | number | Execution time in ms |
Usage Examples
Code Snippets
Best Practices
Error Handling
Best Practices
- Always check the return value for success/error properties
- Wrap IPC calls in try-catch for network failures
- Use the status code to determine error type
- Implement retry logic for transient failures
- Log errors for debugging but don't expose to users
Security Notes
- Shell commands require risk level and reason
- High-risk actions need mobile approval via QR
- Never expose raw command strings to users
- Validate all inputs before passing to IPC
- Rate limit sensitive operations
Start Building
Use these APIs to extend Comet AI Browser with custom automations, integrations, and features.