<!-- Source: https://docs.biosimulant.com/references/desktop-plugins -->

# Desktop Plugins

Biosimulant Desktop supports a plugin system that lets developers extend the desktop app with new capabilities. Plugins are standalone packages distributed through the Biosimulant plugin registry (or installed locally) and have **zero compile-time coupling** with the desktop app.

Plugins can:

- Add sidebar items and full-page views to the desktop app
- Contribute panels to the lab detail sidebar
- Provide agent or tool capabilities via a JSON-RPC sidecar process
- Declare permissions and request user approval at runtime

**Info:**

  Plugins are runtime-installable packages. The desktop app discovers and renders plugin UI contributions dynamically based on the plugin's `kind`. It never imports plugin-specific code at build time.

## Architecture

```
┌─────────────────────────────────────────────────┐
│ Biosimulant Desktop (Tauri)                     │
│                                                 │
│  ┌───────────┐    JSON-RPC     ┌─────────────┐  │
│  │ Plugin    │◄───(stdio)────►│ Plugin      │  │
│  │ Host      │                │ Process     │  │
│  │ (Rust)    │                │ (your code) │  │
│  └───────────┘                └─────────────┘  │
│       │                                         │
│       ▼                                         │
│  ┌───────────┐                                  │
│  │ React UI  │  Renders generic views based     │
│  │ (dynamic) │  on plugin kind + contributions  │
│  └───────────┘                                  │
└─────────────────────────────────────────────────┘
```

The desktop app manages plugin lifecycles: installation, permissions, process spawning, and UI rendering. Your plugin is a standalone process that communicates with the host over stdin/stdout using JSON-RPC 2.0.

## Plugin Kinds

| Kind | Description | UI Support |
|------|-------------|------------|
| `agent_provider` | AI agent that can run sessions, send turns, and handle approvals | Full-page view, lab sidepanel, sidebar icon |
| `tool_provider` | Utility tool that provides capabilities via JSON-RPC methods | Settings section, sidebar icon (if contributed) |

## Quick Links

- [Plugin Manifest](/references/desktop-plugins/manifest)
- [Runtime & JSON-RPC](/references/desktop-plugins/runtime)
- [UI Contributions](/references/desktop-plugins/ui-contributions)
- [Packaging & Distribution](/references/desktop-plugins/packaging)
- [Reference Examples](/examples/desktop-plugin-samples)

## Workflow Summary

1. **Create** a `plugin.json` manifest and your entrypoint script
2. **Implement** the JSON-RPC protocol (at minimum `plugin/health` and `plugin/shutdown`)
3. **Package** into a `.bsiplugin` archive using the build script
4. **Install** locally in the desktop app for testing, or upload to the registry for distribution
5. Users **discover** your plugin in the marketplace and install it
