Plugin Overview
A Sora plugin is an Android Kotlin module that adds capabilities to the Sora app: tools the agent can call, skills it can load, prompt sections, event hooks, and Compose UI. Plugins are compiled against the public SDK, packaged into a signed .ddp archive, and loaded inside the Sora app process after the package signature and manifest have been verified.
Nothing is compiled into the app: every plugin arrives as a .ddp file that the user imports. The current contract is plugin-api 2.0.2 with design 1.1.0, plugin API level 7, UI API level 3, and host Sora v0.1.0.
class HelloPlugin : SoraPlugin {
override suspend fun availability(host: PluginHost): PluginAvailability = available()
override fun contributions(host: PluginHost): Contributions = contributions(
tools = listOf(
pluginTool(
name = "hello",
description = "Return a greeting.",
parameters = buildJsonObject { put("type", "object") },
) { textResult("hello from a plugin") },
),
)
}What a plugin is
| Piece | Description |
|---|---|
| Language and runtime | Kotlin/JVM running on the Android runtime of the Sora app |
| Contract | io.github.sadami3066.sora:plugin-api:2.0.2, package io.github.sadami3066.sora.plugin.api |
| UI toolkit | Jetpack Compose through the shared design module (io.github.sadami3066.sora:design:1.1.0) |
| Package | A .ddp archive: classes*.dex + assets/** (including assets/plugin.json) + optional lib/**, signed with Ed25519 |
| Entry point | A class implementing SoraPlugin with a no-arg constructor, named by entryClass in the manifest |
| Identity | id (lowercase reverse domain) plus the publisher keyId derived from the signing key |
| Host | Sora v0.1.0, API level 7, UI API level 3 |
A plugin is not a separate app: the APK that produces the .ddp is only a build vehicle. Sora ignores the plugin APK's manifest, resources, and signature, and loads only the dex code and assets.
Host process model
Plugins run in the host process, with the host UID. There is no sandbox, no separate process, and no permission narrowing beyond what the declarations reveal.
- The host loads
classes*.dexwith an in-memory classloader and unpacksassets/**into the plugin's version directory.host.dataDiris a private directory that survives upgrades;host.assetsDiris the read-only assets directory of the installed version. - The host is parent-first:
plugin-api,design, Compose, coroutines, and serialization exist only in the host. Plugins declare them ascompileOnlyand never bundle them. - Plugin code can call every Android API the app has been granted, reflect into host internals, and terminate the process. Signatures, capabilities, permissions, and component declarations describe intent and drive the install confirmation; they are not a security boundary.
- Installs are per version: staging a new version keeps the previous one as a rollback point, and plugin runtime data stays in
dataDiracross upgrades. - Install is a trust decision: the first import shows the publisher,
keyId, whole-package SHA-256, size, and declared capabilities, and records the publisher with trust-on-first-use. Later updates must be signed with the same key.
Practical rule: install plugins from sources you trust, and use MCP servers for third-party tool sources you would not run as code.
What a plugin can contribute
| Contribution | API | Effect |
|---|---|---|
| Tools | contributions(host), contributionsFor(host, session) → PluginTool | Model-callable functions with JSON Schema parameters, renderable results, and streaming partials |
| Skills | skills(host) → PluginSkill | SKILL.md documents materialized into the agent skill directory |
| Prompt sections | promptSections(host) → PromptSection | Extra system-prompt text appended by priority |
| Prompt override | PromptOverridePlugin.promptOverride(host) (experimental) | Replaces the agent preamble, rules, or sections when the prompt capability is declared |
| Events and hooks | PluginHooks returned from Contributions | Observation callbacks plus prompt/input/tool transforms and gates |
| UI slots | ui(host) → SlotBinding | Compose content for a tool card or a custom message type |
| Tool result renderers | ui(host) implementing ToolResultRendererContributor | Compose cards for MCP, plugin, or built-in tool results |
| Pages | PluginUiContributions.pages → PluginPage | Full Compose screens with arguments, results, and a sheet presentation |
| Composer actions | PluginUiContributions.composerActions | Chips in the chat composer that open a plugin page |
| Custom message cards | chat().sendMessage(...), chat().postCustomMessage(...) | Cards written into the conversation as messages |
PluginHost is the only entry point a plugin gets. It exposes host services (Linux execution, files, network, device, notification, media, contacts, calendar, and so on), the plugin manifest, directories, a coroutine scope, and localized text resolution. See Runtime API.
Capability and permission model
Three manifest declarations describe what a plugin uses. They are validated at install time and shown on the confirmation page.
| Declaration | Meaning | Example |
|---|---|---|
capabilities (required) | Host services the plugin calls. An undeclared accessor throws PluginServiceUnavailable at runtime | ["settings", "device", "network", "logs"] |
permissions | Android runtime permissions and special grants the plugin will request | ["location.fine", "notifications.post"] |
components | Host-proxied platform components: background tasks, foreground services, notification listener, accessibility, share, deep links | {"background": true, "deeplinks": ["sync"]} |
Rules enforced by the host:
- A service accessor whose capability is not declared is not injected; calling it throws
PluginServiceUnavailable. - Every permission needs the capability that owns it (
PERMISSION_WITHOUT_CAPABILITY), and unknown or duplicate values are rejected (INVALID_PERMISSION). - Every enabled component needs its matching capability (
COMPONENT_WITHOUT_CAPABILITY), and deep link paths must be valid and unique (INVALID_DEEPLINK). - There are 39 capabilities: 18 base capabilities and 21 device/system capabilities. The full table with accessors and runtime models is in Runtime API → Capability mapping.
Capabilities are an availability boundary, not a sandbox: the host can refuse to inject a service, but it cannot stop plugin code from reaching the same capability another way. Declare honestly so users can judge the plugin before installing.
Lifecycle
A plugin moves through the following phases, visible on the Plugins page:
| Phase | Meaning |
|---|---|
INSTALLED | Installed but not loaded |
ACTIVE | Enabled and running; contributions are in effect |
DEGRADED | Enabled but availability() reports unavailable; skills are withheld and the reason is shown |
FAILED | Load, activation, or enable failed |
DISABLED | Turned off by the user or auto-disabled after repeated failures |
PENDING_RESTART | A new version is staged and activates when no session is busy |
The SoraPlugin callbacks:
| Callback | When it runs |
|---|---|
availability(host) | On every refresh; return unavailable("reason") to degrade |
onEnable(host) / onDisable(host) | When the user enables or disables the plugin, and on startup for enabled plugins |
onUpgrade(host, fromVersion) | While activating a new version, before it becomes current |
contributions(host) / contributionsFor(host, session) | When contributions are materialized (globally, and once per session) |
skills(host) / promptSections(host) / ui(host) | On refresh, only while the plugin is loaded and enabled |
uninstall(host) | Before the user deletes the plugin; clean up external side effects |
close() | On disable, uninstall, update, or process exit; the plugin scope is cancelled first |
Each plugin gets its own CoroutineScope (host.scope) with a SupervisorJob. Do not cache host or scope in plugin fields: a re-enabled plugin is loaded again and receives a new host. Long-running work belongs on host.scope, not in a page's lifecycle.
API level compatibility
The host enforces apiLevel at install and load time. The current line is level 7; the host accepts only 7, and an omitted apiLevel defaults to BASELINE_API_LEVEL (7).
| apiLevel | SDK | Host | Notes |
|---|---|---|---|
| 5 | plugin-api 0.8.1 | up to 1.0.3 | Historical contract, rejected since 1.0.4 |
| 6 | plugin-api 1.0.x–1.4.x | 1.0.4–1.4.3 | Factory constructors, event interfaces, device/system capabilities |
| 7 | plugin-api 2.0.x | 0.1.0+ | Current line: Sora package and class names, 39 capabilities, UI API level 3 |
Within one API level the SDK only makes binary-compatible additions: new optional interfaces, methods with default implementations, new constants, and factory functions. Removing or renaming public API, or changing semantics, requires a new apiLevel. Plugins on an older level must be rebuilt and re-signed against the current SDK.
Runtime constants:
PLUGIN_API_LEVEL = 7 // contract level the host implements
BASELINE_API_LEVEL = 7 // default when plugin.json omits apiLevel
MIN_SUPPORTED_API_LEVEL = 7 // lowest level the host still accepts
HOST_UI_API_LEVEL = 3 // Compose slot and page API level
PLUGIN_API_VERSION = "2.0.0" // the 2.0 contract line
DEFAULT_LANGUAGE = "default" // required key in every LocalizedTextThe manifest also carries version boundaries:
version— the plugin's own version,major.minor.patchwith an optional suffix. The current plugin suite is0.1.0.minHostVersion— the lowest host version the plugin supports; write"0.1.0"for the current suite. Onlymajor.minor.patchis compared, so a suffix is ignored.ui.apiLevel— the Compose UI level; use3. If it is out of range, only the plugin's UI is disabled.
When to build a plugin vs an MCP server
| Question | Plugin (.ddp) | MCP server |
|---|---|---|
| Where does the code run? | Inside the Sora app process, with the app UID | In its own process or a remote HTTP endpoint |
| What can it add? | Tools, skills, prompts, hooks, Compose UI, cards, pages | Tools, resources, and prompts over the MCP protocol |
| Trust model | Ed25519 signature plus install confirmation; code is equivalent to app code | Network and authorization boundary; no code runs in Sora |
| Failure impact | A crash can take the app down | Isolated from the app process |
| Distribution | Signed .ddp through the Sora-Market registry or a local file | Any reachable Streamable HTTP endpoint |
| Best for | Device access, host UI, LAN/CLI automation you control | Third-party services, shared team tools, remote data |
Build a plugin when the capability needs the host's device services, UI surfaces, or event hooks. Use an MCP server for third-party tool sources, shared services, and anything you would not run as code with all of Sora's permissions.
Where to go next
- Quick Start — copy the template and ship a signed
.ddp. - Manifest & Packaging — every manifest field,
.ddplayout, and the signing specification. - Runtime API — the complete
SoraPluginandPluginHostsurface. - UI Extensions — slots, pages, cards, and the
designsystem. - Testing & Signing — unit tests, keys, and verification.
- Publishing — Sora-Market entries and release flow.
