import type { Event } from '#/_base/event'; import type { FiberHandle, FiberProvideOptions, FiberState, ServiceClassRecipe, ServiceRecipe, } from '#/_base/di/fiber'; import { createDecorator, type ServiceIdentifier } from '#/_base/di/instantiation'; import type { ContributedFeatureService } from './featureServiceContribution'; export interface ManagedUnitInfo { readonly name: string; readonly state: FiberState; readonly uid: number | undefined; readonly meta: Record; } export interface IFeatureManager { readonly _serviceBrand: undefined; provideUnit(recipe: ServiceRecipe, opts?: FiberProvideOptions): FiberHandle; provideUnit( id: ServiceIdentifier, recipe: ServiceClassRecipe, opts?: FiberProvideOptions, ): FiberHandle; unprovideUnit(name: string): Promise; updateUnit(name: string, config?: unknown): Promise; units(): readonly ManagedUnitInfo[]; contributedServices(): readonly ContributedFeatureService[]; readonly onDidChangeUnits: Event; } export const IFeatureManager = createDecorator('featureManager');