AI & Agent
AI & Agent
Info
The AI & Agent API provides the eIsland AI assistant capabilities, including cloud-hosted agent chat, local Ollama integration, custom API direct chat, Claude Code monitoring, and Codex integration. All methods are exposed on window.api via the Electron preload bridge.
Agent Local Tools
executeAgentLocalTool
Executes a local tool in the main process on behalf of the AI agent.
window.api.executeAgentLocalTool(request: ExecuteAgentLocalToolRequest): Promise<ExecuteAgentLocalToolResult>| Parameter | Type | Description |
|---|---|---|
request | ExecuteAgentLocalToolRequest | Tool name and arguments |
Returns:
| Type | Description |
|---|---|
Promise<ExecuteAgentLocalToolResult> | Tool execution result |
Important
This is the bridge between the cloud-hosted AI agent and local system capabilities (e.g., taking screenshots, reading files, controlling volume). The main process routes the request to the appropriate local handler.
Ollama (Local LLM)
Info
Ollama integration allows running local LLMs for privacy-sensitive or offline AI chat. Each chat session gets a unique session ID and a dedicated event channel.
ollamaPing
Checks if the Ollama server is reachable.
window.api.ollamaPing(): Promise<boolean>Returns:
| Type | Description |
|---|---|
Promise<boolean> | true if Ollama is running and reachable |
ollamaModels
Lists available Ollama models.
window.api.ollamaModels(): Promise<string[]>Returns:
| Type | Description |
|---|---|
Promise<string[]> | Array of model names |
ollamaDetectBaseUrl
Auto-detects the Ollama server base URL.
window.api.ollamaDetectBaseUrl(): Promise<string | null>Returns:
| Type | Description |
|---|---|
Promise<string | null> | Detected base URL, or null if not found |
ollamaChatStart
Starts a new Ollama chat session.
window.api.ollamaChatStart(request: OllamaChatRequest): Promise<ChatStartResult>| Parameter | Type | Description |
|---|---|---|
request | OllamaChatRequest | Model, messages, and options |
Returns:
| Type | Description |
|---|---|
Promise<ChatStartResult> | { sessionId: string } |
ollamaChatAbort
Aborts a running Ollama chat session.
window.api.ollamaChatAbort(sessionId: string): Promise<ChatAbortResult>| Parameter | Type | Description |
|---|---|---|
sessionId | string | Session ID from ollamaChatStart |
onOllamaChatEvent
Listens for streaming events from an Ollama chat session.
window.api.onOllamaChatEvent(sessionId: string, callback: (event: ChatEvent) => void): () => void| Parameter | Type | Description |
|---|---|---|
sessionId | string | Session ID from ollamaChatStart |
callback | (event: ChatEvent) => void | Called for each streaming event |
Returns: Unsubscribe function.
Tips
Each session gets a dedicated IPC channel (ollama:chat:event:{sessionId}). Always unsubscribe in useEffect cleanup to prevent leaks.
Custom Direct API
Info
Custom Direct allows connecting to any OpenAI-compatible API endpoint (e.g., DeepSeek, MiMo, MiniMax) without using the cloud agent gateway.
customDirectChatStart
Starts a new custom direct chat session.
window.api.customDirectChatStart(request: CustomDirectChatRequest): Promise<ChatStartResult>| Parameter | Type | Description |
|---|---|---|
request | CustomDirectChatRequest | API URL, key, model, messages, and options |
customDirectChatAbort
Aborts a running custom direct chat session.
window.api.customDirectChatAbort(sessionId: string): Promise<ChatAbortResult>onCustomDirectChatEvent
Listens for streaming events from a custom direct chat session.
window.api.onCustomDirectChatEvent(sessionId: string, callback: (event: ChatEvent) => void): () => voidNote
Custom Direct uses the same ChatEvent type as Ollama. The event channel pattern is customDirect:chat:event:{sessionId}.
Voice Input
| Getter | Setter | Type | Description |
|---|---|---|---|
agentVoiceInputHotkeyGet | agentVoiceInputHotkeySet | string | Hotkey for voice input activation |
onAgentVoiceInputState
Listens for voice input state changes.
window.api.onAgentVoiceInputState(callback: (state: string) => void): () => voidonExternalAgentStarted
Listens for external agent session start events.
window.api.onExternalAgentStarted(callback: (data: ExternalAgentData) => void): () => voidonExternalAgentStopped
Listens for external agent session stop events.
window.api.onExternalAgentStopped(callback: (data: ExternalAgentData) => void): () => voidClaude Code Integration
Important
Claude Code integration monitors CLI sessions running on the user's machine. It streams events (tool calls, permission requests, session lifecycle) to the renderer for display in the island's CLI state.
claudeCodeStatusGet
Returns the current Claude Code status snapshot.
window.api.claudeCodeStatusGet(): Promise<ClaudeCodeStatusSnapshot>Returns:
| Type | Description |
|---|---|
Promise<ClaudeCodeStatusSnapshot> | Active sessions, hook status, and recent events |
claudeCodeHookInstall
Installs the Claude Code hook for event streaming.
window.api.claudeCodeHookInstall(): Promise<ClaudeCodeHookMutationResult>Returns:
| Type | Description |
|---|---|
Promise<ClaudeCodeHookMutationResult> | Success/failure status |
claudeCodeHookUninstall
Removes the Claude Code hook.
window.api.claudeCodeHookUninstall(): Promise<ClaudeCodeHookMutationResult>claudeCodeEventsClear
Clears all stored Claude Code events.
window.api.claudeCodeEventsClear(): Promise<void>claudeCodeSessionsDelete
Deletes all stored Claude Code session data.
window.api.claudeCodeSessionsDelete(): Promise<void>claudeCodePermissionResolve
Resolves a pending permission request from Claude Code.
window.api.claudeCodePermissionResolve(
sessionId: string,
decision: 'allow' | 'always' | 'deny'
): Promise<void>| Parameter | Type | Description |
|---|---|---|
sessionId | string | Session ID with the pending permission |
decision | 'allow' | 'always' | 'deny' | User's permission decision |
Warning
'allow' grants permission once; 'always' grants it for all future requests in the session; 'deny' rejects the tool call. The decision is irreversible.
onClaudeCodeStatusUpdated
Listens for Claude Code status changes.
window.api.onClaudeCodeStatusUpdated(callback: (snapshot: ClaudeCodeStatusSnapshot) => void): () => voidCodex Integration
Info
Codex integration provides the same monitoring capabilities as Claude Code, adapted for OpenAI's Codex CLI.
codexStatusGet
Returns the current Codex status snapshot.
window.api.codexStatusGet(): Promise<CodexStatusSnapshot>codexMonitorEnable
Enables Codex session monitoring.
window.api.codexMonitorEnable(): Promise<CodexMonitorMutationResult>codexMonitorDisable
Disables Codex session monitoring.
window.api.codexMonitorDisable(): Promise<CodexMonitorMutationResult>codexEventsClear
Clears all stored Codex events.
window.api.codexEventsClear(): Promise<void>codexSessionsDelete
Deletes all stored Codex session data.
window.api.codexSessionsDelete(): Promise<void>onCodexStatusUpdated
Listens for Codex status changes.
window.api.onCodexStatusUpdated(callback: (snapshot: CodexStatusSnapshot) => void): () => voidTips
Claude Code and Codex share the same type aliases (ClaudeCodeStatusSnapshot / CodexStatusSnapshot). The renderer uses a unified CLI state to display both providers.
Changelog
5296a-on

