Tracks short-lived ownership of extension callback code.
Existing long-lived agent integrations use lease/4. Runtime editor callbacks
use source-aware admission: an active source admits only its declared module
set, quiescing closes ordinary admission, and the returned token authorizes the
source's final unload callbacks. Extension code remains resident for the VM
generation; this service never purges code.
Summary
Types
Why the module is still callable.
Public lease summary safe to include in errors and logs.
A process-owned extension code lease.
Opaque authority for callbacks that finalize a quiescing source.
Functions
Reopens ordinary admission when source finalization is abandoned.
Marks a source active with the exact callback modules it owns.
Returns active leases matching a module, source, or both.
Admits an ordinary runtime callback through the extension trust boundary.
Admits a token-scoped callback while its extension source is quiescing.
Returns a specification to start this module under a supervisor.
Marks a quiescing source inactive after unload callbacks finish.
Leases an extension callback module for the owner process.
Sends an event as soon as a source has no active callback leases.
Closes ordinary callback admission and returns unload authority.
Releases a previously acquired lease.
Returns one source's admission status for lifecycle crash recovery.
Starts the code lease service.
Types
@type reason() :: :provider | :tool | :hook | :mcp | :ui_action | :editor_event | atom()
Why the module is still callable.
@type source_status() :: :active | {:quiescing, unload_token()} | :inactive
@type summary() :: %{ source: Minga.Extension.ContributionCleanup.contribution_source(), module: module(), owner: pid(), reason: reason() }
Public lease summary safe to include in errors and logs.
@type t() :: %Minga.Extension.CodeLease{ id: reference(), module: module(), owner: pid(), reason: reason(), server: GenServer.server(), source: Minga.Extension.ContributionCleanup.contribution_source(), started_at: integer() }
A process-owned extension code lease.
@type unload_token() :: reference()
Opaque authority for callbacks that finalize a quiescing source.
Functions
@spec abort_unload( unload_token(), keyword() ) :: :ok | {:error, term()}
Reopens ordinary admission when source finalization is abandoned.
@spec activate_source( Minga.Extension.ContributionCleanup.contribution_source(), [module()], keyword() ) :: :ok | {:error, term()}
Marks a source active with the exact callback modules it owns.
Returns active leases matching a module, source, or both.
@spec admit_callback( Minga.Extension.ContributionCleanup.contribution_source(), module(), reason(), keyword() ) :: {:ok, t()} | {:error, term()}
Admits an ordinary runtime callback through the extension trust boundary.
@spec admit_unload_callback(unload_token(), module(), reason(), keyword()) :: {:ok, t()} | {:error, term()}
Admits a token-scoped callback while its extension source is quiescing.
Returns a specification to start this module under a supervisor.
See Supervisor.
@spec complete_unload( unload_token(), keyword() ) :: :ok | {:error, term()}
Marks a quiescing source inactive after unload callbacks finish.
@spec lease( Minga.Extension.ContributionCleanup.contribution_source(), module(), reason(), keyword() ) :: {:ok, t()} | {:error, term()}
Leases an extension callback module for the owner process.
@spec notify_when_drained( Minga.Extension.ContributionCleanup.contribution_source(), pid(), reference(), keyword() ) :: :ok | {:error, term()}
Sends an event as soon as a source has no active callback leases.
@spec quiesce_source( Minga.Extension.ContributionCleanup.contribution_source(), keyword() ) :: {:ok, unload_token()} | {:error, term()}
Closes ordinary callback admission and returns unload authority.
Releases a previously acquired lease.
@spec source_status( Minga.Extension.ContributionCleanup.contribution_source(), keyword() ) :: source_status() | :unknown
Returns one source's admission status for lifecycle crash recovery.
@spec start_link(keyword()) :: GenServer.on_start()
Starts the code lease service.