Modules

Docs / API / Modules / plugins

Plugins

Platform

@s2script/sdk/plugins

runtime plugin management (the SM sm plugins backend).

2 exports

Import

import { PluginInfo } from "@s2script/sdk/plugins";

Author-time types ship in the npm package; the engine injects the runtime at plugin load. Add @s2script/sdk to your plugin's dependencies.

API reference

Generated from the shipped type definitions.

interface
PluginInfo

A snapshot of one plugin's identity and lifecycle state, as returned by Plugins.list.

readonly id: string
the plugin id (from its manifest).
readonly loaded: boolean
true = running; false = not running (loading, waiting, failed, or manually unloaded). Exactly state === "running".
readonly state: "running" | "loading" | "waiting" | "failed" | "unloaded"
the plugin's lifecycle state (L1 lifecycle v2): - "running" — Active (factory settled, armed). - "loading" — an in-flight factory load (async factory not yet settled). - "waiting" — parked until a hard-dependency producer is published (or a ~30s timeout). - "failed" — the load failed (bad artifact, throwing/rejecting factory, publishes mismatch, or a load timeout); the plugin is NOT running. - "unloaded" — on disk but manually unloaded via unload (not auto-reloaded until load/reload).
const
Plugins

Enumerate and drive the plugin set at runtime (list / load / unload / reload).

import { Plugins } from "@s2script/sdk/plugins";
// plugins/basecommands/src/plugin.ts:126 — sm plugins list
for (const p of Plugins.list()) cmd.reply(p.id + " — " + p.state);
list(): PluginInfo[]
Every loaded/unloaded plugin.
unload(id: string): boolean
Unload a running plugin (deferred to the next frame drain). false if it isn't loaded. It stays unloaded (not auto-reloaded by the file-watcher) until load/reload.
reload(id: string): boolean
Reload a plugin (unload + load from disk, deferred). false if the id is unknown.
load(id: string): boolean
Load a previously-unloaded plugin (deferred). false if it isn't currently unloaded.
Back to modules All packages

s2script — Source 2 plugin framework

GitHub