Skip to main content
xbot
Toggle Dark/Light/Auto mode Toggle Dark/Light/Auto mode Toggle Dark/Light/Auto mode Back to homepage

API Reference

This section is the complete API reference for xbot plugin development, generated from the actual source code. It covers both the Go plugin SDK (plugin/ package) and the web frontend plugin API (web/src/plugin-api/).

What’s Covered

DocumentDescription
Manifest SchemaComplete plugin.json schema with every field, validation rule, and contribution type
PluginContext APIThe permission-filtered API surface available to plugins during activation
PluginTool APITool definition, execution, result types, and the fluent result builder
Hook EventsAll 13 lifecycle hook events and the HookPayload field reference
Environment VariablesXBOT_* variables injected into script plugin processes
Permissions ListAll 23 permission strings, their meaning, and which APIs they gate
Trigger EventsActivation events and widget trigger matcher formats
Widget ZonesUI slot names where widgets can render
Component TypesDeclarative L1 component types for web views
RPC MethodsBackend RPC method table (host RPC + frontend ctx.rpc)
Event TypesLifecycle events, typed event bus (EventMap), and notifier types

Two Plugin Surfaces

xbot plugins have two distinct API surfaces:

  1. Go SDK (plugin/ package) — in-process native plugins and the host side of stdio plugins. Types: Plugin, PluginContext, PluginTool, HookPayload, etc.
  2. Web Plugin API (web/src/plugin-api/, package @xbot/plugin-api) — type-safe ESM frontend plugins. Types: PluginManifest, PluginContext<P>, EventMap, BackendRPC, etc. Capabilities are types: the permissions array in the manifest determines which capability interfaces exist on the context at compile time.

Permission Model

Every capability a plugin uses must be declared in plugin.json under permissions. The PermissionChecker (see Permissions List) enforces this at runtime; the web API enforces it at compile time via PluginContext<P>.

The wildcard "*" grants all permissions (Go side only). Invalid permissions fail manifest validation at load time.