Plugins

Capability-graph extension points.

Extension — register planner rules and commands

Plugins extend SpineEditor through a capability graph with deterministic resolution at engine initialization. See packages/core/src/plugin.ts.

Contract

interface Plugin {
  readonly id: PluginId;
  readonly provides?: readonly CapabilityId[];
  readonly requires?: readonly CapabilityId[];
  readonly conflicts?: readonly CapabilityId[];
  readonly plannerRules?: readonly PluginPlannerRule[];
  readonly commands?: readonly PluginCommand[];
  readonly meta?: PluginData;
}

resolvePlugins(plugins: readonly Plugin[]): PluginResolution
collectPlannerRules(resolution.ordered): readonly ResolvedPluginPlannerRule[]
collectCommands(resolution.ordered): readonly ResolvedPluginCommand[]

resolvePlugins(...) returns both a deterministic ordered list and any PluginResolutionError values. createEditorEngine(...) rejects non-empty error lists by throwing PluginResolutionFailedError; lower-level tooling can call resolvePlugins(...) directly when it wants to inspect errors without constructing an engine.

What plugins contribute

  • Planner rules (PluginPlannerRule) — additional IntentPlanOp rules consulted by the planner.
  • Commands (PluginCommand) — intent factories registered under a stable CommandId.
  • Metadata (PluginData) — JSON-safe plugin metadata used for resolution and tooling.

Deterministic resolution

resolvePlugins resolves ordering once, at initialization. Two engines with the same plugin list resolve to the same ordering.