@xema-platform/plugin-host-sdk
v0.1.0
Published
Xema platform plugin-host SDK. Lightweight, framework-agnostic primitives (Registry<K, V>, manifest types, registry errors) shared by every plugin host across the Xema platform — backend services, frontend hosts, plugin authoring tools.
Maintainers
Readme
@xema-platform/plugin-host-sdk
Lightweight, framework-agnostic primitives shared by every plugin host across the Xema platform — backend services, frontend hosts, plugin authoring tools. The SDK does not assume any particular UI framework, dependency-injection container, or runtime; it ships only the contracts.
What's in this package
Registry<K extends string, V extends RegistryEntry<K>>— typed in-memory registry with fail-fast on duplicate-key registration and missing-key lookup.RegistryDuplicateKeyError,RegistryMissingKeyError— typed error subclasses for the two failure modes.- Manifest type definitions consumed by host code that loads plugin metadata.
Install
npm install @xema-platform/plugin-host-sdk
# or
pnpm add @xema-platform/plugin-host-sdkUsage
import { Registry } from '@xema-platform/plugin-host-sdk';
interface Agent {
readonly key: string;
readonly displayName: string;
}
const agents = new Registry<string, Agent>({ name: 'AgentRegistry' });
agents.register({ key: 'builder', displayName: 'Builder' });
const agent = agents.require('builder'); // throws RegistryMissingKeyError if absentDocumentation
Architecture, plugin contracts, host-adapter design, and the multi-shell strategy are documented at docs.xema.dev/plugins.
Related packages
@xema-platform/plugin-registry-web— frontend-host plugin registry built on top of this SDK.@xema-platform/plugin-host-react-router— drop-in HostBridge implementation for Vite + react-router-dom hosts.
License
Apache-2.0.
