Inter-plugin interfaces
Plugins talk through typed, versioned interfaces — methods as natives, events as forwards:
// producer
import { publishInterface } from '@s2script/interfaces';
publishInterface('@s2script/zones', '1.0.0', {
createZone(name, mins, maxs) { /* … */ },
on(event, handler) { /* … */ }
});
// consumer
import { on, isInZone } from '@s2script/zones';
on('stay', ({ slot, zone }) => { /* … */ }); Hard deps get a proxy that throws InterfaceUnavailable while the producer is unloaded. Optional deps resolve to Interface | null. Args cross contexts by structured copy; EntityRef round-trips as a live serial-gated ref.
Declare deps under s2script.pluginDependencies. Imports are ledgered; unload walks reverse-dependency order.
See interfaces and the zones plugin.