Skip to content

Services

Applies to PCL N Plugin SDK 0.2.5 · Product host: PCL.Plugin.Sidecar (CoreCLR) + AOT desktop.

Plugins resolve host services from context.Services. Put hard requirements in Manifest services.required; put optional enhancements in services.optional.

Runtime note

Services below are provided inside the Sidecar process after the host starts PCL.Plugin.Sidecar over IPC. The AOT desktop shell does not load third-party plugin IL. See Architecture and Boundaries.

Core host services

IDC# interfacePurpose
pcl.loggingIPluginLoggerStructured plugin logs (context.Logger)
pcl.dispatcherIPluginDispatcherUI/main-thread work (context.Dispatcher)
pcl.notificationsIPluginNotificationServiceInfo / warning toasts
pcl.settingsIPluginSettingsStorePer-plugin key/value settings
pcl.commandsIPluginCommandServiceRegister and invoke commands
pcl.tasksIPluginTaskServiceLifetime-tracked background work
pcl.instances.readIPluginInstanceReadServiceRead-only Minecraft instance list
pcl.localizationIPluginLocalizationServiceHost culture + plugin strings
pcl.secure-storageIPluginSecureStorageIsolated OS credential storage
pcl.uri-launcherIPluginUriLauncherOpen http(s) via host
pcl.background-tasksIPluginBackgroundTaskServiceTask-manager progress UI
pcl.package-assetsIPluginPackageAssetServiceRead-only files from the installed signed package

Package assets vs private files

  • pcl.files (IPluginFileService) — read/write the plugin private data directory.
  • pcl.package-assets (IPluginPackageAssetService) — resolve paths listed in META-INF/pnp.files.json, verify size + SHA-256, return absolute path.
csharp
IPluginPackageAssetService packages = context.Services.Require<IPluginPackageAssetService>();
PluginPackageAssetResult result = await packages.ResolveAsync("assets/template.json", cancellationToken);
if (result.IsSuccess)
    context.Logger.Info(result.Asset!.FullPath);

Game, process, files, accounts

IDC# interfaceNotes
pcl.game.sessionsIPluginGameSessionServiceRequires launch.observe
pcl.game.outputIPluginGameOutputServiceRequires game.output.read
pcl.launch.eventsIPluginLaunchEventServiceRequires launch.observe
pcl.processIPluginProcessServiceRequires process.start (+ process.output for streams)
pcl.clipboardIPluginClipboardServiceclipboard.read / clipboard.write
pcl.filesIPluginFileServicePrivate data directory only
pcl.accounts.readIPluginAccountReadServiceRequires account.read
pcl.downloadsIPluginDownloadServiceSource catalog (read-only)
pcl.launch.modifyIPluginLaunchModificationServiceRequires launch.modify

UI and navigation

IDC# interfacePackage
pcl.uiIPluginUiSurfaceRegistryAbstractions
pcl.ui.patchIPluginUiPatchServiceAbstractions
pcl.navigationIPluginNavigationServicePCLN.Plugin.UI
pcl.ui.avaloniaIAvaloniaUiAccessServicePCLN.Plugin.UI.Avalonia
pcl.ui.avalonia.pagesIAvaloniaPluginPageServicePCLN.Plugin.UI.Avalonia
pcl.ui.avalonia.windowsIAvaloniaPluginWindowServicePCLN.Plugin.UI.Avalonia

IDs for UI adapters live in PluginUiServiceIds. Prefer declarative surfaces/slots; treat raw Avalonia as opt-in with ui.raw-access.

Registry, runtime patches, exports, market

IDC# interfacePurpose
pcl.registryIPluginRegistryServiceACL-protected extension registry
pcl.runtime-patchesIPluginRuntimePatchServiceTrusted method patches
pcl.exportsIPluginExportRegistryCross-plugin stable contracts
pcl.marketIPluginMarketClient (host-internal)Online market HTTP client

Market: Sidecar uses IPluginMarketClient internally for browse/download/verify. The stable ID pcl.market is reserved; third-party plugins must not assume a remote market client is injected into context.Services today. See Registry and Runtime Patches for registry/patch permissions and examples.

Capability negotiation

Presence of a NuGet interface does not mean every host build exposes it. Always negotiate:

csharp
PluginApiVersionRange range = PluginApiVersionRange.Parse(">=0.1 <1.0");
if (context.Services.Supports(PluginServiceIds.PackageAssets, range) &&
    context.Services.TryGet<IPluginPackageAssetService>(out var packages))
{
    // ...
}

For longer Chinese examples and cookbook snippets, see the Chinese Services guide; contracts are identical.