DynamicSupervisor managing extension process trees.
Each extension gets its own child under this supervisor. If an extension crashes, only that extension restarts. The editor and other extensions are unaffected.
Lifecycle
- Config eval registers extensions in
Extension.Registry start_all/0reads the registry and starts each extensionstop_all/0terminates all running extensions (used by reload)
Summary
Types
Options for extension start/stop that inject collaborator dependencies.
Functions
Returns a specification to start this module under a supervisor.
Returns a summary of all extensions: [{name, version, status}].
Starts all extensions declared in the registry.
Starts a single extension by name.
Starts the extension supervisor.
Stops all running extensions and purges their modules.
Stops a single extension, terminates its process, and purges the module.
Types
@type start_opts() :: [ command_registry: GenServer.server(), keymap: GenServer.server(), callbacks: %{ required(atom()) => Minga.Extension.ContributionCleanup.cleanup_fun() }, code_lease: GenServer.server(), slow_lifecycle_threshold_ms: non_neg_integer(), test_hooks: map() ]
Options for extension start/stop that inject collaborator dependencies.
:command_registry— theMinga.Command.Registryserver to register commands with (default:Minga.Command.Registry):keymap— theMinga.Keymap.Activeserver to register keybindings with (default:Minga.Keymap.Active):callbacks— cleanup callbacks map, injected for test isolation (default: reads fromContributionCleanuppersistent_term):code_lease— theMinga.Extension.CodeLeaseserver to consult before purging extension callback modules (default:Minga.Extension.CodeLease)
Functions
Returns a specification to start this module under a supervisor.
See Supervisor.
@spec list_extensions() :: [{atom(), String.t(), Minga.Extension.extension_status()}]
Returns a summary of all extensions: [{name, version, status}].
@spec list_extensions(GenServer.server()) :: [ {atom(), String.t(), Minga.Extension.extension_status()} ]
@spec start_all() :: :ok | {:error, [start_failure()]}
Starts all extensions declared in the registry.
Processes extensions in order:
- Install all hex extensions via a single Mix.install/2 call
- Clone/checkout all git extensions to local cache
- Compile and start all extensions (path, git, hex)
Errors at any stage are logged to Messages and stored in the
registry as :load_error without affecting other extensions.
@spec start_all(GenServer.server(), GenServer.server()) :: :ok | {:error, [start_failure()]}
@spec start_all(GenServer.server(), GenServer.server(), start_opts()) :: :ok | {:error, [start_failure()]}
@spec start_extension( GenServer.server(), GenServer.server(), atom(), Minga.Extension.Registry.entry(), start_opts() ) :: {:ok, pid()} | {:error, term()}
Starts a single extension by name.
For path extensions, compiles the module from the local directory. Git and hex extensions must be resolved to a local path or loaded via Mix.install before calling this function.
@spec start_link(keyword()) :: Supervisor.on_start()
Starts the extension supervisor.
@spec stop_all() :: :ok | {:error, [stop_failure()]}
Stops all running extensions and purges their modules.
Used by config reload to cleanly tear down before re-loading.
@spec stop_all(GenServer.server(), GenServer.server()) :: :ok | {:error, [stop_failure()]}
@spec stop_all(GenServer.server(), GenServer.server(), start_opts()) :: :ok | {:error, [stop_failure()]}
@spec stop_extension( GenServer.server(), GenServer.server(), atom(), Minga.Extension.Registry.entry(), start_opts() ) :: :ok | {:error, term()}
Stops a single extension, terminates its process, and purges the module.