Skip to main content

Interface: IExtensionHost

Defined in: Extensions/IExtensionHost.ts:202

Methods the host exposes to the rest of the desktop app (renderer IPC, the Spec C layout system, the search bar, the command registry).

Implementations live in packages/desktop/electron/extensions/ExtensionHost.ts.

Methods

activate()

activate(extensionId): Promise<void>

Defined in: Extensions/IExtensionHost.ts:251

Force-activate an extension regardless of activation events. Used by tests, the Extensions UI's "Activate now" button, and onCommand: event handling when a command is invoked before its extension has spawned.

Parameters

extensionId

string

Returns

Promise<void>


deactivate()

deactivate(extensionId): Promise<void>

Defined in: Extensions/IExtensionHost.ts:254

Deactivate an extension. Disposes contributions and kills the worker.

Parameters

extensionId

string

Returns

Promise<void>


disable()

disable(extensionId): Promise<void>

Defined in: Extensions/IExtensionHost.ts:239

Parameters

extensionId

string

Returns

Promise<void>


dispatchExtensionPoint()

dispatchExtensionPoint<TPayload, TReturn>(pointId, payload): Promise<TReturn>

Defined in: Extensions/IExtensionHost.ts:298

Internal dispatch entry — called by the host's own subsystems when an extension point fires. Subscribers in active extensions receive the payload via reverse RPC. The return shape depends on the point's kind (event/filter/provider — see EXTENSION_POINT_KINDS).

Type Parameters

TPayload

TPayload

TReturn

TReturn

Parameters

pointId

ExtensionPointId

payload

TPayload

Returns

Promise<TReturn>


enable()

enable(extensionId): Promise<void>

Defined in: Extensions/IExtensionHost.ts:238

Parameters

extensionId

string

Returns

Promise<void>


fireActivationEvent()

fireActivationEvent(eventId): Promise<void>

Defined in: Extensions/IExtensionHost.ts:260

Tell the host an activation event has fired. Any extensions whose activationEvents include this event get spawned.

Parameters

eventId

string

Returns

Promise<void>


getCrashLog()

getCrashLog(extensionId, limit?): Promise<ExtensionCrashRecord[]>

Defined in: Extensions/IExtensionHost.ts:285

Recent crash records (most recent first).

Parameters

extensionId

string

limit?

number

Returns

Promise<ExtensionCrashRecord[]>


getExtension()

getExtension(extensionId): Promise<ExtensionStateInfo | null>

Defined in: Extensions/IExtensionHost.ts:212

Snapshot of a single extension by ID, or null if not installed.

Parameters

extensionId

string

Returns

Promise<ExtensionStateInfo | null>


getLog()

getLog(extensionId, limit?): Promise<ExtensionLogEntry[]>

Defined in: Extensions/IExtensionHost.ts:288

Recent log entries (most recent first).

Parameters

extensionId

string

limit?

number

Returns

Promise<ExtensionLogEntry[]>


getSettings()

getSettings(extensionId): Promise<Record<string, unknown>>

Defined in: Extensions/IExtensionHost.ts:277

Read the user-edited settings KV for an extension. Used by the renderer's settings form.

Parameters

extensionId

string

Returns

Promise<Record<string, unknown>>


installExtension()

installExtension(opts): Promise<InstallResult | InstallError>

Defined in: Extensions/IExtensionHost.ts:222

Install an extension from a directory or packaged archive. Validates the manifest, prompts the user for consent if consent is omitted, copies files to data/extensions/<id>/, persists state, and emits extension.activated if activateNow is true.

Parameters

opts
activateNow?

boolean

{ grantedPermissions: ExtensionPermission[]; }

Pre-approved consent. If omitted, the host raises a consent request.

consent.grantedPermissions

ExtensionPermission[]

sourcePath

string

Returns

Promise<InstallResult | InstallError>


listExtensions()

listExtensions(): Promise<ExtensionStateInfo[]>

Defined in: Extensions/IExtensionHost.ts:209

Snapshot of all known extensions.

Returns

Promise<ExtensionStateInfo[]>


loadAll()

loadAll(): Promise<void>

Defined in: Extensions/IExtensionHost.ts:206

Read every manifest under data/extensions/ and register it. Idempotent.

Returns

Promise<void>


resetCrashState()

resetCrashState(extensionId): Promise<void>

Defined in: Extensions/IExtensionHost.ts:242

Clear the auto-disable flag and reset the session crash counter.

Parameters

extensionId

string

Returns

Promise<void>


setSettings()

setSettings(extensionId, values): Promise<void>

Defined in: Extensions/IExtensionHost.ts:280

Replace the user-edited settings for an extension. Validates against the schema.

Parameters

extensionId

string

values

Record<string, unknown>

Returns

Promise<void>


uninstallExtension()

uninstallExtension(extensionId): Promise<void>

Defined in: Extensions/IExtensionHost.ts:234

Uninstall an extension. Disposes all contributions, kills the worker, deletes files under data/extensions/<id>/, removes DB rows. User data stored under extension_storage is deleted alongside.

Parameters

extensionId

string

Returns

Promise<void>


updatePermissions()

updatePermissions(extensionId, grantedPermissions): Promise<void>

Defined in: Extensions/IExtensionHost.ts:269

Update granted permissions for an extension. Revoking a permission disposes any contributions that depended on it and rejects in-flight calls with PermissionDeniedError.

Parameters

extensionId

string

grantedPermissions

ExtensionPermission[]

Returns

Promise<void>