Python SDK
File: sdk/python/shire_sdk.py (single file, standard library only).
The CLI init copies it into a Python plugin; pack adds it to the package if
it is missing.
Connect
from shire_sdk import Plugin
plugin = Plugin() # reads SHIRE_PLUGIN_PIPE/TOKEN/ID
Plugin() connects, performs plugin.hello, keeps the capability/permission
lists, and raises ShireError on failure. run() is the event loop.
Calls
pos = plugin.player_position() # {'x','y','z','scene'}
scene = plugin.scene()
entities = plugin.entities(limit=64)
markers = plugin.markers(limit=128)
plugin.teleport(1.0, 2.0, 3.0, 0)
plugin.notify("Title", "Body", 0)
plugin.log("message", "info")
plugin.storage_set("key", {"n": 1})
value = plugin.storage_get("key")
plugin.storage_remove("key")
plugin.storage_keys()
UI
plugin.set_ui([
plugin.text("Hello", "title"),
plugin.section("Controls"),
plugin.toggle("enabled", "Enabled", True),
plugin.slider("speed", "Speed", 5, 0, 10),
plugin.input("name", "Name", ""),
plugin.select("mode", "Mode", ["A", "B"], "A"),
plugin.progress("Progress", 0.5),
plugin.button("refresh", "Refresh"),
])
plugin.update_ui("speed", value=7)
Component ids are required (auto-generated for text/section/progress helpers). The Host rejects duplicate ids and invalid types.
Events
plugin.subscribe("player.position", "scene.changed")
def on_position(data):
print(data["x"], data["z"])
plugin.on_event("player.position", on_position)
plugin.on_ui_event(lambda component, kind, value: print(component, value))
plugin.run()
Handlers run on the SDK loop thread; they may call plugin.* synchronously.
Do not block for long periods. plugin.stop()/close() ends the loop.
Manifest
{
"id": "com.example.hello",
"name": "Hello",
"version": "1.0.0",
"author": "You",
"description": "Hello plugin",
"apiVersion": "1.0",
"language": "python",
"entrypoint": "main.py",
"permissions": ["notifications.show", "ui.create"]
}
Test and pack
python tools\shire-plugin\shire_plugin.py test .\my-plugin
python tools\shire-plugin\shire_plugin.py pack .\my-plugin
The mock Host auto-approves; the production Host requires approval in the Plugin Manager.