tuil
Guides

Authoring Plugins

Build dependency-aware plugins with typed events and extension points.

View rawEdit
const analytics = createPlugin({
  id: "analytics",
  capabilities: ["events"],
  register(context) {
    const disposeRoute = context.extensions.routes.register({
      id: "analytics",
    });
    return () => disposeRoute();
  },
  activate(context) {
    return context.events.observe((event) => track(event));
  },
});

Rules

  • IDs are stable and unique.
  • Dependencies name other plugins; capabilities name host features.
  • Registration creates definitions and extension contributions.
  • Activation starts behavior after all dependencies are registered.
  • Every hook returns or owns its teardown.
  • Health reporting must not mutate application state.
Documentation flow diagram. [*] leads to resolved; resolved leads to registered; registered leads to initialized; initialized leads to active; active leads to inactive; inactive leads to disposed; registered leads to rolledBack: failure; initialized leads to rolledBack: failure
Documentation flow diagram. [*] leads to resolved; resolved leads to registered; registered leads to initialized; initialized leads to active; active leads to inactive; inactive leads to disposed; registered leads to rolledBack: failure; initialized leads to rolledBack: failure

On this page