> ## Documentation Index
> Fetch the complete documentation index at: https://docs.mira-app.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# IPC Reference

> Complete reference for all Electron IPC channels exposed through window.api.

MIRA's renderer and main process communicate through a typed IPC bridge. The preload script exposes `window.api` using Electron's `contextBridge`. All channel names and payload types are defined in `src/shared/ipc-types.ts`.

## Usage pattern

```typescript theme={null}
// Invoke (request → response)
const result = await window.api.invoke('sessions:list', undefined)

// Event listener (main → renderer)
const unsubscribe = window.api.on('rlm:status-change', (payload) => {
  console.log(payload)
})
// cleanup
unsubscribe()
```

## Invoke channels

### Sessions & Messages

| Channel           | Description                           |
| ----------------- | ------------------------------------- |
| `sessions:list`   | List all sessions                     |
| `sessions:get`    | Get a session by ID                   |
| `sessions:create` | Create a new session                  |
| `sessions:update` | Update session title or pinned state  |
| `sessions:delete` | Delete a session and all its messages |
| `messages:list`   | List messages for a session           |
| `messages:add`    | Add a message to a session            |
| `messages:delete` | Delete a message                      |

### RLM Engine

| Channel       | Description                       |
| ------------- | --------------------------------- |
| `rlm:query`   | Send a prompt to the RLM engine   |
| `rlm:cancel`  | Cancel an in-flight RLM query     |
| `rlm:status`  | Get current RLM engine status     |
| `rlm:restart` | Restart the RLM Python subprocess |

### Native Agent Engine (NAE)

| Channel             | Description                                |
| ------------------- | ------------------------------------------ |
| `nae:query`         | Send a prompt to the NAE engine            |
| `nae:cancel`        | Cancel an in-flight NAE query              |
| `nae:status`        | Get current NAE engine status              |
| `nae:restart`       | Restart the NAE Python subprocess          |
| `nae:set-mode`      | Set NAE agent mode (single / multi / auto) |
| `nae:reset-session` | Reset NAE session context                  |

### Documents

| Channel                    | Description                                   |
| -------------------------- | --------------------------------------------- |
| `documents:list`           | List all uploaded documents                   |
| `documents:list-session`   | List documents active in a session            |
| `documents:upload`         | Upload and parse a new document               |
| `documents:remove`         | Remove a document                             |
| `documents:toggle-session` | Toggle a document's active state in a session |

### Skills

| Channel                   | Description                                |
| ------------------------- | ------------------------------------------ |
| `skills:list`             | List all skills                            |
| `skills:get`              | Get a skill by ID                          |
| `skills:create`           | Create a new custom skill                  |
| `skills:update`           | Update a skill                             |
| `skills:delete`           | Delete a skill                             |
| `skills:list-versions`    | List version history for a skill           |
| `skills:restore-version`  | Restore a previous skill version           |
| `skills:prune-versions`   | Delete old versions beyond retention limit |
| `skills:export`           | Export a skill as JSON                     |
| `skills:import`           | Import a skill from JSON                   |
| `skills:duplicate`        | Duplicate an existing skill                |
| `skills:get-session`      | Get the skill attached to a session        |
| `skills:apply-session`    | Attach a skill to a session                |
| `skills:detach-session`   | Remove the skill from a session            |
| `skills:open-file-dialog` | Open the OS file picker for import         |

### Workflows

| Channel                           | Description                                   |
| --------------------------------- | --------------------------------------------- |
| `workflows:list`                  | List all workflows                            |
| `workflows:get`                   | Get a workflow by ID                          |
| `workflows:create`                | Create a new workflow                         |
| `workflows:update`                | Update workflow metadata                      |
| `workflows:delete`                | Delete a workflow                             |
| `workflows:add-step`              | Add a step to a workflow                      |
| `workflows:update-step`           | Update an existing step                       |
| `workflows:delete-step`           | Remove a step                                 |
| `workflows:reorder-steps`         | Reorder all steps                             |
| `workflows:list-versions`         | List version history for a workflow           |
| `workflows:restore-version`       | Restore a previous workflow version           |
| `workflows:prune-versions`        | Delete old versions beyond retention limit    |
| `workflows:export`                | Export a workflow as JSON                     |
| `workflows:import`                | Import a workflow from JSON                   |
| `workflows:duplicate`             | Duplicate an existing workflow                |
| `workflows:get-session`           | Get the workflow attached to a session        |
| `workflows:apply-session`         | Attach a workflow to a session                |
| `workflows:detach-session`        | Remove the workflow from a session            |
| `workflows:advance-step`          | Advance to the next step (after human review) |
| `workflows:reset-session`         | Reset session workflow state                  |
| `workflows:update-session-status` | Update the workflow run status for a session  |
| `workflows:open-file-dialog`      | Open the OS file picker for import            |

### MCP Tools

| Channel                | Description                                        |
| ---------------------- | -------------------------------------------------- |
| `mcp:list`             | List all configured MCP servers                    |
| `mcp:add`              | Add a new MCP server                               |
| `mcp:update`           | Update an MCP server config                        |
| `mcp:remove`           | Remove an MCP server                               |
| `mcp:toggle`           | Enable or disable an MCP server globally           |
| `mcp:test`             | Test connectivity to an MCP server                 |
| `mcp:list-session`     | List MCP servers active in a session               |
| `mcp:toggle-session`   | Toggle an MCP server for a specific session        |
| `mcp:list-tools`       | List tools exposed by a connected server           |
| `mcp:save-secrets`     | Save secrets for an MCP server to the keychain     |
| `mcp:delete-secrets`   | Delete secrets for an MCP server from the keychain |
| `mcp:list-secret-keys` | List secret key names (not values) for a server    |

### Credentials

| Channel                    | Description                                      |
| -------------------------- | ------------------------------------------------ |
| `credentials:aws-status`   | Check if AWS credentials are stored              |
| `credentials:save-aws`     | Save AWS credentials to the keychain             |
| `credentials:clear-aws`    | Remove AWS credentials from the keychain         |
| `credentials:test-aws`     | Test AWS credentials via `sts:GetCallerIdentity` |
| `credentials:list-tokens`  | List stored API token key names                  |
| `credentials:save-token`   | Save an API token to the keychain                |
| `credentials:delete-token` | Remove an API token from the keychain            |

### Settings & App

| Channel            | Description                                      |
| ------------------ | ------------------------------------------------ |
| `settings:get`     | Read all app settings                            |
| `settings:save`    | Write app settings                               |
| `app:open-logs`    | Open the MIRA log directory in Finder / Explorer |
| `app:get-version`  | Get the installed MIRA version string            |
| `app:check-update` | Trigger an update check                          |
| `app:reset-data`   | Factory-reset all data (destructive)             |

### Eval Framework

| Channel                     | Description                                                         |
| --------------------------- | ------------------------------------------------------------------- |
| `eval:create`               | Create an eval definition                                           |
| `eval:update`               | Update an eval definition                                           |
| `eval:archive`              | Archive an eval definition                                          |
| `eval:list`                 | List all eval definitions                                           |
| `eval:get`                  | Get an eval definition by ID                                        |
| `eval:test`                 | Run a single test case against an eval (required before activation) |
| `eval:results:query`        | Query stored eval results                                           |
| `eval:results:run`          | Trigger a results scoring run                                       |
| `eval:results:export`       | Export results as CSV or JSON                                       |
| `eval:results:human-review` | Submit a human override score for a result                          |
| `eval:scores:run`           | Recompute aggregated scores for a run                               |
| `eval:profiles:list`        | List all eval profiles                                              |
| `eval:profiles:create`      | Create an eval profile                                              |
| `eval:profiles:update`      | Update an eval profile                                              |
| `eval:profiles:delete`      | Delete an eval profile                                              |
| `eval:settings:get`         | Read eval framework settings                                        |
| `eval:settings:save`        | Write eval framework settings                                       |
| `eval:cleanup:now`          | Prune old eval run data immediately                                 |
| `eval:workers:pause`        | Pause the background eval worker pool                               |
| `eval:workers:resume`       | Resume the background eval worker pool                              |
| `eval:workers:status`       | Get current worker pool status                                      |
| `eval:runs:list`            | List eval run records                                               |
| `eval:runs:summaries`       | Get aggregated summaries for eval runs                              |
| `eval:runs:delete`          | Delete an eval run and all its results                              |
| `eval:ab:compare`           | Compute an A/B diff between two runs                                |

### Other

| Channel          | Description                       |
| ---------------- | --------------------------------- |
| `dialog:confirm` | Show a native confirmation dialog |

***

## Event channels (main → renderer)

Listen with `window.api.on(channel, handler)`. The call returns an unsubscribe function.

### RLM Engine events

| Channel              | Description                                        |
| -------------------- | -------------------------------------------------- |
| `rlm:iteration`      | A single reasoning iteration completed (streaming) |
| `rlm:final`          | RLM produced a final answer for a query            |
| `rlm:error`          | RLM raised an error for a query                    |
| `rlm:warning`        | A non-fatal RLM warning                            |
| `rlm:status-change`  | RLM engine lifecycle state changed                 |
| `rlm:active-queries` | Updated count of in-flight RLM queries             |

### NAE events

| Channel              | Description                            |
| -------------------- | -------------------------------------- |
| `nae:chunk`          | A streamed token chunk from NAE        |
| `nae:final`          | NAE produced a final answer            |
| `nae:error`          | NAE raised an error                    |
| `nae:warning`        | A non-fatal NAE warning                |
| `nae:status-change`  | NAE engine lifecycle state changed     |
| `nae:active-queries` | Updated count of in-flight NAE queries |
| `nae:status-update`  | Detailed NAE status update             |
| `nae:tool-call`      | NAE is calling an MCP tool             |
| `nae:tool-result`    | An MCP tool call returned a result     |
| `nae:sub-agent`      | NAE spawned or completed a sub-agent   |
| `nae:token-budget`   | Current token budget usage update      |

### Workflow events

| Channel                  | Description                                  |
| ------------------------ | -------------------------------------------- |
| `workflow:step-start`    | A workflow step has begun executing          |
| `workflow:step-complete` | A workflow step completed successfully       |
| `workflow:complete`      | The entire workflow run completed            |
| `workflow:failed`        | The workflow run failed                      |
| `workflow:human-review`  | A `human_review` step is awaiting user input |

### Eval events

| Channel                | Description                              |
| ---------------------- | ---------------------------------------- |
| `eval:worker:status`   | Background worker pool status update     |
| `eval:complete`        | An eval run finished                     |
| `eval:throttle:status` | Eval throttle / rate-limit status update |

### Other events

| Channel                   | Description                          |
| ------------------------- | ------------------------------------ |
| `console:log`             | A log entry for the REPL Console     |
| `document:parse-progress` | Document parse status update         |
| `mcp:status-change`       | MCP server connection status changed |
| `app:update-available`    | A newer MIRA version is available    |
| `app:deep-link`           | App was opened via a deep link URL   |

<Note>
  Edit this page — [Open a pull
  request](https://github.com/satyendra2013/mira-app/edit/main/docs/developer-guide/ipc-reference.mdx)
</Note>
