Quick Start
This page takes a plugin from an empty directory to a signed .ddp installed on a device. It uses the starter project in plugins/template/ and the public Sora-Maven repository.
Requirements
| Item | Version |
|---|---|
| JDK | 17 |
| Android SDK | compileSdk 36, minSdk 29 |
| Gradle | 9.8.2 (the template ships a wrapper) |
| Host app | Sora v0.1.0 on an Android 10+ device or emulator |
Set sdk.dir=/path/to/Android/Sdk in local.properties, or export ANDROID_HOME.
Project setup
- Copy the template and rename it:
cp -R plugins/template my-plugin
cd my-plugin- Rename the project in
settings.gradle.kts;rootProject.namedecides the.ddpfile name:
rootProject.name = "my-plugin"- Configure the build in
build.gradle.kts: changenamespace,applicationId,versionCode, andversionName. The template already targets the host toolchain:
plugins {
id("com.android.application") version "9.4.1"
id("org.jetbrains.kotlin.plugin.compose") version "2.4.21"
}
val pluginApiVersion = "2.0.2"
android {
namespace = "io.github.sadami3066.sora.plugintemplate"
compileSdk = 36
defaultConfig {
applicationId = "io.github.sadami3066.sora.plugintemplate"
minSdk = 29
targetSdk = 36
versionCode = 1
versionName = "0.1.0"
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
buildFeatures { compose = true }
buildTypes { release { isMinifyEnabled = false } }
}- Rename the package and entry class under
src/main/kotlin, then updateentryClassinsrc/main/assets/plugin.jsonto match.
Repositories
settings.gradle.kts must resolve the SDK from Sora-Maven, with mavenLocal first for local publishing of the SDK itself:
pluginManagement {
repositories {
google()
mavenCentral()
gradlePluginPortal()
}
}
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
mavenLocal {
content { includeGroup("io.github.sadami3066.sora") }
}
maven {
url = uri("https://sadami3066.github.io/Sora-Maven")
content { includeGroup("io.github.sadami3066.sora") }
}
google()
mavenCentral()
}
}Dependencies
Host libraries are compileOnly: the host has them at runtime, and bundling them into the plugin causes class conflicts. The template declares:
dependencies {
compileOnly("io.github.sadami3066.sora:plugin-api:2.0.2")
compileOnly("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.11.0")
compileOnly("org.jetbrains.kotlinx:kotlinx-serialization-json:1.12.0")
compileOnly(platform("androidx.compose:compose-bom:2026.03.00"))
compileOnly("androidx.compose.ui:ui")
compileOnly("androidx.compose.foundation:foundation")
compileOnly("androidx.compose.material3:material3")
}| Artifact | Version | Notes |
|---|---|---|
io.github.sadami3066.sora:plugin-api | 2.0.2 | The only contract artifact; already carries design 1.1.0 through api() |
io.github.sadami3066.sora:design | 1.1.0 | Compose design system; optional explicit compileOnly pin |
| Compose BOM | 2026.03.00 | Use the host Compose version |
kotlinx-coroutines-core | 1.11.0 | Host version |
kotlinx-serialization-json | 1.12.0 | Host version |
| AGP / Kotlin | 9.4.1 / 2.4.21 | Match the host toolchain |
| JVM target | 17 | jvmToolchain/jvmTarget |
Do not use implementation for host libraries, and do not bundle plugin-api, design, Compose, coroutines, or serialization. Third-party libraries are allowed if they are packed into classes*.dex and do not collide with host packages.
Manifest
The manifest lives at src/main/assets/plugin.json inside the plugin. A complete minimal manifest for the current suite:
{
"id": "io.github.sadami3066.sora.plugin.hello",
"version": "0.1.0",
"apiLevel": 7,
"minHostVersion": "0.1.0",
"ui": { "apiLevel": 3 },
"capabilities": ["logs", "settings"],
"entryClass": "io.github.sadami3066.sora.plugin.hello.HelloPlugin",
"name": { "default": "Hello", "zh": "你好", "en": "Hello" },
"summary": {
"default": "A minimal Sora plugin.",
"zh": "一个最小的 Sora 插件。",
"en": "A minimal Sora plugin."
},
"icon": "asset:icon.png",
"publisher": { "name": "Your Name" },
"provides": {
"tools": ["hello"],
"skills": [],
"uiSlots": [],
"pages": []
},
"defaultEnabled": true
}Every field, including capabilities, permissions, and components, is documented in Manifest & Packaging.
Minimal plugin
The entry class implements SoraPlugin. availability is the only required method; the rest default to empty.
package io.github.sadami3066.sora.plugin.hello
import io.github.sadami3066.sora.plugin.api.Contributions
import io.github.sadami3066.sora.plugin.api.PluginAvailability
import io.github.sadami3066.sora.plugin.api.PluginHost
import io.github.sadami3066.sora.plugin.api.PromptSection
import io.github.sadami3066.sora.plugin.api.SoraPlugin
import io.github.sadami3066.sora.plugin.api.available
import io.github.sadami3066.sora.plugin.api.contributions
import io.github.sadami3066.sora.plugin.api.pluginTool
import io.github.sadami3066.sora.plugin.api.promptSection
import io.github.sadami3066.sora.plugin.api.textResult
import kotlinx.serialization.json.JsonPrimitive
import kotlinx.serialization.json.buildJsonArray
import kotlinx.serialization.json.buildJsonObject
import kotlinx.serialization.json.jsonPrimitive
import kotlinx.serialization.json.put
import kotlinx.serialization.json.putJsonObject
class HelloPlugin : SoraPlugin {
override suspend fun availability(host: PluginHost): PluginAvailability = available()
override fun promptSections(host: PluginHost): List<PromptSection> = listOf(
promptSection(
id = "hello",
body = "The Hello plugin is installed. Call `hello` to greet the user.",
),
)
override fun contributions(host: PluginHost): Contributions = contributions(
tools = listOf(
pluginTool(
name = "hello",
description = "Greet the given name.",
parameters = buildJsonObject {
put("type", "object")
putJsonObject("properties") {
putJsonObject("name") {
put("type", "string")
put("description", "Name to greet.")
}
}
put("required", buildJsonArray { add(JsonPrimitive("name")) })
},
) { call ->
val name = call.args["name"]?.jsonPrimitive?.content.orEmpty()
host.logs().info("hello called for $name")
textResult("Hello, $name!")
},
),
)
}The host services used here (logs, settings) must be declared in capabilities; a service that is not declared throws PluginServiceUnavailable. See Runtime API for every accessor and its models.
Build, sign, verify
The template ships four Gradle tasks. All of them live in the plugin task group.
./gradlew generateSigningKey # first run only: keys/plugin-signing.pem and .pub
./gradlew assemblePlugin # build/plugin/my-plugin.unsigned.ddp
./gradlew signPlugin # build/plugin/my-plugin.ddp + META-INF/plugin-signature.json
./gradlew verifyPlugin # re-verifies the signature under host rules| Task | Purpose |
|---|---|
generateSigningKey | Creates an Ed25519 key pair at keys/plugin-signing.pem and .pub; refuses to overwrite existing keys. Template only — the shared official script expects keys to be provisioned |
assemblePlugin | Builds the debug APK and repacks it into <module>.unsigned.ddp, keeping only classes*.dex, assets/**, and lib/**, with fixed entry timestamps |
signPlugin | Signs the canonical entry digest and writes META-INF/plugin-signature.json; prints the publisher keyId, bundle SHA-256, and entry digest |
verifyPlugin | Recomputes the digest and verifies the signature against the declared keyId; prints Signature OK |
Signing keys resolve from a base path without extension. The template reads -PpluginSigningKey=<base> (default keys/plugin-signing). The shared script used by official plugins also accepts SORA_PLUGIN_SIGNING_KEY, $SORA_SECRETS_DIR/plugin-signing, ~/.config/sora/secrets/plugin-signing, then keys/plugin-signing. Details and key generation for CI are in Testing & Signing.
Keep the private key secret: anyone with it can publish updates under the same plugin identity. keys/ is gitignored by the template; back the key up, and never commit it.
verifyPlugin proves the signature matches the package contents. It does not prove the host will accept the manifest — validate ids, versions, capabilities, permissions, and components before importing.
Install on a device
There is one install entry: import a local .ddp.
- Transfer
build/plugin/my-plugin.ddpto the device (USB, adb push, or a file manager download). - Open the file with Sora from a file manager, share it to Sora, or use Plugins → Import plugin.
- Review the confirmation page: name, version, size, whole-package SHA-256, publisher name and
keyId, declared tools/skills/pages/prompt override, and capabilities/permissions/components. - Confirm. The host records the publisher key (trust on first use), unpacks the bundle, and enables the plugin when
defaultEnabledis true.
Updates use the same entry and must be signed with the same publisher key and carry a higher version. After an update, plugin runtime data in host.dataDir is preserved.
Debug loop
| Step | How |
|---|---|
| See plugin logs | All service calls raise host.logs() output; the host writes it to logcat under the tag SoraPlugin/<pluginId>: adb logcat -s SoraPlugin/io.github.sadami3066.sora.plugin.hello |
| Confirm the plugin loaded | Plugins page row shows the phase; a failed row shows the error text from load, validation, or activation |
| See tool results | Run the tool from chat; card content, errors, and details are rendered from the PluginToolResult |
| Refresh contributions | Call host.requestContributionsRefresh() after a page action changes tools, skills, or pages; busy sessions rebuild at the end of the current round |
| Unit tests | ./gradlew :testDebugUnitTest; see Testing & Signing |
| Rebuild after a change | ./gradlew verifyPlugin re-runs assemble, sign, and verify in order |
Common first-run problems:
| Symptom | Cause |
|---|---|
PluginServiceUnavailable at runtime | The capability for that accessor is missing from plugin.json; add it and reinstall |
ClassNotFoundException | entryClass does not match the class, or the class is missing from the root classes*.dex |
NoSuchMethodException | The entry class has no public no-arg constructor |
| Install rejected with a signature error | The .ddp was modified after signing, the key changed, or the signature entry is missing |
| UI blocks do not render | ui.apiLevel is out of range, or ui.kotlin/ui.compose do not match the host; UI is disabled while the plugin keeps working |
| Manifest error codes | See Manifest & Packaging → Validation codes |
Next steps
- Manifest & Packaging — full schema,
.ddpformat, signature spec, versioning rules. - Runtime API — every host service and contribution type.
- UI Extensions — pages, slots, tool cards, and the design system.
- Testing & Signing — unit tests, keys, and signature troubleshooting.
- Publishing — ship the bundle through Sora-Market.
